-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
[Enhancement]: aws_iam_service_linked_role adopt existing resource #29318
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
Thanks for filing this, @sidekick-eimantas. I was about to do the same. |
I had a similar thought. Is there a workaround that might be usable today? As in to maybe try importing an existing IAM role with the expected name, and then invoke this role conditionally if a resource could be imported? |
NOTE: If someone implements this, the adopted resource should NOT be deleted with a |
You could maybe use an |
As IAM Service Linked roles can be created either by the CreateServiceLinkedRole action via IAM API or AWS itself when a service is invoked. It makes difficult to deploy/maintain modules that include the aws_iam_service_linked_role resource. If another module or AWS creates the role, the resource throws an error if the role exists. I can work on a PR to implement this, but I am not sure if there is support from community to get this changed |
This is especially problematic for service linked roles that are globally only-one-per-account and do not support a At the very least, creating a Data Source for these feels like it'd help significantly. This would at least allow multiple terraform modules managing a single aws account to reference the globally shared role while avoiding ownership issues. It would be the responsibility of the user to create the resource manually, or ensure they have a singular account-wide If you wanted to take the Data Source a step further, it could neat to give them some kind of |
@onefifth @gdavison @timsutton I raise a new PR #39441 for this. If you could please vote for it, it would be great! |
Description
Multiple aws_iam_service_linked_role's are created automatically by AWS when an account is opened. Namely the "organizations.amazonaws.com", "support.amazonaws.com" and "trustedadvisor.amazonaws.com".
As part of an account setup, we try to create those service linked roles, and a few others. Those three however fail as they already exist. Importing them is too inconvenient in fully CI/CD'd setups.
Would be great if the aws_iam_service_linked_role resource could automatically adopt an existing service linked role.
Affected Resource(s) and/or Data Source(s)
Potential Terraform Configuration
No response
References
No response
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: