From 0508ad7cb7290d9a1c5ab9ca1d87c5b1d2b45e66 Mon Sep 17 00:00:00 2001 From: Avrohom Gottlieb Date: Fri, 22 Nov 2024 13:58:55 -0500 Subject: [PATCH 01/15] upgrade aws provider to version 5.x --- infrastructure/provider.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/provider.tf b/infrastructure/provider.tf index f6f56402..d779f23c 100644 --- a/infrastructure/provider.tf +++ b/infrastructure/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { aws = { source = "-/aws" - version = ">= 4.9.0, < 5.0.0" + version = ">= 5.0.0, < 6.0.0" } } required_version = "0.13.0" From 449a9fd0ec2f9506c14facd279c134606a1b3062 Mon Sep 17 00:00:00 2001 From: Avrohom Gottlieb Date: Fri, 22 Nov 2024 14:05:10 -0500 Subject: [PATCH 02/15] change db attribute name to db_name as per deprecation warning --- infrastructure/api.tf | 4 +--- infrastructure/database.tf | 4 +--- infrastructure/provider.tf | 2 +- infrastructure/variables.tf | 4 +--- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/infrastructure/api.tf b/infrastructure/api.tf index a7dddb1c..3399cc92 100644 --- a/infrastructure/api.tf +++ b/infrastructure/api.tf @@ -50,9 +50,7 @@ resource "aws_instance" "api_server_1" { database_host = aws_db_instance.postgres_db.address database_port = aws_db_instance.postgres_db.port database_user = aws_db_instance.postgres_db.username - database_name = aws_db_instance.postgres_db.name - # TODO: enable after upgrade - # database_name = aws_db_instance.postgres_db.db_name + database_name = aws_db_instance.postgres_db.db_name database_password = var.database_password # TODO: enable batch # aws_batch_job_queue_name = module.batch.job_queue_name diff --git a/infrastructure/database.tf b/infrastructure/database.tf index c1415097..8168b162 100644 --- a/infrastructure/database.tf +++ b/infrastructure/database.tf @@ -35,9 +35,7 @@ resource "aws_db_instance" "postgres_db" { engine_version = "12.19" auto_minor_version_upgrade = false instance_class = var.database_instance_type - name = "scpca_portal" - # TODO: replace db_name with name after upgrade - # db_name = "scpca_portal" + db_name = "scpca_portal" port = "5432" username = "scpcapostgresuser" password = var.database_password diff --git a/infrastructure/provider.tf b/infrastructure/provider.tf index d779f23c..94704b04 100644 --- a/infrastructure/provider.tf +++ b/infrastructure/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { aws = { source = "-/aws" - version = ">= 5.0.0, < 6.0.0" + version = "~> 5.0.0" } } required_version = "0.13.0" diff --git a/infrastructure/variables.tf b/infrastructure/variables.tf index d25dfa3f..5b1dc447 100644 --- a/infrastructure/variables.tf +++ b/infrastructure/variables.tf @@ -71,9 +71,7 @@ variable "ssh_public_key" { output "environment_variables" { value = [ {name = "DATABASE_NAME" - value = aws_db_instance.postgres_db.name}, - # TODO: replace db_name with name after upgrade - # value = aws_db_instance.postgres_db.db_name}, + value = aws_db_instance.postgres_db.db_name}, {name = "DATABASE_HOST" value = aws_db_instance.postgres_db.address}, {name = "DATABASE_USER" From da0ae95a315d6047446bf4b110c993f42286cc86 Mon Sep 17 00:00:00 2001 From: Avrohom Gottlieb Date: Fri, 22 Nov 2024 14:09:07 -0500 Subject: [PATCH 03/15] update acl private handling on s3 buckets with new acl resources --- infrastructure/s3.tf | 53 +++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/infrastructure/s3.tf b/infrastructure/s3.tf index c89e8ee1..3168ab38 100644 --- a/infrastructure/s3.tf +++ b/infrastructure/s3.tf @@ -1,7 +1,5 @@ resource "aws_s3_bucket" "scpca_portal_bucket" { bucket = "scpca-portal-${var.user}-${var.stage}" - # TODO: remove this when upgrading aws_provider version - acl = "private" force_destroy = var.stage == "prod" ? false : true tags = merge( @@ -13,21 +11,19 @@ resource "aws_s3_bucket" "scpca_portal_bucket" { ) } -# TODO: enable after upgrade -# resource "aws_s3_bucket_ownership_controls" "scpca_portal_bucket" { -# bucket = aws_s3_bucket.scpca_portal_bucket.id -# rule { -# object_ownership = "BucketOwnerPreferred" -# } -#} +resource "aws_s3_bucket_ownership_controls" "scpca_portal_bucket" { + bucket = aws_s3_bucket.scpca_portal_bucket.id + rule { + object_ownership = "BucketOwnerPreferred" + } +} -# TODO: enable after upgrade -# resource "aws_s3_bucket_acl" "scpca_portal_bucket" { -# depends_on = [aws_s3_bucket_ownership_controls.scpca_portal_bucket] -# -# bucket = aws_s3_bucket.scpca_portal_bucket.id -# acl = "private" -#} +resource "aws_s3_bucket_acl" "scpca_portal_bucket" { + depends_on = [aws_s3_bucket_ownership_controls.scpca_portal_bucket] + + bucket = aws_s3_bucket.scpca_portal_bucket.id + acl = "private" +} resource "aws_s3_bucket_public_access_block" "scpca_portal_bucket" { bucket = aws_s3_bucket.scpca_portal_bucket.id @@ -38,8 +34,6 @@ resource "aws_s3_bucket_public_access_block" "scpca_portal_bucket" { resource "aws_s3_bucket" "scpca_portal_cert_bucket" { bucket = "scpca-portal-cert-${var.user}-${var.stage}" - # TODO: remove this when upgrading aws_provider version - acl = "private" force_destroy = var.stage == "prod" ? false : true # TODO: remove lifecycle rule when we upgrade aws_provider version @@ -63,19 +57,18 @@ resource "aws_s3_bucket" "scpca_portal_cert_bucket" { ) } -# TODO: enable after upgrade -# resource "aws_s3_bucket_ownership_controls" "scpca_portal_cert_bucket" { -# bucket = aws_s3_bucket.scpca_portal_cert_bucket.id -# rule { -# object_ownership = "BucketOwnerPreferred" -# } -#} +resource "aws_s3_bucket_ownership_controls" "scpca_portal_cert_bucket" { + bucket = aws_s3_bucket.scpca_portal_cert_bucket.id + rule { + object_ownership = "BucketOwnerPreferred" + } +} -# resource "aws_s3_bucket_acl" "scpca_portal_cert_bucket" { -# depends_on = [aws_s3_bucket_ownership_controls.scpca_portal_cert_bucket] -# bucket = aws_s3_bucket.scpca_portal_cert_bucket.id -# acl = "private" -#} +resource "aws_s3_bucket_acl" "scpca_portal_cert_bucket" { + depends_on = [aws_s3_bucket_ownership_controls.scpca_portal_cert_bucket] + bucket = aws_s3_bucket.scpca_portal_cert_bucket.id + acl = "private" +} # resource "aws_s3_bucket_lifecycle_configuration" "scpca_portal_cert_bucket" { # bucket = aws_s3_bucket.scpca_portal_cert_bucket.id From 54bb259204460befe3208470f8b9d2d2e7aad48d Mon Sep 17 00:00:00 2001 From: Avrohom Gottlieb Date: Fri, 22 Nov 2024 14:27:41 -0500 Subject: [PATCH 04/15] rollback aws provider version to 4.x, before terraform upgrade --- infrastructure/provider.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/infrastructure/provider.tf b/infrastructure/provider.tf index 94704b04..79374330 100644 --- a/infrastructure/provider.tf +++ b/infrastructure/provider.tf @@ -2,7 +2,8 @@ terraform { required_providers { aws = { source = "-/aws" - version = "~> 5.0.0" + version = ">= 4.9.0, < 5.0.0" +# version = "~> 5.0.0" } } required_version = "0.13.0" From 3ca3c7be7afb54e9c7f625d3d70c7c56b4650c55 Mon Sep 17 00:00:00 2001 From: Avrohom Gottlieb Date: Fri, 22 Nov 2024 14:34:47 -0500 Subject: [PATCH 05/15] upgrade terraform version to from 0.13.x 1.0.x --- .github/workflows/deploy_prod_backend.yml | 2 +- .github/workflows/deploy_staging_backend.yml | 2 +- infrastructure/provider.tf | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy_prod_backend.yml b/.github/workflows/deploy_prod_backend.yml index 7678ed12..dd724802 100644 --- a/.github/workflows/deploy_prod_backend.yml +++ b/.github/workflows/deploy_prod_backend.yml @@ -33,7 +33,7 @@ jobs: - name: Setup Terraform uses: hashicorp/setup-terraform@v3 with: - terraform_version: 0.13.0 + terraform_version: 1.0.0 - name: Deploy run: cd infrastructure && python3 deploy.py -e prod -u deployer -d ccdl -v $(git rev-parse HEAD) diff --git a/.github/workflows/deploy_staging_backend.yml b/.github/workflows/deploy_staging_backend.yml index 0c6b77a9..ab9ad60e 100644 --- a/.github/workflows/deploy_staging_backend.yml +++ b/.github/workflows/deploy_staging_backend.yml @@ -33,7 +33,7 @@ jobs: - name: Setup Terraform uses: hashicorp/setup-terraform@v3 with: - terraform_version: 0.13.0 + terraform_version: 1.0.0 - name: Deploy run: cd infrastructure && python3 deploy.py -e staging -u deployer -d ccdlstaging -v $(git rev-parse HEAD) diff --git a/infrastructure/provider.tf b/infrastructure/provider.tf index 79374330..737e12c8 100644 --- a/infrastructure/provider.tf +++ b/infrastructure/provider.tf @@ -1,12 +1,12 @@ terraform { required_providers { aws = { - source = "-/aws" + source = "hashicorp/aws" version = ">= 4.9.0, < 5.0.0" # version = "~> 5.0.0" } } - required_version = "0.13.0" + required_version = "1.0.0" } provider "aws" { From f68bcf9221f07d277343d0a2a25a6fd614163288 Mon Sep 17 00:00:00 2001 From: Avrohom Gottlieb Date: Fri, 22 Nov 2024 14:37:04 -0500 Subject: [PATCH 06/15] upgrade tf version from 1.0.0 to 1.0.8 --- .github/workflows/deploy_prod_backend.yml | 2 +- .github/workflows/deploy_staging_backend.yml | 2 +- infrastructure/provider.tf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy_prod_backend.yml b/.github/workflows/deploy_prod_backend.yml index dd724802..6f61b629 100644 --- a/.github/workflows/deploy_prod_backend.yml +++ b/.github/workflows/deploy_prod_backend.yml @@ -33,7 +33,7 @@ jobs: - name: Setup Terraform uses: hashicorp/setup-terraform@v3 with: - terraform_version: 1.0.0 + terraform_version: 1.0.8 - name: Deploy run: cd infrastructure && python3 deploy.py -e prod -u deployer -d ccdl -v $(git rev-parse HEAD) diff --git a/.github/workflows/deploy_staging_backend.yml b/.github/workflows/deploy_staging_backend.yml index ab9ad60e..04f62b95 100644 --- a/.github/workflows/deploy_staging_backend.yml +++ b/.github/workflows/deploy_staging_backend.yml @@ -33,7 +33,7 @@ jobs: - name: Setup Terraform uses: hashicorp/setup-terraform@v3 with: - terraform_version: 1.0.0 + terraform_version: 1.0.8 - name: Deploy run: cd infrastructure && python3 deploy.py -e staging -u deployer -d ccdlstaging -v $(git rev-parse HEAD) diff --git a/infrastructure/provider.tf b/infrastructure/provider.tf index 737e12c8..ad2a7754 100644 --- a/infrastructure/provider.tf +++ b/infrastructure/provider.tf @@ -6,7 +6,7 @@ terraform { # version = "~> 5.0.0" } } - required_version = "1.0.0" + required_version = "1.0.8" } provider "aws" { From d0195202fda19d0acd479a14f07e9c6e15340f4b Mon Sep 17 00:00:00 2001 From: Avrohom Gottlieb Date: Fri, 22 Nov 2024 14:46:14 -0500 Subject: [PATCH 07/15] downgrade to tf 0.14 --- .github/workflows/deploy_prod_backend.yml | 2 +- .github/workflows/deploy_staging_backend.yml | 2 +- infrastructure/provider.tf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy_prod_backend.yml b/.github/workflows/deploy_prod_backend.yml index 6f61b629..e2423a56 100644 --- a/.github/workflows/deploy_prod_backend.yml +++ b/.github/workflows/deploy_prod_backend.yml @@ -33,7 +33,7 @@ jobs: - name: Setup Terraform uses: hashicorp/setup-terraform@v3 with: - terraform_version: 1.0.8 + terraform_version: 0.14 - name: Deploy run: cd infrastructure && python3 deploy.py -e prod -u deployer -d ccdl -v $(git rev-parse HEAD) diff --git a/.github/workflows/deploy_staging_backend.yml b/.github/workflows/deploy_staging_backend.yml index 04f62b95..0f13b405 100644 --- a/.github/workflows/deploy_staging_backend.yml +++ b/.github/workflows/deploy_staging_backend.yml @@ -33,7 +33,7 @@ jobs: - name: Setup Terraform uses: hashicorp/setup-terraform@v3 with: - terraform_version: 1.0.8 + terraform_version: 0.14 - name: Deploy run: cd infrastructure && python3 deploy.py -e staging -u deployer -d ccdlstaging -v $(git rev-parse HEAD) diff --git a/infrastructure/provider.tf b/infrastructure/provider.tf index ad2a7754..e4fcc32c 100644 --- a/infrastructure/provider.tf +++ b/infrastructure/provider.tf @@ -6,7 +6,7 @@ terraform { # version = "~> 5.0.0" } } - required_version = "1.0.8" + required_version = "0.14" } provider "aws" { From 7b37c74e39cd2267500918cb38e1f7e15bfbe09d Mon Sep 17 00:00:00 2001 From: Avrohom Gottlieb Date: Fri, 22 Nov 2024 14:51:14 -0500 Subject: [PATCH 08/15] downgrade from tf version 0.14.8 to 0.14.0 --- .github/workflows/deploy_prod_backend.yml | 2 +- .github/workflows/deploy_staging_backend.yml | 2 +- infrastructure/provider.tf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy_prod_backend.yml b/.github/workflows/deploy_prod_backend.yml index e2423a56..d3b92530 100644 --- a/.github/workflows/deploy_prod_backend.yml +++ b/.github/workflows/deploy_prod_backend.yml @@ -33,7 +33,7 @@ jobs: - name: Setup Terraform uses: hashicorp/setup-terraform@v3 with: - terraform_version: 0.14 + terraform_version: 0.14.0 - name: Deploy run: cd infrastructure && python3 deploy.py -e prod -u deployer -d ccdl -v $(git rev-parse HEAD) diff --git a/.github/workflows/deploy_staging_backend.yml b/.github/workflows/deploy_staging_backend.yml index 0f13b405..c16ca970 100644 --- a/.github/workflows/deploy_staging_backend.yml +++ b/.github/workflows/deploy_staging_backend.yml @@ -33,7 +33,7 @@ jobs: - name: Setup Terraform uses: hashicorp/setup-terraform@v3 with: - terraform_version: 0.14 + terraform_version: 0.14.0 - name: Deploy run: cd infrastructure && python3 deploy.py -e staging -u deployer -d ccdlstaging -v $(git rev-parse HEAD) diff --git a/infrastructure/provider.tf b/infrastructure/provider.tf index e4fcc32c..795e6919 100644 --- a/infrastructure/provider.tf +++ b/infrastructure/provider.tf @@ -6,7 +6,7 @@ terraform { # version = "~> 5.0.0" } } - required_version = "0.14" + required_version = "0.14.0" } provider "aws" { From a66f456d164ee0009a0629d61cb29c895117677e Mon Sep 17 00:00:00 2001 From: Avrohom Gottlieb Date: Fri, 22 Nov 2024 14:59:49 -0500 Subject: [PATCH 09/15] downgrade to tf version 13.0.0 --- .github/workflows/deploy_prod_backend.yml | 2 +- .github/workflows/deploy_staging_backend.yml | 2 +- infrastructure/provider.tf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy_prod_backend.yml b/.github/workflows/deploy_prod_backend.yml index d3b92530..7678ed12 100644 --- a/.github/workflows/deploy_prod_backend.yml +++ b/.github/workflows/deploy_prod_backend.yml @@ -33,7 +33,7 @@ jobs: - name: Setup Terraform uses: hashicorp/setup-terraform@v3 with: - terraform_version: 0.14.0 + terraform_version: 0.13.0 - name: Deploy run: cd infrastructure && python3 deploy.py -e prod -u deployer -d ccdl -v $(git rev-parse HEAD) diff --git a/.github/workflows/deploy_staging_backend.yml b/.github/workflows/deploy_staging_backend.yml index c16ca970..0c6b77a9 100644 --- a/.github/workflows/deploy_staging_backend.yml +++ b/.github/workflows/deploy_staging_backend.yml @@ -33,7 +33,7 @@ jobs: - name: Setup Terraform uses: hashicorp/setup-terraform@v3 with: - terraform_version: 0.14.0 + terraform_version: 0.13.0 - name: Deploy run: cd infrastructure && python3 deploy.py -e staging -u deployer -d ccdlstaging -v $(git rev-parse HEAD) diff --git a/infrastructure/provider.tf b/infrastructure/provider.tf index 795e6919..b6d037b9 100644 --- a/infrastructure/provider.tf +++ b/infrastructure/provider.tf @@ -6,7 +6,7 @@ terraform { # version = "~> 5.0.0" } } - required_version = "0.14.0" + required_version = "0.13.0" } provider "aws" { From 46b0868e40f0ad6a158d7d695ef3a681a424869e Mon Sep 17 00:00:00 2001 From: Avrohom Gottlieb Date: Fri, 22 Nov 2024 15:16:22 -0500 Subject: [PATCH 10/15] add replace_provider command and call after init_terraform in deploy script --- infrastructure/deploy.py | 6 ++++++ infrastructure/replace_provider.py | 27 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 infrastructure/replace_provider.py diff --git a/infrastructure/deploy.py b/infrastructure/deploy.py index 69189a7e..c913bdf7 100644 --- a/infrastructure/deploy.py +++ b/infrastructure/deploy.py @@ -8,6 +8,7 @@ import time from init_terraform import init_terraform +from replace_provider import replace_provider PRIVATE_KEY_FILE_PATH = "scpca-portal-key.pem" PUBLIC_KEY_FILE_PATH = "scpca-portal-key.pub" @@ -240,6 +241,11 @@ def restart_api_if_still_running(args, api_ip_address): if init_code != 0: exit(init_code) + replace_provider_code = replace_provider("hashicorp", "aws") + + if replace_provider_code != 0: + exit(replace_provider_code) + terraform_code, terraform_output = run_terraform(args) if terraform_code != 0: exit(terraform_code) diff --git a/infrastructure/replace_provider.py b/infrastructure/replace_provider.py new file mode 100644 index 00000000..e6914167 --- /dev/null +++ b/infrastructure/replace_provider.py @@ -0,0 +1,27 @@ +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", + 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 From cf1172461ee9c6fcba81e1381b0a6b775b3fe568 Mon Sep 17 00:00:00 2001 From: Avrohom Gottlieb Date: Fri, 22 Nov 2024 15:24:18 -0500 Subject: [PATCH 11/15] add auto-approve to replace_provider command --- infrastructure/replace_provider.py | 1 + 1 file changed, 1 insertion(+) diff --git a/infrastructure/replace_provider.py b/infrastructure/replace_provider.py index e6914167..f101e34c 100644 --- a/infrastructure/replace_provider.py +++ b/infrastructure/replace_provider.py @@ -15,6 +15,7 @@ def replace_provider(org, provider): "terraform", "state", "replace-provider", + "-auto-approve", f"registry.terraform.io/-/{provider}", f"registry.terraform.io/{org}/{provider}", ] From 4b8de15c1968c71ba3bf1c0191158a773632f204 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 22 Nov 2024 15:41:32 -0500 Subject: [PATCH 12/15] add unlock_state and use it to unlock failed command --- infrastructure/deploy.py | 6 ++++++ infrastructure/unlock_state.py | 27 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 infrastructure/unlock_state.py diff --git a/infrastructure/deploy.py b/infrastructure/deploy.py index c913bdf7..b3ca1ec0 100644 --- a/infrastructure/deploy.py +++ b/infrastructure/deploy.py @@ -9,6 +9,7 @@ from init_terraform import init_terraform from replace_provider import replace_provider +from unlock_state import unlock_state PRIVATE_KEY_FILE_PATH = "scpca-portal-key.pem" PUBLIC_KEY_FILE_PATH = "scpca-portal-key.pub" @@ -241,6 +242,11 @@ def restart_api_if_still_running(args, api_ip_address): if init_code != 0: exit(init_code) + unlock_code = unlock_state("5eb1ff49-db2d-949a-a4f4-91692b16c525") + + if unlock_code != 0: + exit(unlock_code) + replace_provider_code = replace_provider("hashicorp", "aws") if replace_provider_code != 0: diff --git a/infrastructure/unlock_state.py b/infrastructure/unlock_state.py new file mode 100644 index 00000000..c80efef9 --- /dev/null +++ b/infrastructure/unlock_state.py @@ -0,0 +1,27 @@ +import signal +import subprocess + + +def replace_provider(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 From ff982013074d579cafa2d64d06ed732bd8f59290 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 22 Nov 2024 15:44:27 -0500 Subject: [PATCH 13/15] rename unlock_state --- infrastructure/unlock_state.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/unlock_state.py b/infrastructure/unlock_state.py index c80efef9..bb83852a 100644 --- a/infrastructure/unlock_state.py +++ b/infrastructure/unlock_state.py @@ -2,7 +2,7 @@ import subprocess -def replace_provider(lock_id): +def unlock_state(lock_id): """ Replaces the aws provider. Takes an org name, and a provider, From e1be89f10a41003d6f52127ee1fcbd787da3a3c9 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 22 Nov 2024 15:45:29 -0500 Subject: [PATCH 14/15] linting --- infrastructure/unlock_state.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/infrastructure/unlock_state.py b/infrastructure/unlock_state.py index bb83852a..5338ee89 100644 --- a/infrastructure/unlock_state.py +++ b/infrastructure/unlock_state.py @@ -11,12 +11,7 @@ def unlock_state(lock_id): # Make sure that Terraform is allowed to shut down gracefully. try: - command = [ - "terraform", - "force-unlock", - "-force", - lock_id - ] + command = ["terraform", "force-unlock", "-force", lock_id] terraform_process = subprocess.Popen(command) terraform_process.wait() except KeyboardInterrupt: From 06bf64089c8d131a6f3e70f8dcac18cc41090947 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 22 Nov 2024 15:51:19 -0500 Subject: [PATCH 15/15] remove calling unlock in deploy --- infrastructure/deploy.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/infrastructure/deploy.py b/infrastructure/deploy.py index b3ca1ec0..c913bdf7 100644 --- a/infrastructure/deploy.py +++ b/infrastructure/deploy.py @@ -9,7 +9,6 @@ from init_terraform import init_terraform from replace_provider import replace_provider -from unlock_state import unlock_state PRIVATE_KEY_FILE_PATH = "scpca-portal-key.pem" PUBLIC_KEY_FILE_PATH = "scpca-portal-key.pub" @@ -242,11 +241,6 @@ def restart_api_if_still_running(args, api_ip_address): if init_code != 0: exit(init_code) - unlock_code = unlock_state("5eb1ff49-db2d-949a-a4f4-91692b16c525") - - if unlock_code != 0: - exit(unlock_code) - replace_provider_code = replace_provider("hashicorp", "aws") if replace_provider_code != 0: