terraform-aws-vpc icon indicating copy to clipboard operation
terraform-aws-vpc copied to clipboard

You must define a backend block (it can be empty!) in your Terraform code

Open yyarmoshyk opened this issue 1 year ago • 1 comments

Hello,

I'm getting the following issue when I call this module from terragrunt:

You must define a backend block (it can be empty!) in your Terraform code or your remote state settings will have no effect! It should look something like this:
terraform {
  backend "s3" {}
}

I went through the files and don't see the backend definition anywhere.

Inside terragrunt code I have the following backend definition:

remote_state {
  backend = "s3"

  config = {
    bucket                 = "statebucket-name-${get_aws_account_id()}"
    key                       = "${path_relative_to_include()}/terraform.tfstate"
    region                  = "${get_env("TF_VAR_TF_BACKEND_REGION", "us-west-1")}"
    encrypt                = true
    dynamodb_table         = "dynamodbtablename-state-lock-${get_aws_account_id()}"
  }
}

I'm using the latest module tag. Please advise whether it is a bug or a feature.

yyarmoshyk avatar Jan 12 '24 08:01 yyarmoshyk

Hello, thanks for opening this issue.

Backend settings are always set in the root module. It would sit alongside this module in your HCL definition, never inside the module code.

Unfortunately, your error has nothing to do with this module.

drewmullen avatar Jan 12 '24 11:01 drewmullen

Closing this issue as it is unrelated to the use of the module itself. Hopefully you were able to fix it! :)

pablo19sc avatar Apr 09 '24 13:04 pablo19sc