Open liamawhite opened 1 week ago
Good morning
Please take a look at our TS example of creating Environment resource here
It should be pretty straightforward to turn a String into a StringAsset using new pulumi.asset.StringAsset(stringInput)
Does this solve your issue? I might have misunderstood
StringAsset doesn't take a Input<string>
only a Promise<string>
, hence the boilerplate. If the StringAsset took a. Input<string>
that would also solve the problem.
Oh, sorry I did not see the interpolate
method at first. So the trouble is converting Output<string>
into a StringAsset
I just tested the code below:
let yaml = pulumi.interpolate
`values:
myKey1: "myValue1"
myNestedKey:
myKey2: "myValue2"
myNumber: 1`
var environment = new service.Environment("testing-environment", {
organization: "service-provider-test-org",
name: "testing-environment-ts",
yaml: yaml.apply((y) => new pulumi.asset.StringAsset(y))
})
You can convert Output<string>
, by using the apply
method, which extracts the underlying string, that can then be wrapped into StringAsset
- yaml.apply((y) => new pulumi.asset.StringAsset(y))
. I think you're already doing it very similarly in your code.
I understand it's not as straightforward as yaml: yaml
would have been. I think we went with Asset instead of string here to make loading environment yamls from files easier.
Does that help?
Hello!
Issue details
Rather than have to write a bunch of additional boilerplate to convert to a promise and then an asset it would be good to just pass an input string.
I had to do the following in ts to achieve this:
which would become
Affected area/feature
esc provider