flat-chef-39475
04/06/2021, 11:45 PMlittle-cartoon-10569
04/06/2021, 11:48 PMconst imgUrl = pulumi.interpolate`http://${bucket.bucketEndpoint}/roo.jpg`
const html = htmlTemplate.replace("{object}", imgUrl)
fs.writeFileSync("index.html", html)
imgUrl is an Output<string>
, which you are then using as a string
.flat-chef-39475
04/06/2021, 11:50 PMlittle-cartoon-10569
04/06/2021, 11:51 PMconst indexObject = new aws.s3.BucketObject("index.html", {
bucket,
content: pulumi.all([htmlTemplate, bucket.bucketEndpoint]).apply(([template, endpoint]) => {
// Stuff that builds your HTML
});,
acl: "public-read",
contentType: "text/html"
})
flat-chef-39475
04/06/2021, 11:52 PMred-match-15116
04/06/2021, 11:52 PMpulumi.interpolate
instead of pulumi.all
there.little-cartoon-10569
04/06/2021, 11:53 PMflat-chef-39475
04/06/2021, 11:54 PMbucket.websiteEndpoint
is an Output<string>?little-cartoon-10569
04/06/2021, 11:54 PMall().apply()
boilerplate.red-match-15116
04/06/2021, 11:55 PMflat-chef-39475
04/06/2021, 11:55 PMbucket.websiteEndpoint
an Output<string>... I've read that doc a few times not.little-cartoon-10569
04/06/2021, 11:56 PMred-match-15116
04/06/2021, 11:56 PMbucket.websiteEndpoint
(or any property of bucket) is an Output
flat-chef-39475
04/06/2021, 11:58 PMred-match-15116
04/06/2021, 11:59 PMinterpolate
also returns an Output
. The reason you can pass it in as a property to a resource is because Input
can accept Output<string>
as well as string
flat-chef-39475
04/07/2021, 12:00 AMbucket.websiteEndpoint
part way through the script?red-match-15116
04/07/2021, 12:01 AMbucket.websiteEndpoint.apply(endpoint => console.log(endpoint))
flat-chef-39475
04/07/2021, 12:02 AMred-match-15116
04/07/2021, 12:03 AMflat-chef-39475
04/07/2021, 12:04 AM