https://pulumi.com logo
Title
h

high-translator-22614

07/10/2019, 2:58 AM
pulumi internally resolves `Output`s and coroutines if it finds them in stuff
c

colossal-room-15708

07/10/2019, 3:02 AM
So throwing it to
print()
won't resolve it?
h

high-translator-22614

07/10/2019, 3:08 AM
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

colossal-room-15708

07/10/2019, 3:17 AM
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...
client = boto3.client('organizations')
roots = client.list_roots()

sandpit = organizations.OrganizationalUnit("sandpit",
  name="sandpit",
  parent_id=roots['Roots'][0]['Id']
)
h

high-translator-22614

07/10/2019, 2:45 PM
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

colossal-room-15708

07/11/2019, 2:09 AM
nah,
roots
still exists, which is how I was able to get it via boto3
client = boto3.client('organizations')
roots = client.list_roots()
It's just not propagating to the resource, for whatever reason.
h

high-translator-22614

07/11/2019, 2:10 AM
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)