Issue
Trying to upgrade Aurora version to latest one. Before upgrading terraform plan is working fine. Once I did upgrading I'm getting:
Error: Unsupported attribute
on main.tf line 50, in locals: 50:
"master_username" = module.db.this_rds_cluster_master_username
module.db is a object, known only after apply
This object does not have an attribute named "this_rds_cluster_master_username".
I tried replacing module.db with variables var.this_rds_cluster_master_username and it worked, but I want to make changes in output file not with variables. Any assistance would really appreciated.
output.tf
output "this_rds_cluster_master_username" {
value = module.db.this_rds_cluster_master_username
description = "The master username."
}
main.tf
locals {
rds_cluster_master_creds = {
"master_username" = module.db.this_rds_cluster_master_username
"master_password" = module.db.this_rds_cluster_master_password
}
}
How to modify output module?
#module db
module "db" {
source = "terraform-aws-modules/rds/aws"
version = "5.2.0"
engine = "aurora-postgressql"
engine_mode = "serveless"
engine_version = null
db_subnet_group_name = aws_db_subnet_group.rds_isolated.name
vpc_id = local.vpc_id
deletion_protection = true
}
#locals
locals {
rds_cluster_master_creds = {
"master_username" = module.db.this_rds_cluster_master_username
"master_password" = module.db.this_rds_cluster_master_password
}
}
Solution
Module terraform-aws-modules/rds/aws does not have output called this_rds_cluster_master_username
. Instead it is called db_master_password
. So instead of the following:
module.db.this_rds_cluster_master_username
you should be using
module.db.db_instance_username
Same for this_rds_cluster_master_password
.
Answered By - Marcin
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.