Skip to content
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

r/ec2_ami and d/ec2_ami - Support deprecate time for AMIs #24489

Merged
merged 19 commits into from
May 2, 2022

Conversation

Nnachevvv
Copy link
Contributor

@Nnachevvv Nnachevvv commented Apr 30, 2022

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #24454
This PR:

  • Introduces new parameter - deprecate_at for r/ec2_ami and d/ec2_ami.
  • In addition, multiple tests for r/ec2_ami have been failing because outpost_arn has not been included to ebs_block_device map.
    Output from acceptance testing:
make testacc cc TESTS=TestAccEC2AMI_deprecateAt PKG=ec2                     
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccEC2AMI_deprecateAt'  -timeout 180m
=== RUN   TestAccEC2AMI_deprecateAt
=== PAUSE TestAccEC2AMI_deprecateAt
=== CONT  TestAccEC2AMI_deprecateAt
--- PASS: TestAccEC2AMI_deprecateAt (146.72s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	151.491s


 make testacc cc TESTS=TestAccEC2AMI_description PKG=ec2                                                                      
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccEC2AMI_description'  -timeout 180m
=== RUN   TestAccEC2AMI_description
=== PAUSE TestAccEC2AMI_description
=== CONT  TestAccEC2AMI_description
--- PASS: TestAccEC2AMI_description (156.89s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	161.415s

 make testacc cc TESTS=TestAccEC2AMI_ephemeralBlockDevices PKG=ec2 
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccEC2AMI_ephemeralBlockDevices'  -timeout 180m
=== RUN   TestAccEC2AMI_ephemeralBlockDevices
=== PAUSE TestAccEC2AMI_ephemeralBlockDevices
=== CONT  TestAccEC2AMI_ephemeralBlockDevices
--- PASS: TestAccEC2AMI_ephemeralBlockDevices (108.73s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	112.931s


make testacc cc TESTS=TestAccEC2AMIDataSource PKG=ec2 
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccEC2AMIDataSource'  -timeout 180m
=== RUN   TestAccEC2AMIDataSource_natInstance
=== PAUSE TestAccEC2AMIDataSource_natInstance
=== RUN   TestAccEC2AMIDataSource_windowsInstance
=== PAUSE TestAccEC2AMIDataSource_windowsInstance
=== RUN   TestAccEC2AMIDataSource_instanceStore
=== PAUSE TestAccEC2AMIDataSource_instanceStore
=== RUN   TestAccEC2AMIDataSource_localNameFilter
=== PAUSE TestAccEC2AMIDataSource_localNameFilter
=== RUN   TestAccEC2AMIDataSource_gp3BlockDevice
=== PAUSE TestAccEC2AMIDataSource_gp3BlockDevice
=== CONT  TestAccEC2AMIDataSource_natInstance
=== CONT  TestAccEC2AMIDataSource_localNameFilter
=== CONT  TestAccEC2AMIDataSource_gp3BlockDevice
=== CONT  TestAccEC2AMIDataSource_instanceStore
=== CONT  TestAccEC2AMIDataSource_windowsInstance
--- PASS: TestAccEC2AMIDataSource_instanceStore (59.56s)
--- PASS: TestAccEC2AMIDataSource_natInstance (62.52s)
--- PASS: TestAccEC2AMIDataSource_windowsInstance (64.11s)
--- PASS: TestAccEC2AMIDataSource_localNameFilter (67.12s)
--- PASS: TestAccEC2AMIDataSource_gp3BlockDevice (100.43s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	105.109s
...

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. documentation Introduces or discusses updates to documentation. service/ec2 Issues and PRs that pertain to the ec2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/L Managed by automation to categorize the size of a PR. labels Apr 30, 2022
@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label May 2, 2022
Acceptance test output:

% make testacc TESTS=TestAccEC2AMI_basic PKG=ec2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccEC2AMI_basic'  -timeout 180m
=== RUN   TestAccEC2AMI_basic
=== PAUSE TestAccEC2AMI_basic
=== CONT  TestAccEC2AMI_basic
--- PASS: TestAccEC2AMI_basic (56.29s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	60.399s
@github-actions github-actions bot added size/XL Managed by automation to categorize the size of a PR. verify Pertains to the verify package (i.e., provider-level validating, diff suppression, etc.) and removed size/L Managed by automation to categorize the size of a PR. labels May 2, 2022
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀.

% make testacc TESTS=TestAccEC2AMI PKG=ec2 ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 3 -run='TestAccEC2AMI'  -timeout 180m
=== RUN   TestAccEC2AMICopy_basic
=== PAUSE TestAccEC2AMICopy_basic
=== RUN   TestAccEC2AMICopy_description
=== PAUSE TestAccEC2AMICopy_description
=== RUN   TestAccEC2AMICopy_enaSupport
=== PAUSE TestAccEC2AMICopy_enaSupport
=== RUN   TestAccEC2AMICopy_destinationOutpost
=== PAUSE TestAccEC2AMICopy_destinationOutpost
=== RUN   TestAccEC2AMICopy_tags
=== PAUSE TestAccEC2AMICopy_tags
=== RUN   TestAccEC2AMIDataSource_natInstance
=== PAUSE TestAccEC2AMIDataSource_natInstance
=== RUN   TestAccEC2AMIDataSource_windowsInstance
=== PAUSE TestAccEC2AMIDataSource_windowsInstance
=== RUN   TestAccEC2AMIDataSource_instanceStore
=== PAUSE TestAccEC2AMIDataSource_instanceStore
=== RUN   TestAccEC2AMIDataSource_localNameFilter
=== PAUSE TestAccEC2AMIDataSource_localNameFilter
=== RUN   TestAccEC2AMIDataSource_gp3BlockDevice
=== PAUSE TestAccEC2AMIDataSource_gp3BlockDevice
=== RUN   TestAccEC2AMIFromInstance_basic
=== PAUSE TestAccEC2AMIFromInstance_basic
=== RUN   TestAccEC2AMIFromInstance_tags
=== PAUSE TestAccEC2AMIFromInstance_tags
=== RUN   TestAccEC2AMIFromInstance_disappears
=== PAUSE TestAccEC2AMIFromInstance_disappears
=== RUN   TestAccEC2AMIIDsDataSource_basic
=== PAUSE TestAccEC2AMIIDsDataSource_basic
=== RUN   TestAccEC2AMIIDsDataSource_sorted
=== PAUSE TestAccEC2AMIIDsDataSource_sorted
=== RUN   TestAccEC2AMILaunchPermission_basic
=== PAUSE TestAccEC2AMILaunchPermission_basic
=== RUN   TestAccEC2AMILaunchPermission_disappears
=== PAUSE TestAccEC2AMILaunchPermission_disappears
=== RUN   TestAccEC2AMILaunchPermission_Disappears_ami
=== PAUSE TestAccEC2AMILaunchPermission_Disappears_ami
=== RUN   TestAccEC2AMILaunchPermission_group
=== PAUSE TestAccEC2AMILaunchPermission_group
=== RUN   TestAccEC2AMILaunchPermission_organizationARN
=== PAUSE TestAccEC2AMILaunchPermission_organizationARN
=== RUN   TestAccEC2AMILaunchPermission_organizationalUnitARN
=== PAUSE TestAccEC2AMILaunchPermission_organizationalUnitARN
=== RUN   TestAccEC2AMI_basic
=== PAUSE TestAccEC2AMI_basic
=== RUN   TestAccEC2AMI_deprecateAt
=== PAUSE TestAccEC2AMI_deprecateAt
=== RUN   TestAccEC2AMI_description
=== PAUSE TestAccEC2AMI_description
=== RUN   TestAccEC2AMI_disappears
=== PAUSE TestAccEC2AMI_disappears
=== RUN   TestAccEC2AMI_ephemeralBlockDevices
=== PAUSE TestAccEC2AMI_ephemeralBlockDevices
=== RUN   TestAccEC2AMI_gp3BlockDevice
=== PAUSE TestAccEC2AMI_gp3BlockDevice
=== RUN   TestAccEC2AMI_tags
=== PAUSE TestAccEC2AMI_tags
=== RUN   TestAccEC2AMI_outpost
=== PAUSE TestAccEC2AMI_outpost
=== RUN   TestAccEC2AMI_boot
=== PAUSE TestAccEC2AMI_boot
=== CONT  TestAccEC2AMICopy_basic
=== CONT  TestAccEC2AMILaunchPermission_basic
=== CONT  TestAccEC2AMIDataSource_localNameFilter
--- PASS: TestAccEC2AMIDataSource_localNameFilter (41.69s)
=== CONT  TestAccEC2AMI_description
--- PASS: TestAccEC2AMI_description (51.70s)
=== CONT  TestAccEC2AMI_boot
--- PASS: TestAccEC2AMI_boot (53.39s)
=== CONT  TestAccEC2AMI_outpost
    acctest.go:1308: skipping since no Outposts found
--- SKIP: TestAccEC2AMI_outpost (0.72s)
=== CONT  TestAccEC2AMI_tags
--- PASS: TestAccEC2AMI_tags (81.23s)
=== CONT  TestAccEC2AMI_gp3BlockDevice
--- PASS: TestAccEC2AMI_gp3BlockDevice (55.58s)
=== CONT  TestAccEC2AMI_ephemeralBlockDevices
--- PASS: TestAccEC2AMI_ephemeralBlockDevices (54.52s)
=== CONT  TestAccEC2AMI_disappears
--- PASS: TestAccEC2AMILaunchPermission_basic (362.35s)
=== CONT  TestAccEC2AMILaunchPermission_organizationARN
--- PASS: TestAccEC2AMICopy_basic (371.22s)
=== CONT  TestAccEC2AMI_deprecateAt
--- PASS: TestAccEC2AMI_disappears (51.82s)
=== CONT  TestAccEC2AMI_basic
--- PASS: TestAccEC2AMI_deprecateAt (66.37s)
=== CONT  TestAccEC2AMILaunchPermission_organizationalUnitARN
    acctest.go:697: skipping tests; this AWS account must not be an existing member of an AWS Organization
--- SKIP: TestAccEC2AMILaunchPermission_organizationalUnitARN (0.12s)
=== CONT  TestAccEC2AMILaunchPermission_Disappears_ami
--- PASS: TestAccEC2AMI_basic (55.33s)
=== CONT  TestAccEC2AMILaunchPermission_group
--- PASS: TestAccEC2AMILaunchPermission_organizationARN (358.07s)
=== CONT  TestAccEC2AMIFromInstance_basic
--- PASS: TestAccEC2AMILaunchPermission_Disappears_ami (355.68s)
=== CONT  TestAccEC2AMIFromInstance_tags
--- PASS: TestAccEC2AMILaunchPermission_group (356.12s)
=== CONT  TestAccEC2AMIFromInstance_disappears
--- PASS: TestAccEC2AMIFromInstance_basic (327.17s)
=== CONT  TestAccEC2AMICopy_tags
--- PASS: TestAccEC2AMIFromInstance_disappears (297.89s)
=== CONT  TestAccEC2AMIIDsDataSource_sorted
--- PASS: TestAccEC2AMIFromInstance_tags (389.42s)
=== CONT  TestAccEC2AMIDataSource_instanceStore
--- PASS: TestAccEC2AMIIDsDataSource_sorted (91.02s)
=== CONT  TestAccEC2AMIIDsDataSource_basic
--- PASS: TestAccEC2AMIIDsDataSource_basic (12.11s)
=== CONT  TestAccEC2AMIDataSource_windowsInstance
--- PASS: TestAccEC2AMIDataSource_instanceStore (33.00s)
=== CONT  TestAccEC2AMICopy_enaSupport
--- PASS: TestAccEC2AMIDataSource_windowsInstance (36.44s)
=== CONT  TestAccEC2AMIDataSource_natInstance
--- PASS: TestAccEC2AMIDataSource_natInstance (34.79s)
=== CONT  TestAccEC2AMICopy_destinationOutpost
    acctest.go:1308: skipping since no Outposts found
--- SKIP: TestAccEC2AMICopy_destinationOutpost (0.49s)
=== CONT  TestAccEC2AMILaunchPermission_disappears
--- PASS: TestAccEC2AMICopy_tags (396.09s)
=== CONT  TestAccEC2AMIDataSource_gp3BlockDevice
--- PASS: TestAccEC2AMIDataSource_gp3BlockDevice (52.09s)
=== CONT  TestAccEC2AMICopy_description
--- PASS: TestAccEC2AMICopy_enaSupport (379.08s)
--- PASS: TestAccEC2AMILaunchPermission_disappears (354.16s)
--- PASS: TestAccEC2AMICopy_description (380.75s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	1882.759s

@ewbankkit
Copy link
Contributor

@Nnachevvv Thanks for the contribution 🎉 👏.
I changed the new argument name to deprecation_time to better match the underlying AWS API and also added it to the aws_ami_copy and aws_ami_from_instance resources as they share the same resource schema.

@ewbankkit ewbankkit merged commit b1933f8 into hashicorp:main May 2, 2022
@github-actions github-actions bot added this to the v4.13.0 milestone May 2, 2022
@github-actions
Copy link

github-actions bot commented May 5, 2022

This functionality has been released in v4.13.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!

@github-actions
Copy link

github-actions bot commented Jun 5, 2022

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. service/ec2 Issues and PRs that pertain to the ec2 service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. verify Pertains to the verify package (i.e., provider-level validating, diff suppression, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support deprecate time for AMIs
2 participants