Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
provider/aws: Remove IAM user's MFA devices with
force_destroy
hash…
…icorp#5908 (hashicorp#10262) When `force_destroy` was specifed on an `aws_iam_user` resource, only IAM access keys and the login profile were destroyed. If a multi-factor auth device had been activated for that user, deletion would fail as follows: ``` * aws_iam_user.testuser1: Error deleting IAM User testuser1: DeleteConflict: Cannot delete entity, must delete MFA device first. status code: 409, request id: aa41b1b7-ac4d-11e6-bb3f-3b4c7a310c65 ``` This commit iterates over any of the user's MFA devices and deactivates them before deleting the user. It follows a pattern similar to that used to remove users' IAM access keys before deletion. ``` $ make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSUser_' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2016/11/20 17:09:00 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSUser_ -timeout 120m === RUN TestAccAWSUser_importBasic --- PASS: TestAccAWSUser_importBasic (5.70s) === RUN TestAccAWSUser_basic --- PASS: TestAccAWSUser_basic (11.12s) PASS ok github.com/rhenning/terraform/builtin/providers/aws 20.840s ```
- Loading branch information