1

I am trying to add variables in string

# variables.tf file
terraform {
  backend "s3" {
      bucket    = terraform-20200527"
      workspace_key_prefix  = "customer"
      key   =  "env/${env_name}/terraform.tfstate"
      region = "us-east-1"
      profile   = "default"
  }
}

getting error:

Error: Variables not allowed

   on variables.tf line 7, in terraform:
       7:     key   =  "env/${env_name}/terraform.tfstate"

Variables may not be used here.
user829174
  • 6,132
  • 24
  • 75
  • 125
  • 3
    You can't use variables when configuring backends. https://stackoverflow.com/a/56831460/2291321 might be useful for you. – ydaetskcoR May 27 '20 at 12:45

0 Answers0