Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fn::StringAsset doesn't handle expressions #341

Closed
cnunciato opened this issue Sep 21, 2022 · 0 comments · Fixed by #342
Closed

Fn::StringAsset doesn't handle expressions #341

cnunciato opened this issue Sep 21, 2022 · 0 comments · Fixed by #342
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Milestone

Comments

@cnunciato
Copy link
Member

What happened?

In other languages, I can declare a StringAsset using, say, an output from another resource:

const app = new azure_native.web.WebApp("app", {
    // ...
});

const configFile = new azure_native.storage.Blob("config.json", {
    source: app.defaultHostName
        .apply(hostname => new pulumi.asset.StringAsset(JSON.stringify({ 
            apiEndpoint: `https://${hostname}/api` 
        }))),
    contentType: "application/json",
    // ...
});

When I try this with YAML, though:

configFile:
    Fn::StringAsset: '{ "apiEndpoint": https://${app.defaultHostName}/api }'

I get an error:

error: could not load yaml program: failed to load the template: Pulumi.yaml:34,22-75: 
    The argument to Fn::StringAsset must be a string literal; 

Ideally, YAML would support interpolation like this as well.

Steps to reproduce

See above.

Expected Behavior

The StringAsset is created in the usual way.

Actual Behavior

See above.

Output of pulumi about

CLI
Version      3.40.1
Go Version   go1.19.1
Go Compiler  gc

Host
OS       darwin
Version  12.5.1
Arch     x86_64

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@cnunciato cnunciato added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Sep 21, 2022
@aq17 aq17 self-assigned this Sep 22, 2022
@aq17 aq17 removed the needs-triage Needs attention from the triage team label Sep 22, 2022
@aq17 aq17 added this to the 0.78 milestone Sep 22, 2022
@aq17 aq17 closed this as completed in #342 Sep 27, 2022
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants