Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace resources when the AWS region changes #4000

Merged
merged 2 commits into from
May 31, 2024
Merged

Conversation

t0yv0
Copy link
Member

@t0yv0 t0yv0 commented May 29, 2024

Enable pulumi up to do the right thing when AWS region changes in the program. It will now execute a cascading replace plan for all resources associated with a provider to delete resources in the old region and re-provision them in the new desired region.

Fixes #3777 #879

Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Maintainer note: consult the runbook for dealing with any breaking changes.

@t0yv0 t0yv0 changed the title Test changing region Support moving resources when the region changes May 30, 2024
@t0yv0 t0yv0 marked this pull request as ready for review May 30, 2024 14:15
@t0yv0 t0yv0 changed the title Support moving resources when the region changes Replace resources when the AWS region changes May 30, 2024
@t0yv0 t0yv0 force-pushed the t0yv0/cross-region-support branch from 16f06fa to c947a17 Compare May 31, 2024 15:56
@t0yv0 t0yv0 enabled auto-merge (squash) May 31, 2024 15:57
@t0yv0
Copy link
Member Author

t0yv0 commented May 31, 2024

Interesting



❌ TestAccWebserverPy/webserver-py (42.82s)
      program.go:1946: sample: /home/runner/work/pulumi-aws/pulumi-aws/examples/webserver-py
      program.go:1951: pulumi: /usr/local/bin/pulumi
      command.go:46: **** Invoke '/opt/hostedtoolcache/Python/3.11.8/x64/bin/python3 -m venv venv' in '/tmp/p-it-fv-az1215--webserver--47088cae-3617947914'
      command.go:121: Command completed without output
      command.go:46: **** Invoke '/tmp/p-it-fv-az1215--webserver--47088cae-3617947914/venv/bin/python -m pip install -r requirements.txt' in '/tmp/p-it-fv-az1215--webserver--47088cae-3617947914'
      command.go:118: Wrote output to /tmp/p-it-fv-az1215--webserver--47088cae-3617947914/command-output/virtualenv-pip-install.20240531-164835.68fae.log
      command.go:46: **** Invoke '/tmp/p-it-fv-az1215--webserver--47088cae-3617947914/venv/bin/python -m pip install -e /home/runner/work/pulumi-aws/pulumi-aws/sdk/python/bin' in '/tmp/p-it-fv-az1215--webserver--47088cae-3617947914'
      command.go:118: Wrote output to /tmp/p-it-fv-az1215--webserver--47088cae-3617947914/command-output/virtualenv-pip-install-package.20240531-164843.6c330.log
      program.go:2096: projdir: /tmp/p-it-fv-az1215--webserver--47088cae-3617947914
      program.go:1336: Initializing project (dir /tmp/p-it-fv-az1215--webserver--47088cae-3617947914; stack p-it-fv-az1215--webserver--47088cae)
      command.go:46: **** Invoke '/usr/local/bin/pulumi login --cloud-url file:///tmp/TestAccWebserverPywebserver-py3817785819/001' in '/tmp/p-it-fv-az1215--webserver--47088cae-3617947914'
      command.go:118: Wrote output to /tmp/p-it-fv-az1215--webserver--47088cae-3617947914/command-output/pulumi-login.20240531-164844.8063a.log
      command.go:46: **** Invoke '/usr/local/bin/pulumi stack init p-it-fv-az1215--webserver--47088cae' in '/tmp/p-it-fv-az1215--webserver--47088cae-3617947914'
      command.go:118: Wrote output to /tmp/p-it-fv-az1215--webserver--47088cae-3617947914/command-output/pulumi-stack-init.20240531-164844.b2b1d.log
      command.go:46: **** Invoke '/usr/local/bin/pulumi config set-all --plaintext aws:region=us-west-2' in '/tmp/p-it-fv-az1215--webserver--47088cae-3617947914'
      command.go:121: Command completed without output
      program.go:1503: Performing primary preview and update
      command.go:46: **** Invoke '/usr/local/bin/pulumi preview --non-interactive --diff' in '/tmp/p-it-fv-az1215--webserver--47088cae-3617947914'
      command.go:118: Wrote output to /tmp/p-it-fv-az1215--webserver--47088cae-3617947914/command-output/pulumi-preview-initial.20240531-164850.3fc4b.log
      command.go:46: **** Invoke '/usr/local/bin/pulumi up --non-interactive --yes --skip-preview --event-log /tmp/p-it-fv-az1215--webserver--47088cae-events.json' in '/tmp/p-it-fv-az1215--webserver--47088cae-3617947914'
      command.go:98: Invoke '/usr/local/bin/pulumi up --non-interactive --yes --skip-preview --event-log /tmp/p-it-fv-az1215--webserver--47088cae-events.json' failed: exit status 255
  Updating (p-it-fv-az1215--webserver--47088cae):
  
   +  pulumi:pulumi:Stack webserver-py-p-it-fv-az1215--webserver--47088cae creating (0s) 
  @ updating....
   +  pulumi:pulumi:Stack webserver-py-p-it-fv-az1215--webserver--47088cae creating (0s) warning: using pulumi-resource-aws from $PATH at /home/runner/work/pulumi-aws/pulumi-aws/bin/pulumi-resource-aws
  @ updating.....
   +  aws:ec2:DefaultSubnet py-web-default-subnet creating (0s) 
   +  aws:ec2:DefaultVpc py-web-default-vpc creating (0s) 
   +  aws:ec2:DefaultSubnet py-web-default-subnet created (0.63s) 
  @ updating....
   +  aws:ec2:DefaultVpc py-web-default-vpc created (1s) 
   +  aws:ec2:SecurityGroup py-web-secgrp creating (0s) 
  @ updating......
   +  aws:ec2:SecurityGroup py-web-secgrp created (2s) 
   +  aws:ec2:Instance web-server-www creating (0s) 
  @ updating....
   +  aws:ec2:Instance web-server-www creating (0s) error: 1 error occurred:
   +  aws:ec2:Instance web-server-www **creating failed** error: 1 error occurred:
   +  pulumi:pulumi:Stack webserver-py-p-it-fv-az1215--webserver--47088cae creating (7s) error: update failed
   +  pulumi:pulumi:Stack webserver-py-p-it-fv-az1215--webserver--47088cae **creating failed** 1 error; 1 warning
  Diagnostics:
    aws:ec2:Instance (web-server-www):
      error: 1 error occurred:
      	* creating EC2 Instance: IdempotentParameterMismatch: Arguments on this idempotent request are inconsistent with arguments used in previous request(s).
      	status code: 400, request id: 7541f889-859d-4188-bde1-bac4d196fa29
  
    pulumi:pulumi:Stack (webserver-py-p-it-fv-az1215--webserver--47088cae):
      warning: using pulumi-resource-aws from $PATH at /home/runner/work/pulumi-aws/pulumi-aws/bin/pulumi-resource-aws
      error: update failed
  
  Resources:
      + 4 created
  
  Duration: 8s
  
  
      command.go:118: Wrote output to /tmp/p-it-fv-az1215--webserver--47088cae-3617947914/command-output/pulumi-update-initial.20240531-164858.81ee5.log
      program.go:1461: Destroying stack
      command.go:46: **** Invoke '/usr/local/bin/pulumi destroy --non-interactive --yes --skip-preview' in '/tmp/p-it-fv-az1215--webserver--47088cae-3617947914'
      command.go:118: Wrote output to /tmp/p-it-fv-az1215--webserver--47088cae-3617947914/command-output/pulumi-destroy.20240531-164901.7b2a8.log
      command.go:46: **** Invoke '/usr/local/bin/pulumi stack rm --yes' in '/tmp/p-it-fv-az1215--webserver--47088cae-3617947914'
      command.go:118: Wrote output to /tmp/p-it-fv-az1215--webserver--47088cae-3617947914/command-output/pulumi-stack-rm.20240531-164901.9575c.log
      program.go:852: 
          	Error Trace:	/home/runner/go/pkg/mod/github.com/pulumi/pulumi/pkg/v3@v3.116.1/testing/integration/program.go:852
          	            				/home/runner/work/pulumi-aws/pulumi-aws/examples/examples_py_test.go:33
          	Error:      	Received unexpected error:
          	            	running test preview, update, and edits: initial failure: [/usr/local/bin/pulumi up --non-interactive --yes --skip-preview --event-log /tmp/p-it-fv-az1215--webserver--47088cae-events.json] did not succeed after 1 tries
          	Test:       	TestAccWebserverPy/webserver-py

@t0yv0 t0yv0 merged commit bbb6123 into master May 31, 2024
24 checks passed
@t0yv0 t0yv0 deleted the t0yv0/cross-region-support branch May 31, 2024 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warn when changing the region of the default provider
2 participants