Is it possible to know how cloudformation evaluated a condition?
I have this stack:
Parameters:
BucketName:
Default: ''
Type: String
Conditions:
CreateBucket: !Not
- !Equals
- !Ref BucketName
- 'skip'
Resources:
Bucket:
Type: 'AWS::S3::Bucket'
Condition: CreateBucket
I tried to create an Output
:
Outputs:
CreateBucket:
Description: "CreateBucket"
Value: !Ref CreateBucket
Export:
Name: "CreateBucket"
But validation fails with:
aws cloudformation validate-template --template-body file://"bucket.yml"
An error occurred (ValidationError) when calling the ValidateTemplate operation: Unresolved resource dependencies [CreateBucket] in the Outputs block of the template
2
Answers
It seems that the inability to output conditions is a specification. Condition is not among the elements that can be included in Output Value.
Outputs – AWS CloudFormation
You can use If function in the output: