AWS Codebuild terraform provider

Viewed 2842

Running terraform deploy in codebuild with the following buildspec.yml. Seems terraform isn't picking up the IAM permissions provided by the codebuild role. We're using terraform's remote state (state file is stored in s3), when terraform attempts to contact the S3 bucket containing the state file it dies asking for the terraform provider to be configured:

Downloading modules (if any)...
Get: file:///tmp/src486521661/src/common/byu-aws-accounts-tf
Get: file:///tmp/src486521661/src/common/base-aws-account-
...
Error configuring the backend "s3": No valid credential sources found for AWS Provider.

Here's the buildspec.yml:

version: 0.1
phases:
  install:
    commands:
      - cd common && git clone https://eric.w.nord@gitlab.com/aws-account-tools/acs.git
      - export TerraformVersion=0.9.3 && cd /tmp && curl -o terraform.zip https://releases.hashicorp.com/terraform/${TerraformVersion}/terraform_${TerraformVersion}_linux_amd64.zip && unzip terraform.zip && mv terraform /usr/bin
  build:
    commands:
      - cd accounts/00/dev-stack-oit-byu && terraform init && terraform plan && echo terraform apply
4 Answers
Related