Terraform Cloud Authentication

To authenticate Terraform Cloud with Azure or AWS you can create an SPM or IAM user in the cloud with the relevant permissions and then define the credentials as variables in the Terraform Cloud environment.

Azure

To authenticate from Terraform cloud to Azure you can use a service principal and store the credentials in a Terraform cloud variable set. Following least priviledge methodology it’s good advice to limit the user of this variable set to a given workspace. So if you have matched a workspace to a landing zone such as a subscription you would have multiple service principals configured in multiple variable sets each assigned to the matcing workspace.

Variable set example

Name {cloud}-{tenant}-{subscription}-spn|Some text

Description - some text

Workspaces- assinged to a specific workspace

OBS! make sure you set the key/value set as an environment variable

KeyValueHCLSensitive
ARM_CLIENT_ID<APPID_VALUE>NoYes
ARM_CLIENT_SECRET<PASSWORD_VALUE>NoYes
ARM_SUBSCRIPTION_ID<SUBSCRIPTION_ID>NoYes
ARM_TENANT_ID<TENANT_VALUE>NoYes

AWS

To authenticate from Terraform Cloud to AWS you need an IAM user profile with an access key ID and secret.

Variable set example Create the variable set as environment vairables.

KeyValue
AWS_ACCESS_KEY_IDThe value from the IAM console
AWS_SECRET_ACCESS_KEYThe value from the IAM console
Last modified July 21, 2024: update (e2ae86c)