You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This test tries to imitate a real world example of behaviour we often see in the AzureRM provider which requires
345
-
the use of `ImportStateVerifyIgnore` when testing the import of a resource using the import command.
344
+
This test tries to imitate a real world example of behaviour we often see in the AzureRM provider which requires
345
+
the use of `ImportStateVerifyIgnore` when testing the import of a resource using the import command.
346
346
347
-
A sensitive field e.g. a password can be supplied on create but isn't returned in the API response on a subsequent
348
-
read, resulting in a different value for password in the two states.
347
+
A sensitive field e.g. a password can be supplied on create but isn't returned in the API response on a subsequent
348
+
read, resulting in a different value for password in the two states.
349
349
350
-
In the AzureRM provider this is usually handled one of two ways, both requiring `ImportStateVerifyIgnore` to make
351
-
the test pass:
350
+
In the AzureRM provider this is usually handled one of two ways, both requiring `ImportStateVerifyIgnore` to make
351
+
the test pass:
352
352
353
-
1. Property doesn't get set in the read
354
-
* in pluginSDK at create the config gets written to state because that's what we're expecting
355
-
* the subsequent read updates the values to create a post-apply diff and update computed values
356
-
* since we don't do anything to the property in the read the imported resource's state has the password missing
357
-
compared to the created resource's state
353
+
1. Property doesn't get set in the read
354
+
* in pluginSDK at create the config gets written to state because that's what we're expecting
355
+
* the subsequent read updates the values to create a post-apply diff and update computed values
356
+
* since we don't do anything to the property in the read the imported resource's state has the password missing
357
+
compared to the created resource's state
358
358
359
-
2. We retrieve the value from config and set that into state
360
-
* the config isn't available at import time using only the import command (I think?) so there is nothing to
361
-
retrieve and set into state when importing
359
+
2. We retrieve the value from config and set that into state
360
+
* the config isn't available at import time using only the import command (I think?) so there is nothing to
361
+
retrieve and set into state when importing
362
362
363
-
For this test to pass I needed to add a `PlanChangeFunc` to the resource to set the id to a known value in the plan - see comment in the `PlanChangeFunc`
364
-
365
-
I also need to omit the `password` in the import config, otherwise the value in the config is used when importing the resource and the test
366
-
ends up passing regardless of whether `ImportStateVerifyIgnore` has been specified or not
367
-
368
-
Ultimately it looks like:
369
-
* Terraform is saying there's a bug in the provider? (see comment in `PlanChangeFunc`)
370
-
* The import behaviour using a block vs. the command appears to differ
363
+
I also need to omit the `password` in the import config, otherwise the value in the config is used when importing the
364
+
with an import block and the test ends up passing regardless of whether `ImportStateVerifyIgnore` has been specified or not
0 commit comments