-
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
Migrate remaining EC2
service resources to AWS SDK V2
#38363
Conversation
% make testacc TESTARGS='-run=TestAccClientVPNEndpoint_serial/Route_basic' PKG=ec2 make: Verifying source code with gofmt... ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.22.5 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run=TestAccClientVPNEndpoint_serial/Route_basic -timeout 360m === RUN TestAccClientVPNEndpoint_serial === PAUSE TestAccClientVPNEndpoint_serial === CONT TestAccClientVPNEndpoint_serial === RUN TestAccClientVPNEndpoint_serial/Route_basic === PAUSE TestAccClientVPNEndpoint_serial/Route_basic === CONT TestAccClientVPNEndpoint_serial/Route_basic --- PASS: TestAccClientVPNEndpoint_serial (0.06s) --- PASS: TestAccClientVPNEndpoint_serial/Route_basic (959.23s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/ec2 964.272s
% make testacc TESTARGS='-run=TestAccClientVPNEndpoint_serial/AuthorizationRule_basic' PKG=ec2 make: Verifying source code with gofmt... ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.22.5 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run=TestAccClientVPNEndpoint_serial/AuthorizationRule_basic -timeout 360m === RUN TestAccClientVPNEndpoint_serial === PAUSE TestAccClientVPNEndpoint_serial === CONT TestAccClientVPNEndpoint_serial === RUN TestAccClientVPNEndpoint_serial/AuthorizationRule_basic === PAUSE TestAccClientVPNEndpoint_serial/AuthorizationRule_basic === CONT TestAccClientVPNEndpoint_serial/AuthorizationRule_basic --- PASS: TestAccClientVPNEndpoint_serial (0.12s) --- PASS: TestAccClientVPNEndpoint_serial/AuthorizationRule_basic (51.44s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/ec2 56.491s
% make testacc TESTARGS='-run=TestAccEC2AMILaunchPermission_basic' PKG=ec2 make: Verifying source code with gofmt... ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.22.5 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run=TestAccEC2AMILaunchPermission_basic -timeout 360m === RUN TestAccEC2AMILaunchPermission_basic === PAUSE TestAccEC2AMILaunchPermission_basic === CONT TestAccEC2AMILaunchPermission_basic --- PASS: TestAccEC2AMILaunchPermission_basic (115.25s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/ec2 120.318s
% make testacc TESTARGS='-run=TestAccEC2CapacityBlockOfferingDataSource_' PKG=ec2 make: Verifying source code with gofmt... ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.22.5 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run=TestAccEC2CapacityBlockOfferingDataSource_ -timeout 360m === RUN TestAccEC2CapacityBlockOfferingDataSource_basic === PAUSE TestAccEC2CapacityBlockOfferingDataSource_basic === CONT TestAccEC2CapacityBlockOfferingDataSource_basic --- PASS: TestAccEC2CapacityBlockOfferingDataSource_basic (7.90s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/ec2 12.959s
% make testacc TESTARGS='-run=TestAccEC2InstanceState_' PKG=ec2 make: Verifying source code with gofmt... ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.22.5 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run=TestAccEC2InstanceState_ -timeout 360m === RUN TestAccEC2InstanceState_basic === PAUSE TestAccEC2InstanceState_basic === RUN TestAccEC2InstanceState_state === PAUSE TestAccEC2InstanceState_state === RUN TestAccEC2InstanceState_disappears_Instance === PAUSE TestAccEC2InstanceState_disappears_Instance === CONT TestAccEC2InstanceState_basic === CONT TestAccEC2InstanceState_disappears_Instance === CONT TestAccEC2InstanceState_state --- PASS: TestAccEC2InstanceState_basic (348.07s) --- PASS: TestAccEC2InstanceState_disappears_Instance (364.72s) --- PASS: TestAccEC2InstanceState_state (683.51s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/ec2 688.657s
% make testacc TESTARGS='-run=TestAccEC2CapacityBlockReservation_' PKG=ec2 make: Verifying source code with gofmt... ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.22.5 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run=TestAccEC2CapacityBlockReservation_ -timeout 360m === RUN TestAccEC2CapacityBlockReservation_basic ec2_capacity_block_reservation_test.go:28: Environment variable RUN_EC2_CAPACITY_BLOCK_RESERVATION_TESTS is not set to true --- SKIP: TestAccEC2CapacityBlockReservation_basic (0.00s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/ec2 5.075s
% make testacc TESTARGS='-run=TestAccVPCEndpointPrivateDNS_' PKG=ec2 make: Verifying source code with gofmt... ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.22.5 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run=TestAccVPCEndpointPrivateDNS_ -timeout 360m === RUN TestAccVPCEndpointPrivateDNS_basic === PAUSE TestAccVPCEndpointPrivateDNS_basic === RUN TestAccVPCEndpointPrivateDNS_disabled === PAUSE TestAccVPCEndpointPrivateDNS_disabled === RUN TestAccVPCEndpointPrivateDNS_disappears_Endpoint === PAUSE TestAccVPCEndpointPrivateDNS_disappears_Endpoint === RUN TestAccVPCEndpointPrivateDNS_update === PAUSE TestAccVPCEndpointPrivateDNS_update === CONT TestAccVPCEndpointPrivateDNS_basic === CONT TestAccVPCEndpointPrivateDNS_disappears_Endpoint === CONT TestAccVPCEndpointPrivateDNS_update === CONT TestAccVPCEndpointPrivateDNS_disabled --- PASS: TestAccVPCEndpointPrivateDNS_disabled (43.32s) --- PASS: TestAccVPCEndpointPrivateDNS_disappears_Endpoint (117.40s) --- PASS: TestAccVPCEndpointPrivateDNS_basic (119.36s) --- PASS: TestAccVPCEndpointPrivateDNS_update (167.46s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/ec2 172.554s
% make testacc TESTARGS='-run=TestAccVPCEndpointServicePrivateDNSVerification_' PKG=ec2 make: Verifying source code with gofmt... ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.22.5 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run=TestAccVPCEndpointServicePrivateDNSVerification_ -timeout 360m === RUN TestAccVPCEndpointServicePrivateDNSVerification_basic === PAUSE TestAccVPCEndpointServicePrivateDNSVerification_basic === RUN TestAccVPCEndpointServicePrivateDNSVerification_waitForVerification === PAUSE TestAccVPCEndpointServicePrivateDNSVerification_waitForVerification === CONT TestAccVPCEndpointServicePrivateDNSVerification_basic === CONT TestAccVPCEndpointServicePrivateDNSVerification_waitForVerification --- PASS: TestAccVPCEndpointServicePrivateDNSVerification_basic (228.97s) --- PASS: TestAccVPCEndpointServicePrivateDNSVerification_waitForVerification (262.15s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/ec2 267.206s
…v2/tfawserr' -> 'aws-sdk-go-base/v2/tfawserr'.
Thank you for your contribution! 🚀 Please note that typically Go dependency changes are handled in this repository by dependabot or the maintainers. This is to prevent pull request merge conflicts and further delay reviews of contributions. Remove any changes to the Additional details:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀.
All my random acceptance tests passed; we plan on merging (once 🟢) in time for our full TeamCity acceptance test run this weekend.
Thank you for your contribution! 🚀 Please note that typically Go dependency changes are handled in this repository by dependabot or the maintainers. This is to prevent pull request merge conflicts and further delay reviews of contributions. Remove any changes to the Additional details:
|
Sounds great, really curious to know how the tests went, thanks for reviewing! |
You're amazing @DanielRieske |
This functionality has been released in v5.60.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Description
This PR migrates the remaining
EC2
resources, it will also address technical debt and migrate manyv2
references that were temporarily placed as the migration of this service has been done in many PRs.Many different services are referencing functions within the
EC2
service and these will be migrated to use the appropriate client.All acceptance tests for the services touched with this migration will be ran and included in the test logging below.
Also fixing the majority of failing EC2 acceptance tests mentioned in #35747, only fixing tests that do not require changes to the resource or if the change is negligible.
TestAccEC2AMIIDsDataSource_sorted
- originally fixed in Migrateec2
resources to AWS SDK V2 #37568 but regressed, fixed by adding an additional filter with a relative creation date.TestAccVPCNetworkACLAssociation_disappears_NACL
/TestAccVPCNetworkACLAssociation_disappears_Subnet
/TestAccVPCNetworkACLAssociation_disappears
fixed by adding a check in the delete operation forNotFound
scenario's. CommitTestAccVPCSecurityGroup_forceRevokeRulesFalse
andTestAccVPCSecurityGroup_forceRevokeRulesTrue
fixed by adding an ignore onegress
during import. This is because in step 1 we create a dependency cycle outside of Terraform. Because of this the import phase would fail and this data isn't important for the import test and should therefore be ignored.Also fixed the
testRemoveCycle
function to check the length of the object, if this is 0 the API would return anapi error MissingParameter: Either 'ipPermissions' or 'securityGroupRuleIds' should be provided.
Commit and commitTestAccVPCNetworkInterface_ignoreExternalAttachment
fixed by adding an additional step to remove the external attachment created in step 1. CommitTestAccVPCSecurityGroupRule_expectInvalidTypeError
fixed by changing expected error message. CommitTestAccVPCSecurityGroupRule_*
specifically thedescription
attribute during import fixed by changing the attribute to a pointer, this is because an empty string is a valid description but it shouldn't be set if not specified. Otherwise the import phase will break. CommitThese tests weren't successful due to quota limitations.
TestAccVPC_IPAMIPv4BasicExplicitCIDR (5.98s)
-api error ResourceLimitExceeded: You've reached the limit for ipams. You have created 1 ipams and you are limited to 1.
TestAccVPC_IPAMIPv4BasicNetmask (6.12s)
-api error ResourceLimitExceeded: You've reached the limit for ipams. You have created 1 ipams and you are limited to 1.
TestAccVPCIPv4CIDRBlockAssociation_ipamBasic (82.71s)
-api error ResourceLimitExceeded: You've reached the limit for ipams. You have created 1 ipams and you are limited to 1.
TestAccVPCIPv4CIDRBlockAssociation_ipamBasicExplicitCIDR (10.38s)
-api error ResourceLimitExceeded: You've reached the limit for ipams. You have created 1 ipams and you are limited to 1.
These are the last EC2 tests that weren't successful but isn't caused by changes in this PR. They require a look at the resources themselves and shouldn't be fixed in this PR.
TestAccVPCSecurityGroup_rulesDropOnError (37.73s)
TestAccVPCSecurityGroup_ipRangesWithSameRules (28.10s)
TestAccVPCSecurityGroup_ipRangeAndSecurityGroupWithSameRules (30.74s)
TestAccVPCSecurityGroup_allowAll (28.38s)
TestAccVPCSecurityGroupRule_MultipleRuleSearching_allProtocolCrash (23.05s)
TestAccVPCSecurityGroupRule_DescriptionAllPorts_nonZeroPorts (21.30s)
TestAccVPCPeeringConnection_options (34.09s)
A bit out of scope but there are several tests in services that I touched with this migration that weren't working.
I had to fix them as I otherwise cannot with confidence say that the changes I made didn't impact any of the other resources.
TestAccElasticBeanstalkEnvironment_platformARN
- Updated the platform version but we need to review this in the future, this is currently still being done hardcoded and will break if there is a new release. CommitMany EMR Cluster tests were using the
EMR_DefaultRole
orEMR_EC2_DefaultRole
roles in accordance with https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-iam-role-for-ec2.html I changed them to use a custom role. CommitTestAccEMRCluster_autoTerminationPolicy
seems to be failing due to a different issue with computed arguments not set. I created an issue for it here [Bug]:TestAccEMRCluster_autoTerminationPolicy
failing due toebs_config
missing computed fields #38373There are also a few more EMR tests failing but I believe that these are unrelated to the changes and should be checked afterwards as to not make the scope of this ticket even bigger.
Relations
Closes #36219
References
Output from Acceptance Testing
Batch service:
TestAccBatchJobQueue_MigrateFromPluginSDK
is a pre-existing failure: #34794Comprehend service:
EC2 service:
EFS service:
Elasticbeanstalk service:
ELB service:
EMR service:
Global Accelerator service:
Meta service:
Networkmonitor