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/iam_instance_profile - add tagging support to instance profile + sweeper #17962

Merged
merged 8 commits into from
Mar 25, 2021

Conversation

DrFaust92
Copy link
Collaborator

@DrFaust92 DrFaust92 commented Mar 5, 2021

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

Relates #17594

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSIAMInstanceProfile_'
--- PASS: TestAccAWSIAMInstanceProfile_withoutRole (32.05s)
--- PASS: TestAccAWSIAMInstanceProfile_disappears_role (36.93s)
--- PASS: TestAccAWSIAMInstanceProfile_disappears (37.08s)
--- PASS: TestAccAWSIAMInstanceProfile_basic (42.21s)
--- PASS: TestAccAWSIAMInstanceProfile_namePrefix (48.56s)
--- PASS: TestAccAWSIAMInstanceProfile_tags (98.49s)

@DrFaust92 DrFaust92 requested a review from a team as a code owner March 5, 2021 21:13
@ghost ghost added size/L Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. service/iam Issues and PRs that pertain to the iam service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Mar 5, 2021
@DrFaust92 DrFaust92 added the enhancement Requests to existing resources that expand the functionality or scope. label Mar 5, 2021
@DrFaust92 DrFaust92 changed the title r/iam_instance_profile - add tagging support to instance profile rd/iam_instance_profile - add tagging support to instance profile Mar 5, 2021
@DrFaust92 DrFaust92 changed the title rd/iam_instance_profile - add tagging support to instance profile r/iam_instance_profile - add tagging support to instance profile Mar 5, 2021
@DrFaust92 DrFaust92 changed the title r/iam_instance_profile - add tagging support to instance profile r/iam_instance_profile - add tagging support to instance profile + sweeper Mar 6, 2021
@ewbankkit
Copy link
Contributor

Verified acceptance tests:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSIAMInstanceProfile_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSIAMInstanceProfile_ -timeout 120m
=== RUN   TestAccAWSIAMInstanceProfile_basic
=== PAUSE TestAccAWSIAMInstanceProfile_basic
=== RUN   TestAccAWSIAMInstanceProfile_withoutRole
=== PAUSE TestAccAWSIAMInstanceProfile_withoutRole
=== RUN   TestAccAWSIAMInstanceProfile_tags
=== PAUSE TestAccAWSIAMInstanceProfile_tags
=== RUN   TestAccAWSIAMInstanceProfile_namePrefix
=== PAUSE TestAccAWSIAMInstanceProfile_namePrefix
=== RUN   TestAccAWSIAMInstanceProfile_disappears
=== PAUSE TestAccAWSIAMInstanceProfile_disappears
=== RUN   TestAccAWSIAMInstanceProfile_disappears_role
=== PAUSE TestAccAWSIAMInstanceProfile_disappears_role
=== CONT  TestAccAWSIAMInstanceProfile_basic
=== CONT  TestAccAWSIAMInstanceProfile_disappears
=== CONT  TestAccAWSIAMInstanceProfile_disappears_role
=== CONT  TestAccAWSIAMInstanceProfile_tags
=== CONT  TestAccAWSIAMInstanceProfile_namePrefix
=== CONT  TestAccAWSIAMInstanceProfile_withoutRole
--- PASS: TestAccAWSIAMInstanceProfile_disappears (22.11s)
--- PASS: TestAccAWSIAMInstanceProfile_withoutRole (22.58s)
--- PASS: TestAccAWSIAMInstanceProfile_disappears_role (22.69s)
--- PASS: TestAccAWSIAMInstanceProfile_basic (25.18s)
--- PASS: TestAccAWSIAMInstanceProfile_namePrefix (26.87s)
--- PASS: TestAccAWSIAMInstanceProfile_tags (41.52s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	41.641s

@ewbankkit
Copy link
Contributor

Running the sweeper:

$ TEST=./aws SWEEP=us-west-2 SWEEPARGS=-sweep-run=aws_iam_instance_profile make sweep
WARNING: This will destroy infrastructure. Use only in development accounts.
go test ./aws -v -sweep=us-west-2 -sweep-run=aws_iam_instance_profile -timeout 60m
2021/03/06 16:39:38 [DEBUG] Running Sweepers for region (us-west-2):
2021/03/06 16:39:38 [DEBUG] Running Sweeper (aws_iam_instance_profile) in region (us-west-2)
2021/03/06 16:39:38 [INFO] AWS Auth provider used: "EnvProvider"
2021/03/06 16:39:38 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2021/03/06 16:39:38 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2021/03/06 16:39:39 [ERROR] error deleting IAM Instance Profile (kit-assumable-role): deleting IAM instance profile kit-assumable-role: DeleteConflict: Cannot delete entity, must remove roles from instance profile first.
	status code: 409, request id: ef65b42d-54c2-4085-8e2f-82ebec2f9d12
2021/03/06 16:39:39 [ERROR] Error running Sweeper (aws_iam_instance_profile) in region (us-west-2): 1 error occurred:
	* error deleting IAM Instance Profile (kit-assumable-role): deleting IAM instance profile kit-assumable-role: DeleteConflict: Cannot delete entity, must remove roles from instance profile first.
	status code: 409, request id: ef65b42d-54c2-4085-8e2f-82ebec2f9d12

FAIL	github.com/terraform-providers/terraform-provider-aws/aws	1.241s
FAIL
GNUmakefile:20: recipe for target 'sweep' failed
make: *** [sweep] Error 1

I think you'll need to add Dependencies: []string{"aws_iam_role"}. to the resource.Sweeper.

@DrFaust92
Copy link
Collaborator Author

Thanks! added sweeper dep.

@bflad bflad self-assigned this Mar 25, 2021
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Looks great, thank you, @DrFaust92 🚀

Output from acceptance testing in AWS Commercial:

--- PASS: TestAccAWSIAMInstanceProfile_withoutRole (24.71s)
--- PASS: TestAccAWSIAMInstanceProfile_disappears_role (25.87s)
--- PASS: TestAccAWSIAMInstanceProfile_disappears (26.09s)
--- PASS: TestAccAWSIAMInstanceProfile_namePrefix (28.30s)
--- PASS: TestAccAWSIAMInstanceProfile_basic (31.35s)
--- PASS: TestAccAWSIAMInstanceProfile_tags (44.67s)

Output from acceptance testing in AWS GovCloud (US):

--- PASS: TestAccAWSIAMInstanceProfile_withoutRole (32.70s)
--- PASS: TestAccAWSIAMInstanceProfile_disappears_role (34.17s)
--- PASS: TestAccAWSIAMInstanceProfile_disappears (34.40s)
--- PASS: TestAccAWSIAMInstanceProfile_basic (39.09s)
--- PASS: TestAccAWSIAMInstanceProfile_namePrefix (41.02s)
--- PASS: TestAccAWSIAMInstanceProfile_tags (69.02s)

@bflad bflad merged commit 82cc1be into hashicorp:main Mar 25, 2021
@github-actions github-actions bot added this to the v3.34.0 milestone Mar 25, 2021
@ghost
Copy link

ghost commented Mar 26, 2021

This has been released in version 3.34.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 Apr 25, 2021

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 as resolved and limited conversation to collaborators Apr 25, 2021
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. enhancement Requests to existing resources that expand the functionality or scope. provider Pertains to the provider itself, rather than any interaction with AWS. service/iam Issues and PRs that pertain to the iam service. size/L 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.

3 participants