is anyone doing multi-region deployments, using a ...
# aws
is anyone doing multi-region deployments, using a function that takes a Provider as input and generates resources using the given provider? How do you give every resource a unique name, and pass it the provider to use, without having to edit each created Resource in the stack by hand (eg to add a name suffix, and pass in
{ provider }
as the third arg)
I wonder if there is a concept of a Pulumi context, where you can say every resource created in this function should use provider=X and add suffix=Y to every name
There isn't such a concept, it is entirely up to you. I built a "init" function that runs several checks when new stack is created and one of them to make sure that default providers are disabled Then when building component resources I pass the base name and use the function to build the name from that. (There is a catch... some resource names can get too long) Also instead of using
passed to Component Resource. The interface is more explicit about what provider/s should be passed in.
🙌 1
That’s a good point - perhaps I can create a bound
function (contains region + name suffix) and use that when creating the stack eg.
Copy code
const builder = new Builder({
  provider: new AWS.Provider('X', { region: 'X' }),
  nameSuffix: 'X',
builder.createResource(aws.lambda.Function, { ... } )
I’ll keep default provider for now just because only ~20% of my stack is under the regional deployment, the rest is deployed into a single (default) region
One of the good examples is ACM certificates ... for Cloudfront you need UE-1 and regional for ALB ... I wish ACM was finally a global service...