Reputation: 1636
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
Upvotes: 2
Views: 498
Reputation: 238309
You can use If function in the output:
Outputs:
CreateBucket:
Description: "CreateBucket"
Value: !If [CreateBucket, "true", "false"]
Export:
Name: "CreateBucket"
Upvotes: 2
Reputation: 289
It seems that the inability to output conditions is a specification. Condition is not among the elements that can be included in Output Value.
The value of an output can include literals, parameter references, pseudo-parameters, a mapping value, or intrinsic functions.
Upvotes: 0