Getting Terraform Cloud to work with AWS SSO

Hi,

I am new to Terraform Cloud. I am having problems getting Terraform Cloud Runs going with AWS SSO/custom profile. I am using the CLI flow.

I am using AWS SSO and use a special profile '634_PowerUser_And_IAM’ to access AWS resources.

I run non-terraform cli (local) run as:

  • added AWS_PROFILE=634_PowerUser_And_IAM
  • I have run ‘aws configure sso’ to add all the SSO configuration info in the ~/.aws/config file
  • aws sso login
  • terraform init plan apply
    works fine!

Now I want to use the same workflow to run in Terraform Cloud. I have added all the AWS keys, AWS_SESSION, AWS_PROFILE environment vars to my Cloud Workspace variables page.

After running ‘terraform login’, I am getting this error when I run ‘terraform plan’:

│ Error: error configuring Terraform AWS Provider: failed to get shared config profile, 634_PowerUser_And_IAM

Log:

Running plan in Terraform Cloud. Output will stream here. Pressing Ctrl-C

will stop streaming the logs, but will not stop the plan running remotely.

Preparing the remote plan...

The remote workspace is configured to work with configuration at

terraform-manifests relative to the target repository.

Terraform will upload the contents of the following directory,

excluding files or directories as defined by a .terraformignore file

at /Users/user1/learning/terraform-associate-cert/hashicorp-certified-terraform-associate/11-Terraform-Cloud-and-Enterprise-Capabilities/terraform-cloud-demo1/.terraformignore (if it is present),

in order to capture the filesystem context the remote workspace expects:

/Users/user1/learning/terraform-associate-cert/hashicorp-certified-terraform-associate/11-Terraform-Cloud-and-Enterprise-Capabilities/terraform-cloud-demo1

To view this run in a browser, visit:

https://app.terraform.io/app/rrtfcloud-demo12/terraform-cloud-demo1/runs/run-7F6uuhVDamf1VWEK

Waiting for the plan to start...

Terraform v1.2.2

on linux_amd64

Initializing plugins and modules...

╷

│ Error: error configuring Terraform AWS Provider: failed to get shared config profile, 634_PowerUser_And_IAM

│

│ with provider["registry.terraform.io/hashicorp/aws"],

│ on c1-versions.tf line 21, in provider "aws":

│ 21: provider "aws" {

Any suggestions?

Anyone using TF Cloud with AWS SSO?