This message was deleted.
# general
s
This message was deleted.
i
Can your infra machine pull the values instead of having them pushed to it?
m
That'd be ideal, but I'd still need to get the values to something in a way we know happens before the infra machine is launched, and then we're back to the same ordering problem.
(or the infra machine could be launched afterwards, outside of pulumi, but that's going backwards.)
i
show me how you'd create the infra machine with the values if you knew what they were ahead of the time
s
This should be doable, based on my understanding of what you're trying to accomplish. Have you created a dependency between `foo`/`bar` & the
infra
machine, so that Pulumi knows those two need to be created first? If you haven't tried that yet, I'd start there (look into
dependsOn
). Also, try using
pulumi.All
to build the user data instead of f-strings to see if that helps.
m
Thanks @salmon-account-74572 - it certainly seemed like it should work, and with that confirmation I kept plugging way and got there.
Copy code
user_data = pulumi.Output.all(key=val, key2=val2, ...).apply(lambda a: f"blah = {a['key2']} ...")

infra = aws.ec2.Instance(
  ...
  opts=pulumi.ResourceOptions(depends_on=[other_instances])
)
s
Glad you got it working!
l
FYI. the Pulumi cloud-init package makes building user_data much simpler.. once you get the hang of it. https://www.pulumi.com/registry/packages/cloudinit/