hi folks, I have a couple of questions. 1. I have ...
# general
c
hi folks, I have a couple of questions. 1. I have a component resource which does:
Copy code
class VPC(ComponentResource):
    def __init__(self, ...): 
        ...
        self.register_outputs({
            "id": self.vpc.id,
            "custom_id": "123456",
        })
why can't I access component resource outputs within pulumi export?
Copy code
vpc = VPC(...)
pulumi.export("vpc_id", vpc.id)  # this doesn't work
2. could you point me in the doc where it is described the purpose of Pulumi.stack.yaml file, and what can I do with it? in particular I am interested in how not to use it and provide region and role programmatically https://www.pulumi.com/docs/iac/concepts/config/
a
In your case does vpc.vpc.id work. register_outputs() only really tells the engine that the component resource is done provisioning.
c
vpc.vpc.id does work, but that's not what I want. as it feels like a leaking abstraction for component consumers.
a
You can assign
self.id = self.vpc.id
and it would work the way you want it there.
c
ok, I will do that, thanks. how do pulumi defined resources handle this? as there isn't any problem to access outputs from those
a
Nope it should be fine. Just make sure you do
opts*=*pulumi*.*ResourceOptions(parent*=*self))
on all of them so dependencies flow thru