Using Pulumi, I created an EFS filesystem.
I want to add the mount to a launch configuration userdata by adding:
mount -t efs -o tls fs-xxx:/ /mnt/efs
.
How can I add the efs.id to the launch configuration userdata?
(I can't convert an output to a string)
You can't convert an Output to a string, but you can write a string once the output has resolved. You do this with an apply
.
You can also use the @pulumi/cloudinit
package to make this easier.
The following example is in typescript, but should apply to all Pulumi SDKs:
import * as cloudinit from "@pulumi/cloudinit";
const efs_fs = new aws.efs.FileSystem("foo", {
});
const userData = efs_fs.id.apply(id => cloudinit.getConfig({
gzip: false,
base64Encode: false,
parts: [{
contentType: "text/cloud-config",
content: JSON.stringify({
packages: [
],
mounts: [\"${id}\", '/mnt/efs'],
bootcmd: [
],
runcmd: [
]
})
},
You can then pass userData.rendered
to any resource you're trying to create