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

Terraform aws_cloudformation_stack_set_instance参数覆盖不生效问题

解决Terraform aws_cloudformation_stack_set_instance参数覆盖失效问题

问题根源

AWS CloudFormation Stack Set默认禁止实例级别的参数覆盖,你的aws_cloudformation_stack_set.base资源未显式开启该权限,导致实例定义的parameter_overrides被CloudFormation忽略,最终使用模板中bucketName的默认空字符串。

解决方案

在aws_cloudformation_stack_set.base资源中添加allow_instance_parameter_overrides = true配置,开启实例参数覆盖权限:

resource "aws_cloudformation_stack_set" "base" {
  name        = "fuu-fuu-${var.environment}"

  template_body = file("${path.module}/files/code.yaml")

  parameters = {
    MasterId = var.master_account_id
  }

  administration_role_arn = var.stack_set_administration_role_arn
  execution_role_name     = var.execution_role_name
  # 允许实例覆盖Stack Set参数
  allow_instance_parameter_overrides = true
}

额外验证点

  • 确认Stack Set执行角色拥有足够权限将参数传递到目标账号的实例栈
  • 检查parameter_overrides中的参数名与CloudFormation模板中的参数名完全匹配(你的代码中bucketName名称一致,无需调整)

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.09 04:03:11