aws-ia / terraform-aws-vpc

AWS VPC Module
https://registry.terraform.io/modules/aws-ia/vpc/aws/latest
Apache License 2.0
92 stars 98 forks source link

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

Closed yyarmoshyk closed 5 months ago

yyarmoshyk commented 8 months ago

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.

drewmullen commented 8 months ago

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.

pablo19sc commented 5 months ago

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