Open RhubarbSin opened 4 months ago
I'm getting this as well, I'm trying to refactor some code to use the awesome new ForEach
intrinsic function, however enabling the AWS::LanguageExtensions
transform seems to break previously working code with no other changes.
It looks like the transform runs some sort of pre-processor that ignores Condition:
statements, so it evaluates resources that previously were ignored by the Condition evaluating to False
.
And any Select
functions in those statements are now being evaluated, when they shouldn't be.
I'd like to comment that after spending a full day with trying to debug our first use of the Transform LanguageExtension, it also broke our existing stack. I was originally thinking it was the foreach we added but it looks like something else being triggered by just having the reference to the extension.
Same behavior. I've reduced my template down to a minimum. I can create several object including AWS::IAM::Role, AWS::Logs::LogGroup, and AWS::ApiGateway::Method WITH the extension enabled. As soon as I add the simplest AWS::StepFunctions::StateMachine I receive the error
Fragment returned by transform AWS::LanguageExtensions is null
I can not create a valid template with AWS::LanguageExtensions and AWS::StepFunctions::StateMachine
Simple yaml fragment to reproduce
AWSTemplateFormatVersion: "2010-09-09" Transform: 'AWS::LanguageExtensions'
Resources:
mystepfunction: Type: 'AWS::StepFunctions::StateMachine' Properties: RoleArn: !GetAtt createJiraConnectionStepFunctionRole.Arn StateMachineName: mystepfunction StateMachineType: 'EXPRESS' DefinitionString: |- { "Comment": "A description of my state machine", "StartAt": "Pass", "States": { "Pass": { "Type": "Pass", "End": true } } }
Community Note
Tell us about the bug
When trying to create a resource only when the value of a string parameter is not an empty string (using a condition that evaluates to False), CloudFormation appears to try to evaluate the use of
Fn::Select
in the specification of one of the properties of the declared resource, which would not be created because of the use of the condition in the resource declaration.Expected behavior
The resource that is declared with the condition associated with it is not created.
Observed behavior
The attempt to create a CloudFormation change set reports status FAILED with the following status reason:
Test cases
Additional context
Creation of the change set succeeds if the declaration of the
AWS::LanguageExtensions
transform is removed from the template.The behavior seems to be very similar to that reported in issue #120.
A work-around can be implemented by re-using the condition with
Fn::If
and substituting unused place-holder values for the property of the resource that is not created as desired because of the use of the condition associated with the resource declaration.