pulumi internally resolves `Output`s and coroutine...
# python
h
pulumi internally resolves `Output`s and coroutines if it finds them in stuff
c
So throwing it to
print()
won't resolve it?
h
no, pulumi is all parallel/async under the hood
your program exists to define the desired state, which pulumi then runs off and does
but all pulumi stuff accepts Outputs anywhere
(`ComponentResource`s are more complicated)
why do you need the real value?
c
Yeah, I get the pulumi basics and have written components already for customers, but sometimes these "basic" things throw me off... Also, I just did
pulumi.export("organization", org)
on above code snippet and to my surprise only got a string with the org ID it seems, nothing at all what I had expected looking at https://www.terraform.io/docs/providers/aws/r/organizations_organization.html
I must be misinterpreting the Organizations resource for AWS. For whatever reason I can't get to the
roots
property (which should be a list) as it's empty for me, but I don't know why.
well, bit of boto3 and it works now...
Copy code
client = boto3.client('organizations')
roots = client.list_roots()

sandpit = organizations.OrganizationalUnit("sandpit",
  name="sandpit",
  parent_id=roots['Roots'][0]['Id']
)
h
well, instantiating an
pulumi_aws.organization.Organization()
like you were doing was asking pulumi to create and manage an organization as part of your pulumi stack
and since it had no parents, i'm not surprised roots was empty?
and yes, you can
[]
and
.
an
Output
to get a new
Output
that'll do the thing with the value
it's all async/promise/future/delayed computation stuff
c
nah,
roots
still exists, which is how I was able to get it via boto3
Copy code
client = boto3.client('organizations')
roots = client.list_roots()
It's just not propagating to the resource, for whatever reason.
h
it won't, necessarily?
like, under
pulumi preview
, if the resource hasn't been created, data is missing
(i also haven't worked with aws organizations specifically)