ruby Cloudformation の問題に遭遇する 私は非常に単純な cloudformation テンプレートを持っていますが、AWS CLI で検証して create_stack を実行しますが、Ruby SDK で同じコマンドのいずれかを実行すると失敗します。
$ cat net.yml
AWSTemplateFormatVersion: '2010-09-09'
Resources:
Vpc:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 10.0.0.0/16
$ aws cloudformation validate-template --region us-east-1 --template-body file://./net.yml
{
"Parameters": []
}
$ irb
irb(main):001:0> require 'aws-sdk-cloudformation'
=> true
irb(main):002:1* cfn = Aws::CloudFormation::Client.new(
irb(main):003:1* region: 'us-east-1'
irb(main):004:0> )
irb(main):005:2* cfn.validate_template({
irb(main):006:2* template_body: 'file://./net.yml'
irb(main):007:0> })
Traceback (most recent call last):
13: from /usr/bin/irb:23:in `<main>'
12: from /usr/bin/irb:23:in `load'
11: from /usr/lib/ruby/gems/2.7.0/gems/irb-1.2.1/exe/irb:11:in `<top (required)>'
10: from (irb):5
9: from /var/lib/gems/2.7.0/gems/aws-sdk-cloudformation-1.47.0/lib/aws-sdk-cloudformation/client.rb:5361:in `validate_template'
8: from /var/lib/gems/2.7.0/gems/aws-sdk-core-3.112.0/lib/seahorse/client/request.rb:72:in `send_request'
7: from /var/lib/gems/2.7.0/gems/aws-sdk-core-3.112.0/lib/seahorse/client/plugins/response_target.rb:24:in `call'
6: from /var/lib/gems/2.7.0/gems/aws-sdk-core-3.112.0/lib/aws-sdk-core/plugins/response_paging.rb:12:in `call'
5: from /var/lib/gems/2.7.0/gems/aws-sdk-core-3.112.0/lib/seahorse/client/plugins/request_callback.rb:71:in `call'
4: from /var/lib/gems/2.7.0/gems/aws-sdk-core-3.112.0/lib/aws-sdk-core/plugins/param_converter.rb:26:in `call'
3: from /var/lib/gems/2.7.0/gems/aws-sdk-core-3.112.0/lib/aws-sdk-core/plugins/idempotency_token.rb:19:in `call'
2: from /var/lib/gems/2.7.0/gems/aws-sdk-core-3.112.0/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:22:in `call'
1: from /var/lib/gems/2.7.0/gems/aws-sdk-core-3.112.0/lib/seahorse/client/plugins/raise_response_errors.rb:17:in `call'
Aws::CloudFormation::Errors::ValidationError (Template format error: unsupported structure.)
irb(main):008:0>
フィールドで使用するfile://
かどうかは関係ありません。template_body
Ruby を S3 にアップロードすれば、同じテンプレートで動作させることができますが、その必要はありません。以前にこの問題に遭遇した人はいますか?