Slackbot
09/06/2023, 1:38 AMAlexandre Pauwels
09/06/2023, 9:12 AM<http://main.tf|main.tf>
file in our TF modules then all look a bit like the attached snippet.
We create a provider for each role that the module will need to assume to perform its tasks. Each resource can then be assigned a specific provider. When a user executes TF apply, the apply only succeeds if the user has the permissions to assume the required role. Everything falls into place.
In your situation, your bootstrapping process would involve having some sort of either manual or automated task that creates a role with the required permissions in the client's AWS account. These permissions would not only include the permissions to specific resources in the AWS account, but a trust relationship permission that would allow a role or user in your central account to assume that role. Then, in your central account, you allow a role or user to assume the role created in the client account. Now, your TF modules can specify a provider that points to the client's AWS account, and your TF user can be permissioned to assume the role in the client account. Let me know if you have any further questions happy to answer!Anshul Garg
09/07/2023, 1:40 PMAlexandre Pauwels
09/07/2023, 1:42 PM