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

resource/aws_iam_user: Delete a user's virtual MFA devices when force_destroy is enabled #11040

Merged

Conversation

eytanhanig
Copy link
Contributor

Fully removing a virtual MFA device requires first deactivating then deleting it. Currently the resource aws_am_user with force_destroy = true implements only the deactivation step and results in dissociated virtual MFA devices being left behind. This can cause issues should a future user - likely one with the same name as the deleted user - attempt to enable virtual MFA with the same path.

This PR implements the deletion step for virtual MFA devices. It also renames the prior function deleteAwsIamUserMFADevices to deactivateAwsIamUserMFADevices in order to reflect what's actually happening to non-virtual MFA devices.

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" comments, they generate extra noise for pull request followers and do not help prioritize the request

Release note for CHANGELOG:

resource/aws_iam_user: Delete a user's virtual MFA devices when `force_destroy` is enabled

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSUser_ForceDestroy_MFADevice'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -count 1 -parallel 20 -run=TestAccAWSUser_ForceDestroy_MFADevice -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSUser_ForceDestroy_MFADevice
=== PAUSE TestAccAWSUser_ForceDestroy_MFADevice
=== CONT  TestAccAWSUser_ForceDestroy_MFADevice
--- PASS: TestAccAWSUser_ForceDestroy_MFADevice (22.34s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	23.867s
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws/internal/flatmap	0.258s [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags	0.118s [no tests to run]'

@eytanhanig eytanhanig requested a review from a team November 27, 2019 20:14
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. size/S Managed by automation to categorize the size of a PR. service/iam Issues and PRs that pertain to the iam service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Nov 27, 2019
@gdavison gdavison self-assigned this Nov 27, 2019
@gdavison gdavison removed the needs-triage Waiting for first response or review from a maintainer. label Nov 27, 2019
@gdavison gdavison added this to the v2.41.0 milestone Nov 28, 2019
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, @eytanhanig. We will be merging this for the next release, expected late next week, though the schedule may be affected by AWS re:Invent.

@gdavison gdavison merged commit 1679a26 into hashicorp:master Nov 28, 2019
gdavison added a commit that referenced this pull request Nov 28, 2019
@gdavison gdavison removed their assignment Nov 28, 2019
@eytanhanig
Copy link
Contributor Author

Thanks for the PR, @eytanhanig. We will be merging this for the next release, expected late next week, though the schedule may be affected by AWS re:Invent.

Thank you! This is my first big OSS contribution (and my first foray into Go) so I really appreciate your fast review & communication.

@gdavison gdavison added the enhancement Requests to existing resources that expand the functionality or scope. label Nov 28, 2019
@ghost
Copy link

ghost commented Dec 4, 2019

This has been released in version 2.41.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 for triage. Thanks!

@ghost
Copy link

ghost commented Mar 28, 2020

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.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/iam Issues and PRs that pertain to the iam service. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants