sparse-intern-71089
03/18/2020, 12:17 AMcalm-quill-21760
03/18/2020, 12:32 AMfaint-table-42725
03/18/2020, 2:17 AMOutput
types as promises, so the JSON.stringify should happen within some kind of apply. In this case, you probably want something like:
pulumi.all([rdsInstance.username, rdsInstance.engine, ...]).apply(([username, engine, ...]) => JSON.stringify({ ... }))
faint-table-42725
03/18/2020, 2:18 AMOutput<string>
which you can then pass as an argument to secretString
calm-quill-21760
03/18/2020, 2:36 AMfaint-table-42725
03/18/2020, 2:44 AMapply
faint-table-42725
03/18/2020, 2:44 AMOutput
as an argfaint-table-42725
03/18/2020, 2:45 AMnew
doesn’t have to live w/in the apply
calm-quill-21760
03/18/2020, 2:45 AMfaint-table-42725
03/18/2020, 2:46 AMapply
is an Output<T> where T is the return type of the function you passed to apply
calm-quill-21760
03/18/2020, 2:47 AMcalm-quill-21760
03/18/2020, 2:49 AMfaint-table-42725
03/18/2020, 2:49 AMconst bucket = new aws.s3.Bucket("my-bucket", ...);
const cdn = new aws.cloudfront.Distribution("cdn", {
...
loggingConfig: {
bucket: bucket.bucketDomainName
...
}
})
faint-table-42725
03/18/2020, 2:50 AMOutput
, which we’re now passing as an input to create the CDNcalm-quill-21760
03/18/2020, 2:51 AMfaint-table-42725
03/18/2020, 2:52 AMfaint-table-42725
03/18/2020, 2:53 AMInput<string>
and Output<string>
should workfaint-table-42725
03/18/2020, 2:53 AMcalm-quill-21760
03/18/2020, 2:53 AMfaint-table-42725
03/18/2020, 2:54 AMInput<string>
really translates to either a string, a promise that returns a string, or an output that returns a stringfaint-table-42725
03/18/2020, 2:55 AMcalm-quill-21760
03/18/2020, 2:56 AMcalm-quill-21760
03/18/2020, 2:57 AMfaint-table-42725
03/18/2020, 2:58 AMcalm-quill-21760
03/18/2020, 2:59 AMcalm-quill-21760
03/18/2020, 3:00 AMfaint-table-42725
03/18/2020, 3:02 AMcalm-quill-21760
03/18/2020, 3:02 AMfaint-table-42725
03/18/2020, 3:03 AMfaint-table-42725
03/18/2020, 3:03 AMcalm-quill-21760
03/18/2020, 3:03 AMcalm-quill-21760
03/18/2020, 3:04 AMfaint-table-42725
03/18/2020, 3:04 AMcalm-quill-21760
03/18/2020, 3:04 AMcalm-quill-21760
03/18/2020, 3:05 AMfaint-table-42725
03/18/2020, 3:05 AMOutput<T>
calm-quill-21760
03/18/2020, 3:06 AMfaint-table-42725
03/18/2020, 3:08 AMfaint-table-42725
03/18/2020, 3:08 AMpulumi.interpolate
faint-table-42725
03/18/2020, 3:10 AM// concat takes a list of args and concatenates all of them into a single output:
const url1: Output<string> = pulumi.concat("http://", hostname, ":", port, "/");
// interpolate takes a JavaScript "template literal" and expands outputs correctly:
const url2: Output<string> = pulumi.interpolate `http://${hostname}:${port}/`;
faint-table-42725
03/18/2020, 3:17 AMpulumi.output({ … }).apply(JSON.stringify)
and pass that to the argfaint-table-42725
03/18/2020, 3:18 AMJSON.stringify
, but maybe you feel like that’ll look cleanerfaint-table-42725
03/18/2020, 3:19 AMpulumi.output(secretsToStore).apply(JSON.stringify)
faint-table-42725
03/18/2020, 3:19 AMcalm-quill-21760
03/18/2020, 3:28 PMcalm-quill-21760
03/18/2020, 11:31 PMlet secretsToStore = {
"username": rdsInstance.username,
"password": password.result,
"engine": rdsInstance.engine,
"port": rdsInstance.port,
"dbname": rdsInstance.name,
"dbInstanceIdentifier": rdsInstance.identifier,
"host": rdsInstance.address
};
const storedPassword = new aws.secretsmanager.SecretVersion(dbName + "_password", {
secretId: rotation.id,
secretString: pulumi.output(secretsToStore).apply(JSON.stringify)
});