-
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
aws_iam_instance_profile
incorrectly requires a role to be specified
#10522
Comments
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.
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! |
Fantastic! Thanks, @aeschright !! |
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! |
Community Note
Terraform Version
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
Terraform should create an instance-profile named "test" with no role attached.
Actual Behavior
Steps to Reproduce
terraform apply
yes
Important Factoids
The
aws_iam_instance_profile
documentation does say that "Either role or roles (deprecated) must be specified." But specifyingrole = ""
gets the same error, and specifyingroles = []
gets a deprecation warning during the planning stage ofterraform apply
, followed by the same error after approving the plan.But it's entirely possible to create and use an instance profile with no role via the IAM and EC2 APIs:
This role-free instance-profile can be attached to an instance and used as metadata--to authenticate to Vault, for example.
Without this capability, I'm forced to create and attach a do-nothing role to my instance-profile instead.
The text was updated successfully, but these errors were encountered: