I am trying to set up a pipeline, which is supposed to deploy terraform code into an aws account. The code works fine locally, and I have setup and imported the state bucket and dynamodb table which enables state locking.
However, when I run the code in a gitlab ci, I get the following error message:
Error: error configuring S3 Backend: no valid credential sources for S3 Backend found. │ │ Please see https://www.terraform.io/docs/language/settings/backends/s3.html │ for more information about providing credentials. │ │ Error: NoCredentialProviders: no valid providers in chain. Deprecated. │ For verbose messaging see aws.Config.CredentialsChainVerboseErrors
I export the aws credentials as variables in the before_script like so:
before_script: - rm -rf .terraform - terraform --version - export AWS_ACCESS_KEY_ID - export AWS_ROLE_ARN - export AWS_DEFAULT_REGION - export AWS_ROLE_ARN
Is there another step that I am missing, or do I maybe have to include the credential variables in the terraform code?