CFテンプレートをTerraformでラップすることに関して、Hashicorpのサイトの指示に従っています。コード全体にはかなりの量がありますが、CFテンプレートは機能するため、問題は「ラッピング」にあります...
Terraformプランでは、次のエラー出力が表示されます。
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....
ガイダンスを提供していただきありがとうございます。
明らかな問題が少なくとも2つあります。
source = "../../aws_modules/aws-db-event-subscription"
無効です。存在しない無属性と呼ばれるsource
にaws_cloudformation_stackが。あなたはそれを取り除くことができます。
あなたがtemplate_body
すべき始まっていて{
で:
template_body = <<STACK
{
これは、JSONではなくYAMLをテンプレートに使用しているためです。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加