【发布时间】:2022-11-03 23:30:55
【问题描述】:
我是 Terraform 的新手,所以我确信我只是遗漏了一些简单的东西,但是在尝试部署 CloudFormation 堆栈时,我在应用功能时遇到了错误。
这是我的堆栈资源:
resource "aws_cloudformation_stack" "member_remediation" {
name = "smx-sharr-member-remediation"
capabilities = [CAPABILITY_IAM, CAPABILITY_AUTO_EXPAND]
parameters = {
SecHubAdminAccount = var.parameter_SecHubAdmin
CreateS3BucketForRedshiftAuditLogging = var.parameter_CreateS3
LogGroupName = var.parameter_LogGroupName
LoadAFSBPMemberStack = var.parameter_LoadAFSBPStack
LoadCIS120MemberStack = var.parameter_LoadCISStack
LoadPCI321MemberStack = var.parameter_LoadPCIStack
}
template_body = file("${path.module}/cf-templates/aws-sharr-member.yml")
}
这是尝试在控制台中部署时堆栈提供的内容:
这是 Terraform 在执行计划时向我提供的错误:
Exception Error in plan -
Error: Invalid reference
on .terraform/modules/aws-securityhub-master/module/main.tf line 1120, in resource "aws_cloudformation_stack" "member_remediation":
1120: capabilities = [CAPABILITY_IAM, CAPABILITY_AUTO_EXPAND]
A reference to a resource type must be followed by at least one attribute
access, specifying the resource name.
Error: Invalid reference
on .terraform/modules/aws-securityhub-master/module/main.tf line 1120, in resource "aws_cloudformation_stack" "member_remediation":
1120: capabilities = [CAPABILITY_IAM, CAPABILITY_AUTO_EXPAND]
A reference to a resource type must be followed by at least one attribute
access, specifying the resource name.
我不确定该功能需要什么属性或资源引用,或者如何在资源布局中编写它。我没有找到很多利用功能选项部署 CF 堆栈的示例。
任何帮助是极大的赞赏!
注意:我已经在 Stack Overflow 上查看了以下问题 - 在这种情况下它对我没有帮助:
AWS CloudFormation Stack update error: Requires capabilities : [CAPABILITY_IAM]
【问题讨论】:
标签: amazon-web-services terraform amazon-cloudformation terraform-provider-aws