fast-whale-9064
04/18/2019, 5:49 PM.apply
but it doesn’t work like I would expect:
record = route53.Record(dns_name,
name=dns_name,
records=[new_instance.private_ip],
ttl=60,
type="A",
zone_id="..."")
dns_name = record.name.apply(lambda n: n)
yields dns_name
value of <pulumi.output.Output object at 0x110e60160>
. What am I missing?incalculable-sundown-82514
04/18/2019, 5:51 PMapply
transforms an Output into another Output by running a function on the value within that Output. lambda n: n
is the identity function, so what you get is record.name
, which is an output.
You can’t operate directly with outputs, but you can use apply
to transform them and you can pass them directly to other resources: https://pulumi.io/reference/programming-model.html#outputsfast-whale-9064
04/18/2019, 5:58 PMincalculable-sundown-82514
04/18/2019, 5:59 PMrecord.name.apply(lambda n: n)
is a no-op transformation on record.name
, whereas the thing you linked transforms an output by putting https://
on the front of it.Output
, but one that has been transformed according to your functionfast-whale-9064
04/18/2019, 6:03 PMincalculable-sundown-82514
04/18/2019, 6:03 PMfast-whale-9064
04/18/2019, 6:04 PMapply
was to force a dependencyincalculable-sundown-82514
04/18/2019, 6:06 PMfast-whale-9064
04/18/2019, 6:22 PMdepends_on
to work for me, though. Thanks @incalculable-sundown-82514!incalculable-sundown-82514
04/18/2019, 6:23 PM