troposphere icon indicating copy to clipboard operation
troposphere copied to clipboard

support Fn::ToJsonString

Open uldall opened this issue 3 years ago • 1 comments

It seems like the new ToJsonString intrinsic function is not yet available in Troposphere: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ToJsonString.html

An example use-case for the function is to be able to use the return value "OpenWireEndpoints" of AWS:AmazonMQ:Broker as an environment variable for an Elastic Beanstalk environment:

 OptionSetting(
    OptionName="ACTIVE_MQ_ENDPOINTS",
    Namespace="aws:elasticbeanstalk:application:environment",
    Value=ToJsonString(GetAtt(broker, "OpenWireEndpoints"))
),

uldall avatar Dec 07 '22 15:12 uldall

At the time of writing, Fn::ToJsonString requires the AWS::LanguageExtensions transform

Unfortunately this CloudFormation feature appears to suffer from a number of bugs, including erroneous validation of conditions

https://github.com/aws-cloudformation/cfn-language-discussion/issues/147

steers avatar Sep 12 '25 19:09 steers