【发布时间】:2021-03-01 05:54:11
【问题描述】:
我正在遵循 Hashicorp 网站上关于在 Terraform 中包装 CF 模板的指示。整个代码相当多,但 CF 模板有效,所以问题在于“包装”...
Terraform plan 给了我这个错误输出:
terraform plan
Error: aws_cloudformation_stack.Momma: "template_body" contains an invalid JSON: invalid character 'A' looking for beginning of object key string
Error: aws_cloudformation_stack.Momma: : invalid or unknown key: source
因此,“AWSTemplateFormatVersion”行似乎是它不喜欢的。因此,我猜它正在上升的'A'。
这是我关注的 Hashicorp 页面,我想知道是否有任何合适的转义字符,或者是否有人可以看到我的 JSON 的任何直接格式问题?
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack
terraform {}
provider "aws" {
version = "= 2.61"
region = "ap-southeast-2"
}
resource "aws_cloudformation_stack" "Momma" {
source = "../../aws_modules/aws-db-event-subscription"
name = "Momma-Stack"
template_body = <<STACK
{
AWSTemplateFormatVersion: 2010-09-09
Description: Team Server
Metadata:
'AWS::CloudFormation::Interface':
ParameterGroups:
- Label:
default: Deployment Options
Parameters:
- Environment
- KeyPairName
- VPCID
- Subnet1ID
- RemoteAccessCIDR
- Owner
ParameterLabels:
KeyPairName:
Default: Key Pair Name
RemoteAccessCIDR:
Default: External Access CIDR
VPCID:
Default: VPC ID
Owner:
Default: MommaTeam....
感谢您提供的任何指导。
【问题讨论】:
标签: json amazon-web-services terraform amazon-cloudformation