-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setup Region/Partition Agnostic aws_instance Acceptance Testing #4987
Comments
… ipv6_address_count into Terraform state In the Terraform 0.12 Provider SDK acceptance testing framework, attributes that do not call `ResourceData.Set()` are no longer automatically ignored during `ImportStateVerify` testing. Here we opt to always refresh the `associate_public_ip_address` and `ipv6_address_count` attributes into the Terraform state. This change is backwards compatible. This changeset is the bare minimum to ensure the existing acceptance testing is in a better passing state with the Terraform 0.12 Provider SDK, however there are likely many more additional changes required once the `ImportStateVerify` test step is applied to all acceptance tests for the resource as part of some upcoming technical debt work (#4987). Previous output from Terraform 0.12 Provider SDK acceptance testing: ``` --- FAIL: TestAccAWSInstance_importBasic (93.87s) testing.go:568: Step 1 error: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected. (map[string]string) { } (map[string]string) (len=1) { (string) (len=18) "ipv6_address_count": (string) (len=1) "0" } --- FAIL: TestAccAWSInstance_importInDefaultVpcBySgId (193.29s) testing.go:568: Step 1 error: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected. (map[string]string) { } (map[string]string) (len=1) { (string) (len=18) "ipv6_address_count": (string) (len=1) "0" } --- FAIL: TestAccAWSInstance_importInDefaultVpcBySgName (183.91s) testing.go:568: Step 1 error: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected. (map[string]string) { } (map[string]string) (len=1) { (string) (len=18) "ipv6_address_count": (string) (len=1) "0" } --- FAIL: TestAccAWSInstance_importInEc2Classic (108.87s) testing.go:568: Step 1 error: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected. (map[string]string) { } (map[string]string) (len=2) { (string) (len=27) "associate_public_ip_address": (string) (len=5) "false", (string) (len=18) "ipv6_address_count": (string) (len=1) "0" } ``` Output from Terraform 0.11 Provider SDK acceptance testing: ``` --- PASS: TestAccAWSInstance_addSecondaryInterface (85.27s) --- PASS: TestAccAWSInstance_addSecurityGroupNetworkInterface (227.80s) --- PASS: TestAccAWSInstance_associatePublic_defaultPrivate (183.36s) --- PASS: TestAccAWSInstance_associatePublic_defaultPublic (51.53s) --- PASS: TestAccAWSInstance_associatePublic_explicitPrivate (52.10s) --- PASS: TestAccAWSInstance_associatePublic_explicitPublic (51.22s) --- PASS: TestAccAWSInstance_associatePublic_overridePrivate (51.22s) --- PASS: TestAccAWSInstance_associatePublic_overridePublic (71.58s) --- PASS: TestAccAWSInstance_associatePublicIPAndPrivateIP (50.40s) --- PASS: TestAccAWSInstance_basic (317.85s) --- PASS: TestAccAWSInstance_blockDevices (101.23s) --- PASS: TestAccAWSInstance_changeInstanceType (328.94s) --- PASS: TestAccAWSInstance_creditSpecification_isNotAppliedToNonBurstable (151.69s) --- PASS: TestAccAWSInstance_creditSpecification_standardCpuCredits (178.74s) --- PASS: TestAccAWSInstance_creditSpecification_standardCpuCredits_t2Tot3Taint (340.18s) --- PASS: TestAccAWSInstance_creditSpecification_unlimitedCpuCredits (56.89s) --- PASS: TestAccAWSInstance_creditSpecification_unlimitedCpuCredits_t2Tot3Taint (320.30s) --- PASS: TestAccAWSInstance_creditSpecification_unspecifiedDefaultsToStandard (183.49s) --- PASS: TestAccAWSInstance_creditSpecification_updateCpuCredits (188.24s) --- PASS: TestAccAWSInstance_creditSpecificationT3_standardCpuCredits (290.36s) --- PASS: TestAccAWSInstance_creditSpecificationT3_unlimitedCpuCredits (291.21s) --- PASS: TestAccAWSInstance_creditSpecificationT3_unspecifiedDefaultsToUnlimited (284.34s) --- PASS: TestAccAWSInstance_creditSpecificationT3_updateCpuCredits (116.93s) --- PASS: TestAccAWSInstance_disableApiTermination (257.56s) --- PASS: TestAccAWSInstance_disappears (258.64s) --- PASS: TestAccAWSInstance_forceNewAndTagsDrift (277.56s) --- PASS: TestAccAWSInstance_getPasswordData_falseToTrue (154.93s) --- PASS: TestAccAWSInstance_getPasswordData_trueToFalse (145.14s) --- PASS: TestAccAWSInstance_GP2IopsDevice (79.88s) --- PASS: TestAccAWSInstance_GP2WithIopsValue (89.27s) --- PASS: TestAccAWSInstance_importBasic (201.64s) --- PASS: TestAccAWSInstance_importInDefaultVpcBySgId (190.99s) --- PASS: TestAccAWSInstance_importInDefaultVpcBySgName (78.33s) --- PASS: TestAccAWSInstance_importInEc2Classic (209.77s) --- PASS: TestAccAWSInstance_instanceProfileChange (143.04s) --- PASS: TestAccAWSInstance_ipv6_supportAddressCount (202.10s) --- PASS: TestAccAWSInstance_ipv6_supportAddressCountWithIpv4 (218.22s) --- PASS: TestAccAWSInstance_ipv6AddressCountAndSingleAddressCausesError (9.72s) --- PASS: TestAccAWSInstance_keyPairCheck (78.74s) --- PASS: TestAccAWSInstance_multipleRegions (280.08s) --- PASS: TestAccAWSInstance_NetworkInstanceRemovingAllSecurityGroups (73.45s) --- PASS: TestAccAWSInstance_NetworkInstanceSecurityGroups (96.32s) --- PASS: TestAccAWSInstance_NetworkInstanceVPCSecurityGroupIDs (68.35s) --- PASS: TestAccAWSInstance_noAMIEphemeralDevices (53.25s) --- PASS: TestAccAWSInstance_placementGroup (174.29s) --- PASS: TestAccAWSInstance_primaryNetworkInterface (153.92s) --- PASS: TestAccAWSInstance_primaryNetworkInterfaceSourceDestCheck (184.91s) --- PASS: TestAccAWSInstance_privateIP (72.60s) --- PASS: TestAccAWSInstance_rootBlockDeviceMismatch (172.17s) --- PASS: TestAccAWSInstance_rootInstanceStore (66.92s) --- PASS: TestAccAWSInstance_sourceDestCheck (114.61s) --- PASS: TestAccAWSInstance_tags (265.95s) --- PASS: TestAccAWSInstance_UserData_EmptyStringToUnspecified (79.90s) --- PASS: TestAccAWSInstance_UserData_UnspecifiedToEmptyString (78.14s) --- PASS: TestAccAWSInstance_userDataBase64 (276.05s) --- PASS: TestAccAWSInstance_volumeTags (95.11s) --- PASS: TestAccAWSInstance_volumeTagsComputed (110.97s) --- PASS: TestAccAWSInstance_vpc (109.50s) --- PASS: TestAccAWSInstance_withIamInstanceProfile (128.98s) ``` Output from Terraform 0.12 Provider SDK acceptance testing (test failure related to EC2 eventual consistency): ``` --- FAIL: TestAccAWSInstance_associatePublic_defaultPublic (199.26s) testing.go:568: Step 0 error: Check failed: Check 2/3 error: aws_instance.foo: Attribute 'associate_public_ip_address' expected "true", got "false" --- PASS: TestAccAWSInstance_addSecondaryInterface (87.28s) --- PASS: TestAccAWSInstance_addSecurityGroupNetworkInterface (228.83s) --- PASS: TestAccAWSInstance_associatePublic_defaultPrivate (72.65s) --- PASS: TestAccAWSInstance_associatePublic_explicitPrivate (193.33s) --- PASS: TestAccAWSInstance_associatePublic_explicitPublic (52.31s) --- PASS: TestAccAWSInstance_associatePublic_overridePrivate (72.60s) --- PASS: TestAccAWSInstance_associatePublic_overridePublic (71.89s) --- PASS: TestAccAWSInstance_associatePublicIPAndPrivateIP (218.20s) --- PASS: TestAccAWSInstance_basic (333.50s) --- PASS: TestAccAWSInstance_blockDevices (183.67s) --- PASS: TestAccAWSInstance_changeInstanceType (328.80s) --- PASS: TestAccAWSInstance_creditSpecification_isNotAppliedToNonBurstable (91.65s) --- PASS: TestAccAWSInstance_creditSpecification_standardCpuCredits (80.29s) --- PASS: TestAccAWSInstance_creditSpecification_standardCpuCredits_t2Tot3Taint (373.38s) --- PASS: TestAccAWSInstance_creditSpecification_unlimitedCpuCredits (89.86s) --- PASS: TestAccAWSInstance_creditSpecification_unlimitedCpuCredits_t2Tot3Taint (352.61s) --- PASS: TestAccAWSInstance_creditSpecification_unspecifiedDefaultsToStandard (71.34s) --- PASS: TestAccAWSInstance_creditSpecification_updateCpuCredits (88.96s) --- PASS: TestAccAWSInstance_creditSpecificationT3_standardCpuCredits (294.12s) --- PASS: TestAccAWSInstance_creditSpecificationT3_unlimitedCpuCredits (107.09s) --- PASS: TestAccAWSInstance_creditSpecificationT3_unspecifiedDefaultsToUnlimited (305.43s) --- PASS: TestAccAWSInstance_creditSpecificationT3_updateCpuCredits (314.59s) --- PASS: TestAccAWSInstance_disableApiTermination (186.23s) --- PASS: TestAccAWSInstance_disappears (239.69s) --- PASS: TestAccAWSInstance_forceNewAndTagsDrift (277.17s) --- PASS: TestAccAWSInstance_getPasswordData_falseToTrue (136.94s) --- PASS: TestAccAWSInstance_getPasswordData_trueToFalse (135.95s) --- PASS: TestAccAWSInstance_GP2IopsDevice (84.83s) --- PASS: TestAccAWSInstance_GP2WithIopsValue (77.64s) --- PASS: TestAccAWSInstance_importBasic (114.84s) --- PASS: TestAccAWSInstance_importInDefaultVpcBySgId (88.80s) --- PASS: TestAccAWSInstance_importInDefaultVpcBySgName (85.34s) --- PASS: TestAccAWSInstance_importInEc2Classic (92.19s) --- PASS: TestAccAWSInstance_instanceProfileChange (288.48s) --- PASS: TestAccAWSInstance_ipv6_supportAddressCount (80.62s) --- PASS: TestAccAWSInstance_ipv6_supportAddressCountWithIpv4 (84.83s) --- PASS: TestAccAWSInstance_ipv6AddressCountAndSingleAddressCausesError (12.15s) --- PASS: TestAccAWSInstance_keyPairCheck (185.46s) --- PASS: TestAccAWSInstance_multipleRegions (253.31s) --- PASS: TestAccAWSInstance_NetworkInstanceRemovingAllSecurityGroups (87.59s) --- PASS: TestAccAWSInstance_NetworkInstanceSecurityGroups (189.14s) --- PASS: TestAccAWSInstance_NetworkInstanceVPCSecurityGroupIDs (186.27s) --- PASS: TestAccAWSInstance_noAMIEphemeralDevices (57.35s) --- PASS: TestAccAWSInstance_placementGroup (92.35s) --- PASS: TestAccAWSInstance_primaryNetworkInterface (54.41s) --- PASS: TestAccAWSInstance_primaryNetworkInterfaceSourceDestCheck (186.46s) --- PASS: TestAccAWSInstance_privateIP (71.72s) --- PASS: TestAccAWSInstance_rootBlockDeviceMismatch (174.52s) --- PASS: TestAccAWSInstance_rootInstanceStore (71.25s) --- PASS: TestAccAWSInstance_sourceDestCheck (118.67s) --- PASS: TestAccAWSInstance_tags (245.43s) --- PASS: TestAccAWSInstance_UserData_EmptyStringToUnspecified (127.46s) --- PASS: TestAccAWSInstance_UserData_UnspecifiedToEmptyString (91.24s) --- PASS: TestAccAWSInstance_userDataBase64 (229.08s) --- PASS: TestAccAWSInstance_volumeTags (98.22s) --- PASS: TestAccAWSInstance_volumeTagsComputed (102.21s) --- PASS: TestAccAWSInstance_vpc (206.67s) --- PASS: TestAccAWSInstance_withIamInstanceProfile (222.62s) ```
Look also at acceptance tests for:
as there are some with hard-coded AMIs (look for |
Not all instance types are available in all regions/partitions so there will need to be cleanup of We can use the new EC2 |
Unfortunately instance type regional availability varies in other AWS services beyond EC2 as well. The CloudFormation Linter gathers instance type regional availability for over a dozen services from the pricing API here |
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Its not currently possible to run the
aws_instance
resource and data source acceptance testing outsideus-west-2
and get meaningful results. For example, settingAWS_DEFAULT_REGION=us-east-1
while running the tests today returns:Tests failed: 61 (59 new), passed: 6
Many of the failures are similar to:
And:
We can switch to using the
aws_region
,aws_availability_zones
, andaws_partition
data sources as appropriate to remove hardcodedus-west-2
pieces. For acceptance tests that cannot occur outside ofus-west-2
(due to very specific AMIs, etc.), we can set them up witht.Skip()
.The text was updated successfully, but these errors were encountered: