busy-island-31180
12/04/2021, 12:52 AMstring
as an input. How do I convert from pulumi.InputString
to a vanilla string
?
for a concrete example, I am creating a role:
https://www.pulumi.com/registry/packages/aws/api-docs/iam/role/#assumerolepolicy_go
this role needs an AssumeRolePolicy
(which is just a string/json document). In order to construct this json document, I need an output value from another resource (an OIDC provider), which would not be known until apply
time
I simply don’t understand how to pass in a vanilla string, when that string needs to be async/dynamically createdbillowy-army-68599
12/04/2021, 12:53 AMbusy-island-31180
12/04/2021, 12:56 AMpulumi.String
typepulumi.String
pulumi.String
type)billowy-army-68599
12/04/2021, 12:59 AMbusy-island-31180
12/04/2021, 1:01 AMtype FooBar struct {
Greeting string
}
hello ${ec2instance.ID}
billowy-army-68599
12/04/2021, 1:03 AMpulumi.StringInput
and it'll accept either a string, or a pulumi.inputApplyT
busy-island-31180
12/04/2021, 1:03 AMbillowy-army-68599
12/04/2021, 1:04 AMApplyT
which is how the value gets resolvedApplyT
basically means "wait for the result to be returned by the API, and then use the value when it is"busy-island-31180
12/04/2021, 1:04 AMFooBar.Greeting
to something else… wouldn’t there be some sort of race condition for it to be populated?billowy-army-68599
12/04/2021, 1:06 AMApplyT
you wouldn't be able to pass it anywhere, it has to happen inside the ApplyT
otherwise the value isn't knownbusy-island-31180
12/04/2021, 1:06 AMbillowy-army-68599
12/04/2021, 1:08 AMbusy-island-31180
12/04/2021, 1:14 AMtype FooBar Struct {
Greeting string
}
pulumi.String
) you essentially wrap your concrete model, in a pulumi “async” modelstring
if you intend on doing any real workhttp.Get
or whatever.. make an API call or somethingbillowy-army-68599
12/04/2021, 1:18 AMApplyT
doesbusy-island-31180
12/04/2021, 1:18 AMpulumi.String("Foo")
are so that you can take a value is known at compile time (or at pulumi up
time) like reading a file from the filesystem, into these “async” inputslocals
undergoes this operationlocals {
foo = aws_ec2_instance.foo.id
my_map_of_things = {
bar = local.foo
}
}
resource null_resource foo {
value = local.my_map_of_things["bar"]
}
channel-like
behavior you mentionedbillowy-army-68599
12/04/2021, 2:04 AM