Unable to call the module output

Hello everyone.

I am relatively new to Terraform. I have recently begun to work with modules. I suspect my issue lays with my lack of fully understanding modules, however, I am eager to learn.

I was able to print the output using the terraform console. But the same data was unable to call using the terraform remote state file.

Error: Unsupported attribute

on …/…/…/modules/services/webserver-cluster/launch_config.tf line 25, in data “template_file” “user_data”:
25: db_address = data.terraform_remote_state.db.outputs.module.webserver_cluster.db_address
|----------------
| data.terraform_remote_state.db.outputs is object with 2 attributes

This object does not have an attribute named “module”.

❯ terraform console

module.webserver_cluster.db_address
tf-mysql-db-rds202100002.ci9ijftuzddn.us-east-1.rds.amazonaws.com

├── modules
│ ├── data
│ │ └── mysql
│ │ ├── mysql.tf
│ │ ├── outputs.tf
│ │ ├── secretsmanager.tf
│ │ └── variables.tf
│ └── services
│ └── webserver-cluster
│ ├── autoscale.tf
│ ├── aws_lb.tf
│ ├── launch_config.tf
│ ├── outputs.tf
│ ├── secruitygroups.tf
│ ├── user-data.sh
│ ├── variables.tf
│ └── vpc.tf
└── stage
└── services
└── webserver-cluster
├── main.tf
├── outputs.tf
├── provider.tf
├── terraform.tfstate
├── terraform.tfstate.backup
└── variables.tf

module “webserver_cluster” {
source = “…/…/…/modules/services/webserver-cluster”
}

This need to spinup a webserver and dbserver, and i am the tfstate to print the db values.

data “template_file” “user_data” {
template = file(“${path.module}/user-data.sh”)
depends_on = [ module.db_rds ]

vars = {
db_address = data.terraform_remote_state.db.outputs.module.webserver_cluster.db_address

db_port = data.terraform_remote_state.db.outputs.module.webserver_cluster.rds_port

db_engine = data.terraform_remote_state.db.outputs.module.webserver_cluster.rds_engine

db_accessible = data.terraform_remote_state.db.outputs.module.webserver_cluster.rds_publicly_accessible

}
}

data “terraform_remote_state” “db” {
backend = “local”

config = {

path = file(“${path.cwd}/terraform.tfstate”)

path = "../../../stage/services/webserver-cluster/terraform.tfstate"

}
depends_on = [ module.db_rds ]
}

Any help appreciated.

Thank you so much for your help!