Hi there !
I just got started with TF cloud and I just managed to setup my first project that works with multiple AWS environments
Now, here’s my setup looks like:
AWS Environments
We are using 2 AWS accounts to host our dev and prod environments.
AWS Credentials
For each of these environments, there is a user that is dedicated to be used for TF Cloud.
Project repository
We have a growing amount of microservice repositories that are being deployed to the Amazon Cloud. So far, I have been focusing one of these repositories to experiment with TF cloud and I have migrated its state from AWS S3 to TF Cloud.
Workspaces
As my repository has to be deployed to both our dev and prod account in the Amazon Cloud, it is configured to work with two workspaces that reflect the AWS environments:
- my-project-dev (dev)
- my-project-prod (prod)
Both of these workspaces have been configured with CLI-driven workflow.
Environment variables
In order to have each of these workspaces rolling out our infrastruture changes to the corresponding AWS environment, I have accordingly added the appropriate AWS credentials (AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY) as environment variables.
Now, the good news is, everything works as intended I am able to switch workspaces from the command line and to apply the expected changes to the expected AWS environment.
The thing is, when I now look ahead, I realize that we are going to configure the same AWS Credentials again and again for each repository and each AWS environment. This does not scale very well.
Is there a way to define sets of environment variables that can be used across workspaces ?