You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级Aurora后Terraform报无this_rds_cluster_master_username属性如何修改output模块

错误根因

你使用的terraform-aws-modules/rds/aws v5.x版本模块做了不兼容的输出字段变更,废弃了原this_rds_cluster_*前缀的集群属性输出,替换为cluster_*前缀的新字段,原有的this_rds_cluster_master_username、this_rds_cluster_master_password属性已不存在。

另外你的db模块配置存在2个笔误,后续部署会触发报错,建议同步修正:

  • engine参数值aurora-postgressql拼写错误,正确为aurora-postgresql
  • engine_mode参数值serveless拼写错误,正确为serverless
解决方案

按照你的需求,通过修改输出文件而非变量的方式解决,操作步骤如下:

  1. 修正根目录output.tf的取值,替换为新版模块的对应输出字段:
output "this_rds_cluster_master_username" {
  value       = module.db.cluster_master_username
  description = "The master username."
}

# 同步新增密码输出,敏感字段需标记sensitive避免日志泄露
output "this_rds_cluster_master_password" {
  value       = module.db.cluster_master_password
  description = "The master password."
  sensitive   = true
}
  1. 调整main.tf中locals块的引用逻辑即可,无需修改变量配置:

注意:Terraform根模块内部无法直接调用根模块自身的output,若你仅需要在本地复用该值,不需要对外暴露输出,也可以直接将locals中的引用替换为新版字段,修改成本更低:

locals {
  rds_cluster_master_creds = {
    "master_username" = module.db.cluster_master_username
    "master_password" = module.db.cluster_master_password
  }
}

内容的提问来源于stack exchange,提问作者Coffee_addict

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.06 11:00:02