important-australia-24045
12/29/2022, 11:18 PMCalling [toJSON] on an [Output] 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.
const adHocBaseEnv = new AdHocBaseEnvComponent('myAdHocBaseEnv', {
certificateArn: process.env.CERTIFICATE_ARN,
domainName: process.env.DOMAIN_NAME
});
export const rdsAddress = adHocBaseEnv.databaseInstance.address;
In the Pulumi console I can see that the RDS address is showing up correctly. 👍const org = process.env.PULUMI_ORG;
const environment = process.env.PULUMI_ENVIRONMENT;
const stackReference = new pulumi.StackReference(`${org}/ad-hoc-base/${environment}`)
// ...
const rdsAddress = stackReference.getOutput("rdsAddress") as pulumi.Output<string>;
// ad hoc app env
const adHocAppComponent = new AdHocAppComponent("AdHocAppComponent", {
// ...
rdsAddress,
});
envVars
with values that I want to pass to containers in the ECS task definitions like this:
const envVars: { [key: string]: pulumi.Output<string> | string }[] = [
{
name: "POSTGRES_SERVICE_HOST",
value: pulumi.interpolate `${props.rdsAddress}`,
},
// ...
];
I’m not sure if the type I have selected here for envVars
is correct, but it doesn’t throw any errors in my editor.envVars
value to components that define taskDefinitions, like this:
const apiService = new WebEcsService("ApiWebService", {
name: "gunicorn",
command: ["gunicorn", "-t", "1000", "-b", "0.0.0.0:8000", "--log-level", "info", "backend.wsgi"],
envVars,
// ...
});
ts
const taskDefinition = new aws.ecs.TaskDefinition(`${props.name}TaskDefinition`, {
containerDefinitions: JSON.stringify([
{
name: props.name,
image: props.image,
command: props.command,
environment: props.envVars,
// ...
envVars
in the interface like this:
envVars?: { [key: string]: pulumi.Input<string> | string }[];
This has been tricky to debug, but I imagine that it is a common pattern in apps that use ECS. Does anyone have pointers for how I can resolve this issue? 🙏.apply(x => x.toJSON())
without any luckdry-keyboard-94795
12/29/2022, 11:36 PMimportant-australia-24045
12/29/2022, 11:38 PMjsonStringify
method