-
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
Don't require a role for aws_iam_instance_profile #10525
Don't require a role for aws_iam_instance_profile #10525
Conversation
fixes #10522 The IAM API does not require a role be attached to instance profiles, and there are use cases (eg Vault EC2 authentication) where a bare instance profile may be all that is required. This PR: * Removes the requirement for `role` or `roles` attributes to exist and to be set to some value before creating an `aws_iam_instance_profile` resource. * Adjusts the acceptance tests to explicitly test and allow an instance profile with no specified role to be created. * Removes the notice that either `role` or `roles` is required from the website documentation for the `aws_iam_instance_profile` resource.
Hi @daveadams! I'm reading through the docs and trying to understand the use case better. It seems like the AWS expectation is that the roles attribute can be initially empty, with the role added and assigned later. Is that also how it appears to you? I'm wondering if allowing this to be empty is going to cause other unexpected behaviors. |
Hey Audrey, yes, the AWS documentation does assume you will add a role to the instance profiles. But I haven't run into any issues with EC2 when it's left out. If there's no role attached, then there are no IAM credentials available from the instance via the EC2 metadata service, but in my case, I'm only interested in having an instance-profile so that I can authenticate to Vault. |
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.
Ok, let's do it!
--- PASS: TestAccAWSIAMInstanceProfile_withoutRole (14.74s)
This has been released in version 2.39.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! |
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! |
The IAM API does not require a role be attached to instance profiles,
and there are use cases (eg Vault EC2 authentication) where a bare
instance profile may be all that is required.
This PR:
Removes the requirement for
role
orroles
attributes to exist andto be set to some value before creating an
aws_iam_instance_profile
resource.
Adjusts the acceptance tests to explicitly test and allow an instance
profile with no specified role to be created.
Removes the notice that either
role
orroles
is required from thewebsite documentation for the
aws_iam_instance_profile
resource.Community Note
Closes #10522
Release note for CHANGELOG:
Output from acceptance testing: