sparse-intern-71089
05/20/2020, 6:43 AMvictorious-gigabyte-4729
05/20/2020, 7:22 AMOutput<T>.get(): T
/**
* Retrieves the underlying value of this dependency.
*
* This function is only callable in code that runs in the cloud post-deployment. At this
* point all Output values will be known and can be safely retrieved. During pulumi deployment
* or preview execution this must not be called (and will throw). This is because doing so
* would allow Output values to flow into Resources while losing the data that would allow
* the dependency graph to be changed.
*/
agreeable-machine-73141
05/20/2020, 8:57 AMPulumi.dev.yaml
config in the s3 bucket name during creation of pulumi stack. In pulumi/aws v1.x package, we could retrieve it as a string using just aws.getRegion().name
How do I retrieve and use this value in the latest version?busy-magazine-48939
05/20/2020, 9:14 AMimport * as pulumi from '@pulumi/pulumi';
import * as aws from '@pulumi/aws';
import { interpolate } from '@pulumi/pulumi';
const region = pulumi.output(aws.getRegion({}, { async: true})).name;
const prefix = interpolate`${region}-dev-data`
const devDataBucket = new aws.s3.Bucket('devDataBucket', {
bucket: prefix
});
busy-magazine-48939
05/20/2020, 9:16 AM${region}-dev-data
is quite generic and can easily overlap with someone else bucket.agreeable-machine-73141
05/20/2020, 12:00 PMimport * as pulumi from '@pulumi/pulumi';
import * as aws from '@pulumi/aws';
import { interpolate } from '@pulumi/pulumi';
const region = pulumi.output(aws.getRegion({}, { async: true})).name;
const prefix = interpolate`${region}-dev-data`
const devDataBucket = prefix.apply(p => {
return new aws.s3.Bucket(p, {
bucket: p
})
});
The prefix has other qualifiers. I provided a simplified code snippet here.