On the main.tf on the module I configure this:
terraform {
backend "s3" {
#Replace this with your bucket name!
bucket = var.webserver_cluster_state_bucket
key =var.webserver_cluster_state_key
region = "us-east-2"
#Replace this with your DynamoDB table name!
dynamodb_table = var.dynamodb_table
encrypt = true
}
}
and I am using here main.tf
module "webserver_cluster" {
source = "../../../modules/services/webserver-cluster"
...
webserver_cluster_state_bucket = "terraform-up-and-runningv2"
webserver_cluster_state_key = "prod/services/webserver-cluster/terraform.tfstate"
dynamodb_table = "terraform-up-and-runningv2"
...
}
Why the remote state is not updated? Do I need to define this inside of code of the second main.tf?