'Sourcing bucket and key values from environment variables in CICD
I am trying to setup a CICD for terraform changes. Our backed is S3 and while init I get following errors, since of course none of these values are provided:
terraform {
backend "s3" {
}
}
.
│ Error: "region": required field is not set
│ Error: "bucket": required field is not set
│ Error: "key": required field is not set
Value for region as specified here can be sourced from AWS_DEFAULT_REGION and AWS_REGION environment variables.
However, no information is available about how bucket and key information can be stored as repository secrets or environment variables and can be sourced from there?
I cant specify them in the backend.tf files due to some other limitations and they have to be stored as environment variables. Any idea how to fix this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
