https://pulumi.com logo
Title
b

brief-pillow-16455

03/31/2023, 3:28 PM
Hello everyone i am facing a problem to use Output<string>
let configmapcontents = fs.readFileSync(
        path.join(__dirname, 'nginx.conf'),
        { encoding: 'utf-8',},
        );
configmapcontents = args.serverName.apply(sn => configmapcontents.toString().replace(/server_name/g,`${sn}`))
Here args.serverName is of type Output<string> but replace function of typescript expects a string

How to work around this?
b

billowy-army-68599

03/31/2023, 3:35 PM
build the configmapcontents inside the apply:
args.ServerName.apply(sn => 
fs.readFileSync...