Calling [toJSON] on an [Output<T>] is not su...
# general
s
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.
f
You need to call
JSON.stringify
within the
apply
function.
Copy code
anOutput.apply(unwrappedOutput => {
    JSON.stringify({
        a: unwrappedOutput
    })
});
s
i tried your suggest but i got the same error, i have the following code:
i tried your suggest but i got the same error, i have the following code: ASG_Creation = new aws.autoscaling.Group(parameters.ASG_Name, { name: parameters.ASG_Name, vpcZoneIdentifiers: parameters.Subnets_ids, maxSize: parameters.max_instances, desiredCapacity: parameters.min_instances, . . . } This method return some arguments like name and arn. I used your suggest with the following code: const ASG_Name= ` name ASG ${ASG_Creation.name.apply(name => { JSON.stringify({ a: name }) })}
f
Are you trying to use that in string interpolation ?
s
yes
i tried with pulumi interpolation but i got the same error
f
Right -- you'll need to use
Copy code
pulumi.interpolate``
s
i will try
no, i am get the same error,
i don't know what happens
i used concat and interpolate but i have the same output