-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #994 from AlexsLemonade/dev
Production Deploy
- Loading branch information
Showing
8 changed files
with
84 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import signal | ||
import subprocess | ||
|
||
|
||
def replace_provider(org, provider): | ||
""" | ||
Replaces the aws provider. | ||
Takes an org name, and a provider, | ||
and changes the terraform state to use the new qualified provider. | ||
""" | ||
|
||
# Make sure that Terraform is allowed to shut down gracefully. | ||
try: | ||
command = [ | ||
"terraform", | ||
"state", | ||
"replace-provider", | ||
"-auto-approve", | ||
f"registry.terraform.io/-/{provider}", | ||
f"registry.terraform.io/{org}/{provider}", | ||
] | ||
terraform_process = subprocess.Popen(command) | ||
terraform_process.wait() | ||
except KeyboardInterrupt: | ||
terraform_process.send_signal(signal.SIGINT) | ||
terraform_process.wait() | ||
|
||
return terraform_process.returncode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import signal | ||
import subprocess | ||
|
||
|
||
def unlock_state(lock_id): | ||
""" | ||
Replaces the aws provider. | ||
Takes an org name, and a provider, | ||
and changes the terraform state to use the new qualified provider. | ||
""" | ||
|
||
# Make sure that Terraform is allowed to shut down gracefully. | ||
try: | ||
command = ["terraform", "force-unlock", "-force", lock_id] | ||
terraform_process = subprocess.Popen(command) | ||
terraform_process.wait() | ||
except KeyboardInterrupt: | ||
terraform_process.send_signal(signal.SIGINT) | ||
terraform_process.wait() | ||
|
||
# ignore error | ||
return 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters