CF cannot preprocess the stack when a module parameter appears in the conditions block and using a !Ref or !GetAtt function
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
調査の方向性
まず、テストスタックを作成する前に、cfn init、validate、submit コマンドに従って module1.yml、module2.yml、および親テンプレートで失敗を再現します。モジュールパラメーターと条件がどのように処理されるかを追跡し、その後、未解決の依存関係エラーなしでスタックが作成されることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Description
When using a CF module, if you use an intrincic function expression to assign the value of module parameter, and the template source of the module uses the parameter name in a condition, CF cannot preprocess the stack and exits with error
CloudFormation failed to preprocess the stack:
Template format error:
Unresolved dependencies [resSampleModule1resSourceQueue]. Cannot reference resources in the Conditions block of the template
Steps to reproduce
1. Create a module called Fujitsu::CF::SampleModule1::MODULE using the template module1.yml as fragment:
module1.yml
===========
AWSTemplateFormatVersion: 2010-09-09
Description: "Template to generate an example module with name Fujitsu::CF::SampleModule1::MODULE"
Parameters:
parMaxReceiveCount:
Description: Number of times a message is received by a consumer of the source queue before being moved to the dead-letter queue
Type: Number
Default: 3
Resources:
resDeadLetterQueue:
Type: AWS::SQS::Queue
resSourceQueue:
Type: AWS::SQS::Queue
Properties:
RedrivePolicy:
deadLetterTargetArn:
Fn::GetAtt:
- "resDeadLetterQueue"
- "Arn"
maxReceiveCount: !Ref parMaxReceiveCount
Commands:
mkdir module1
cd module1
cfn init -t Fujitsu::CF::SampleModule1::MODULE -a MODULE --region eu-west-1
Replace fragmets/sample.json with module1.yml
cfn validate
cfn submit --region eu-west-1 --set-default
2. Create a module called Fujitsu::CF::SampleModule2::MODULE using the template module2.yml as fragment:
module2.yml
===========
AWSTemplateFormatVersion: 2010-09-09
Description: "Template to generate a samplemodule with name Fujitsu::CF::SampleModule2::MODULE"
Parameters:
parBucketName:
Description: S3 bucket name. If not specified, the S3 service assigns a name
Type: String
parVersioningConfiguration:
Description: If versioning is enabled (Enabled) or disabled (Suspended)
Type: String
AllowedValues: ["Enabled","Suspended"]
Conditions:
cndIsBucketNameSpecified: !Not
- !Equals
- ""
- !Ref parBucketName
Resources:
resS3Bucket:
Type: 'AWS::S3::Bucket'
Properties:
BucketName: !If
- cndIsBucketNameSpecified
- !Sub ${parBucketName}-${AWS::Region}-${AWS::AccountId}
- !Ref AWS::NoValue
VersioningConfiguration:
Status: !Ref parVersioningConfiguration
Outputs:
outBucketName:
Description: S3 bucket name
Value: !Ref resS3Bucket
Commands:
mkdir module2
cd module2
cfn init -t Fujitsu::CF::SampleModule2::MODULE -a MODULE --region eu-west-1
Replace fragmets/sample.json with module2.yml
cfn validate
cfn submit --region eu-west-1 --set-default
3. Create a stack (called test in the image), from this template:
AWSTemplateFormatVersion: 2010-09-09
Description: "Sample parent template that uses Fujitsu::CF::SampleModule1::MODULE and Fujitsu::CF::SampleModule2::MODULE"
Parameters:
parMaxReceiveCount:
Description: Number of times a message is received by a consumer of the source queue before being moved to the dead-letter queue
Type: Number
Default: 3
Resources:
resSampleModule1:
Type: Fujitsu::CF::SampleModule1::MODULE
Properties:
parMaxReceiveCount: !Ref parMaxReceiveCount
resSampleModule2:
Type: Fujitsu::CF::SampleModule2::MODULE
Properties:
parBucketName: !GetAtt [resSampleModule1, resSourceQueue.QueueName]
parVersioningConfiguration: "Suspended"
I will refer to this as the 'parent template'.
Expected behavior
The stack is created without errors.
Actual behavior
CF reports an error:
CloudFormation failed to preprocess the stack:
Template format error:
Unresolved dependencies [resSampleModule1resSourceQueue]. Cannot reference resources in the Conditions block of the template
The problem is the parent template uses an intrinsic function expression to assign value to a module parameter (parBucketName: !GetAtt [resSampleModule1, resSourceQueue.QueueName]), and the template fragment of the module uses the name of the assigned parameter (parBucketName) in a condition (cndIsBucketNameSpecified).
I think this is a bug because parBucketName in template fragment must be a name internal to the module.
- 主要言語
- Python
- スター
- 336
- フォーク
- 173
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
aws-cloudformation/cloudformation-cli のほかの issue
-
docs: `--use-docker` and `--no-docker` options of `cfn submit` are missing from the documentationオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
aws-cloudformation/cloudformation-cli#1117 · コメント 1 件 · リアクション 6 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
aws-cloudformation/cloudformation-cli#1115 · コメント 1 件 · リアクション 9 件 ·
aws-cloudformation/cloudformation-cli の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
Netcracker/qubership-ai-packages#266 ·
メンテナーはふだん 1 日以内に返信
-
PROCESSED_DATA_FOLDER: strip whitespace and treat empty as unset対応中かも @TorecLuik が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
NL-BioImaging/BIOMERO.importer#63 ·
メンテナーはふだん 1 日以内に返信
-
MLX training-complete chat/merge suggestions omit --backend mlx対応中かも @vaputa が今日担当しました。 オープンneeds-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
MakazhanAlpamys/Soup#2913 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area:security effort:S priority:P3 status:needs-triage type:chore
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
randomparity/kdive#3657 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
aws/mcp-proxy-for-aws#476 ·
メンテナーはふだん 1 日以内に返信