This message was deleted.
# aws
s
This message was deleted.
l
It doesn't have to be an issue. You can either have a stack for the umbrella code (incl. GD), or a separate project, or a condition in your project to have that code run for only one stack.
m
hmm... the GD master account
dependsOn: [myOrg]
so I don't think I can put a conditional around that. Originally, I thought I would have the org creating in one project and then refer to in a separate project for the GD master account... but I wasn't sure how to do
dependsOn
to refer to the org in another stack.
l
You can't. Can you put those two resources in the same project + stack?
Pity that dependsOn is used for this. Would be nicer if an organization ID was used, or similar..
m
Well, that's what I'm trying to figure out how to do 🙂 I think what I need to do is use an explicit provider for the additional region.
l
Do you not already do that?
m
yeah, as shown in my code snippet, not using providers yet. and I haven't had to use them before so this will be the first time.
l
That is a very useful thing to do, in this situation and lots of others. For example, my project that manages backups has a normal AWS provider (region specific) and AWS provider for remote backups (hard coded to us-west-2 for cost reasons). Each stack has its own normal provider, and that 2nd provider gives access to resources that all stacks can see.
👍 1
g
Sounds like a "typical" problem of default providers. Personally, I'd recommend managing all providers yourself. It is a little bit more overhead but way worth it. If you are creating a
ComponentResources
you can use
pulumi.ResourceOptions.merge()
function to merge the
opts
passed in. Then inside the component I
merge
function to override the provider that may have come from
opts
Copy code
self._config = app_config
        # merge parent options and override with child options
        self._opts = pulumi.ResourceOptions.merge(
            opts,
            pulumi.ResourceOptions(
                parent=self,
                provider=self._config.aws_provider,
            ),
        )
This way I make sure to not use the default provider. Also, make sure that each resource inside component uses
opts=self._opts