sparse-intern-71089
06/07/2023, 12:43 PMbillowy-army-68599
billowy-army-68599
apply
in the wrong place in your code. To break this down a bit, an Input/Output is a value that isn’t know until after you get the result back from the cloud provider API. Similar to a python List or Dictionary, you have to unpack it before you can use it. In the same way you can’t access a list element without a loop, you can’t use an Input until you’ve resolved the value
If you semantically think of apply
as resolve_api_call
it starts to make a bit more sensebillowy-army-68599
t = Template(open(f"{getcwd()}/modules/aws_asg/user_data.tpl.sh").read())
templated_user_data = t.substitute({
'gitlab_runner_token' : gitlab_runner_token.apply(lambda v: f"{v}"),
})
In this situation, you’re opening the .tpl
template, then you’re trying to resolve the gitlab token value, which is the wrong way round. What you need to do, is reolsve the gitlab token value, then open the template. It ends up looking a bit like this:
gitlab_runner_token.apply(lambda v: Template(open(f"{getcwd()}/modules/aws_asg/user_data.tpl.sh").read()).substitute.....
billowy-army-68599
billowy-army-68599
plain-mechanic-14459
06/07/2023, 1:09 PMplain-mechanic-14459
06/07/2023, 1:29 PMplain-mechanic-14459
06/07/2023, 1:33 PMall()
function?billowy-army-68599
pulumi.Output.all
billowy-army-68599
plain-mechanic-14459
06/08/2023, 7:41 AMplain-mechanic-14459
06/08/2023, 7:53 AM404 Not Found
billowy-army-68599
plain-mechanic-14459
06/09/2023, 7:05 AMplain-mechanic-14459
06/09/2023, 7:09 AM# NOTE: This example is not correct
? Maybe a big red bar in CSS 😄