I have the below github actions workflow:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: 'us-east-1'
role-to-assume: 'assume_role_for_account_A"
role-duration-seconds: 3600
- name: Terraform Init
id: init
run: |
terraform init \
-backend-config="key= account_b.tfstate" \
-backend-config="bucket='test-bucket' \
-backend-config="encrypt=true" \
-backend-config="profile=s3_backend"
- name: Terraform Plan
id: plan
run: terraform plan -no-color -input=false
In the terraform provider config, I am specifying role to assume for AccountB and the region. How can I store terraform backend config in account a and deploy resources in account B? Trying to implement this: One Terraform state S3 bucket for each of your AWS accounts