pulumi-aws icon indicating copy to clipboard operation
pulumi-aws copied to clipboard

Warn when changing the region of the default provider

Open pierskarsenbarg opened this issue 1 year ago • 3 comments

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

If you are using the default provider, and set the region in the stack config and deploy your resources, they all get created in the region specified.

if you then change the region in the stack config, because you assume that the resources will get re-created in the new region.

This doesn't happen and it can cause your stack to get out of sync because there are some resources that are in one region but the default provider is pointing at the other region.

If the region in default provider is changed from one update to another, we should at least warn that this may have undesired effects, if we don't just block this action from being possible.

Affected area/feature

pierskarsenbarg avatar Apr 04 '24 12:04 pierskarsenbarg

I believe we might not always be able to detect this since the user might specify the region in an env var.

Related issue: https://github.com/pulumi/pulumi-terraform-bridge/issues/244#issuecomment-878683259

Also I think Anton attempted to fix something related: https://github.com/pulumi/pulumi-aws/pull/3497

VenelinMartinov avatar Apr 04 '24 12:04 VenelinMartinov

I'm not suggesting we fix the problem (as in cascade the actual changes) but could we detect either if the region in the default provider changes or even if the region in the default provider doesn't match the region that the resources are deployed to (maybe from the ARN?)

pierskarsenbarg avatar Apr 04 '24 12:04 pierskarsenbarg

@pierskarsenbarg we have a fix coming shortly that will actually re-create the resources in the provider. Would that work? We're actually intending to deploy https://github.com/pulumi/pulumi-aws/pull/3497 but I'd love to hear if you have any objections to this behavior change. I think it is a big change but the current behavior is pretty broken so I think it's something we can reasonably ship. But always good to hear a practitioner's perspective.

t0yv0 avatar Apr 05 '24 13:04 t0yv0