terraform/helper/resource
Martin Atkins bd1a215580 helper/resource: Ignore Removed attributes for ImportStateVerify
Due to the lossiness of our legacy models for diff and state, shimming a
diff and then creating a state from it produces a different result than
shimming a state directly. That means that ImportStateVerify no longer
works as expected if there are any Computed attributes in the schema where
d.Set isn't called during Read.

Fixing that for every case would require some risky changes to the shim
behavior, so we're instead going to ask provider developers to address it
by adding `d.Set` calls where needed, since that is the contract for
"Computed" anyway -- a default value should be produced during Create, and
thus by extension during Import.

However, since a common situation where this occurs is attributes marked
as "Removed", since all of the code that deals with them has generally
been deleted, we'll avoid problems in that case here by treating Removed
attributes as ignored for the purposes of ImportStateVerify.

This required exporting some functionality that was formerly unexported
in helper/schema, but it's a relatively harmless schema introspection
function so shouldn't be a big deal to export it.
2019-04-16 11:14:49 -07:00
..
error.go helper/resource: Add retries to err message 2017-01-20 11:09:04 -08:00
grpc_test_provider.go plugin: Establish our current plugin protocol as version 5 2018-11-19 09:56:41 -08:00
id.go Export a const for validation methods 2018-03-10 12:40:37 -05:00
id_test.go Make failure message more explicit 2018-03-10 21:53:54 -05:00
map.go ResourceDiff => InstanceDiff 2014-09-17 16:33:24 -07:00
map_test.go helper/resource: Fix duplicated function testConfig 2018-10-16 19:14:11 -07:00
resource.go ResourceDiff => InstanceDiff 2014-09-17 16:33:24 -07:00
state.go grammatical updates to comments and docs (#20195) 2019-03-21 14:05:41 -07:00
state_shim.go Revert "helper/schema: Implementation of the AsSingle mechanism" 2019-04-08 16:45:35 -04:00
state_shim_test.go helper/resource: Preserve provider address when shimming to old state 2019-03-19 15:08:46 -07:00
state_test.go add test for proper cancelation 2017-04-19 18:07:00 -04:00
testing.go allow 0 and unset to be equal in count tests 2019-02-11 11:35:19 -05:00
testing_config.go add (forces new resource) to provider test diffs 2019-03-22 15:30:51 -04:00
testing_import_state.go helper/resource: Ignore Removed attributes for ImportStateVerify 2019-04-16 11:14:49 -07:00
testing_import_state_test.go skip resource tests for now 2018-10-31 14:17:23 -04:00
testing_test.go allow 0 and unset to be equal in count tests 2019-02-11 11:35:19 -05:00
wait.go Fixing small typo in resource/wait.go 2018-03-14 17:33:03 +01:00
wait_test.go fix tests affected by refreshGracePeriod 2017-04-19 18:07:00 -04:00