Hi, I’m trying to use `new` `aws.cloudformation.St...
# aws
e
Hi, I’m trying to use
new
aws.cloudformation.Stack
, but having a lot of issues when using the
templateBody
and adding data (ids or ips) from other resources created on same pulumi update run. I end up with this error on every output:
Copy code
Calling [toJSON] on an [Output<T>] is not supported. To get the value of an Output as a JSON value or JSON string consider either: 1: o.apply(v => v.toJSON()) 2: o.apply(v => JSON.stringify(v)) See <https://pulumi.io/help/outputs> for more details. This function may throw in a future version of @pulumi/pulumi.
Thanks.
I don’t really know how is expected to make the
templateBody
, and having references to other Pulumi resources. Because it expects an stringify JSON, and with template literals had many errors on deploy of
"template_body" contains an invalid JSON
v
Can you try
pulumi.interpolate
? It takes a template string as input which can have
Output<string>
referenced inside it, and returns a
Output<string>
e
Hi @victorious-fountain-7689 thanks for the response. I’m trying it out, but getting this error, for sure on the JSON it’s rendered but can’t see why, any ideas?
Copy code
"template_body" contains an invalid JSON: invalid character 's' looking for beginning of value
Copy code
templateBody: pulumi.interpolate`{
          "Resources": {
            "SecurityGroupId": {
              "Type": "AWS::SSM::Parameter",
              "Properties": {
                "Name": "security-group-id-${stage}",
                "Type": "String",
                "Value": ${servicesSecurityGroup.id}
              }
            },
(...)
}
how I’m supposed to add the
Value
field as an
Output<string>
. Any particular way Pulumi is expecting?
Made it work! Thanks for the help
v
Ah, nice!
👍 1