From 7c5674c4e1847620d0abd1fb6c8bba115b88ff05 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Mon, 29 Jan 2024 13:17:50 -0800 Subject: [PATCH 1/4] notify-admin-1137 make sure one-off files get written to db --- app/main/views/send.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/main/views/send.py b/app/main/views/send.py index 91e9814af4..4332c7ddbe 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -880,14 +880,20 @@ def send_notification(service_id, template_id): service_id, job_id=upload_id, include_one_off=True ) attempts = 0 - while notifications["total"] == 0 and attempts < 5: + + # The response can come back in different forms of incompleteness + while ( + notifications["total"] == 0 + and notifications["notifications"] == [] + and attempts < 50 + ): notifications = notification_api_client.get_notifications_for_service( service_id, job_id=upload_id, include_one_off=True ) time.sleep(0.1) attempts = attempts + 1 - if notifications["total"] == 0 and attempts == 5: + if notifications["total"] == 0 and attempts == 50: # This shows the job we auto-generated for the user return redirect( url_for( From 0f167a91cc4ec5a5015965235c9736e85add270a Mon Sep 17 00:00:00 2001 From: Carlo Costino Date: Tue, 30 Jan 2024 09:26:04 -0500 Subject: [PATCH 2/4] Update Cloud Foundry Terraform module This changeset updates the Cloud Foundry Terraform to its latest release. Our file were previously referencing a very old version, which was contributing to infrastructure check and deployment failures. Signed-off-by: Carlo Costino --- terraform/bootstrap/providers.tf | 2 +- terraform/demo/providers.tf | 2 +- terraform/development/providers.tf | 2 +- terraform/production/providers.tf | 2 +- terraform/sandbox/providers.tf | 2 +- terraform/shared/container_networking/providers.tf | 2 +- terraform/staging/providers.tf | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/terraform/bootstrap/providers.tf b/terraform/bootstrap/providers.tf index 44ccda085e..b6f27acf8e 100644 --- a/terraform/bootstrap/providers.tf +++ b/terraform/bootstrap/providers.tf @@ -3,7 +3,7 @@ terraform { required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" - version = "0.15.5" + version = "0.53.0" } } } diff --git a/terraform/demo/providers.tf b/terraform/demo/providers.tf index eba9e94905..46ec2f376e 100644 --- a/terraform/demo/providers.tf +++ b/terraform/demo/providers.tf @@ -3,7 +3,7 @@ terraform { required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" - version = "0.15.5" + version = "0.53.0" } } diff --git a/terraform/development/providers.tf b/terraform/development/providers.tf index d8ae4488ee..5dcaece3e6 100644 --- a/terraform/development/providers.tf +++ b/terraform/development/providers.tf @@ -3,7 +3,7 @@ terraform { required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" - version = "0.50.7" + version = "0.53.0" } } } diff --git a/terraform/production/providers.tf b/terraform/production/providers.tf index e0daee8b0d..9805aaf87b 100644 --- a/terraform/production/providers.tf +++ b/terraform/production/providers.tf @@ -3,7 +3,7 @@ terraform { required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" - version = "0.15.5" + version = "0.53.0" } } diff --git a/terraform/sandbox/providers.tf b/terraform/sandbox/providers.tf index 5fe15f8749..d24d5a3263 100644 --- a/terraform/sandbox/providers.tf +++ b/terraform/sandbox/providers.tf @@ -3,7 +3,7 @@ terraform { required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" - version = "0.15.5" + version = "0.53.0" } } diff --git a/terraform/shared/container_networking/providers.tf b/terraform/shared/container_networking/providers.tf index 8db86ca90a..21ac567a2d 100644 --- a/terraform/shared/container_networking/providers.tf +++ b/terraform/shared/container_networking/providers.tf @@ -3,7 +3,7 @@ terraform { required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" - version = "~> 0.15" + version = "0.53.0" } } } diff --git a/terraform/staging/providers.tf b/terraform/staging/providers.tf index 7648e192fc..a6f8f2a54c 100644 --- a/terraform/staging/providers.tf +++ b/terraform/staging/providers.tf @@ -3,7 +3,7 @@ terraform { required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" - version = "0.15.5" + version = "0.53.0" } } From 4da5c14751f04fdbec88c807b8defae718377af4 Mon Sep 17 00:00:00 2001 From: Carlo Costino Date: Tue, 30 Jan 2024 09:40:14 -0500 Subject: [PATCH 3/4] Updated 18F/terraform-cloudgov to v0.7.1 Signed-off-by: Carlo Costino --- terraform/demo/main.tf | 4 ++-- terraform/development/main.tf | 2 +- terraform/production/main.tf | 6 +++--- terraform/sandbox/main.tf | 4 ++-- terraform/staging/main.tf | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/terraform/demo/main.tf b/terraform/demo/main.tf index f26e495a55..7f34fb0f10 100644 --- a/terraform/demo/main.tf +++ b/terraform/demo/main.tf @@ -7,7 +7,7 @@ locals { } module "redis" { - source = "github.com/18f/terraform-cloudgov//redis?ref=v0.2.0" + source = "github.com/18f/terraform-cloudgov//redis?ref=v0.7.1" cf_org_name = local.cf_org_name cf_space_name = local.cf_space_name @@ -17,7 +17,7 @@ module "redis" { } module "logo_upload_bucket" { - source = "github.com/18f/terraform-cloudgov//s3?ref=v0.2.0" + source = "github.com/18f/terraform-cloudgov//s3?ref=v0.7.1" cf_org_name = local.cf_org_name cf_space_name = local.cf_space_name diff --git a/terraform/development/main.tf b/terraform/development/main.tf index ff60011520..767256c3f4 100644 --- a/terraform/development/main.tf +++ b/terraform/development/main.tf @@ -11,7 +11,7 @@ data "cloudfoundry_space" "dev" { } module "logo_upload_bucket" { - source = "github.com/18f/terraform-cloudgov//s3?ref=v0.2.0" + source = "github.com/18f/terraform-cloudgov//s3?ref=v0.7.1" cf_org_name = local.cf_org_name cf_space_name = local.cf_space_name diff --git a/terraform/production/main.tf b/terraform/production/main.tf index c635ed2d45..450212cdf8 100644 --- a/terraform/production/main.tf +++ b/terraform/production/main.tf @@ -7,7 +7,7 @@ locals { } module "redis" { - source = "github.com/18f/terraform-cloudgov//redis?ref=v0.2.0" + source = "github.com/18f/terraform-cloudgov//redis?ref=v0.7.1" cf_org_name = local.cf_org_name cf_space_name = local.cf_space_name @@ -17,7 +17,7 @@ module "redis" { } module "logo_upload_bucket" { - source = "github.com/18f/terraform-cloudgov//s3?ref=v0.2.0" + source = "github.com/18f/terraform-cloudgov//s3?ref=v0.7.1" cf_org_name = local.cf_org_name cf_space_name = local.cf_space_name @@ -50,7 +50,7 @@ module "api_network_route" { # https://cloud.gov/docs/services/external-domain-service/#how-to-create-an-instance-of-this-service ########################################################################### module "domain" { - source = "github.com/18f/terraform-cloudgov//domain?ref=v0.5.2" + source = "github.com/18f/terraform-cloudgov//domain?ref=v0.7.1" cf_org_name = local.cf_org_name cf_space_name = local.cf_space_name diff --git a/terraform/sandbox/main.tf b/terraform/sandbox/main.tf index 69457b5d50..74c16d808b 100644 --- a/terraform/sandbox/main.tf +++ b/terraform/sandbox/main.tf @@ -7,7 +7,7 @@ locals { } module "redis" { - source = "github.com/18f/terraform-cloudgov//redis?ref=v0.2.0" + source = "github.com/18f/terraform-cloudgov//redis?ref=v0.7.1" cf_org_name = local.cf_org_name cf_space_name = local.cf_space_name @@ -17,7 +17,7 @@ module "redis" { } module "logo_upload_bucket" { - source = "github.com/18f/terraform-cloudgov//s3?ref=v0.2.0" + source = "github.com/18f/terraform-cloudgov//s3?ref=v0.7.1" cf_org_name = local.cf_org_name cf_space_name = local.cf_space_name diff --git a/terraform/staging/main.tf b/terraform/staging/main.tf index 4a07e9bd76..d0df6e81da 100644 --- a/terraform/staging/main.tf +++ b/terraform/staging/main.tf @@ -7,7 +7,7 @@ locals { } module "redis" { - source = "github.com/18f/terraform-cloudgov//redis?ref=v0.2.0" + source = "github.com/18f/terraform-cloudgov//redis?ref=v0.7.1" cf_org_name = local.cf_org_name cf_space_name = local.cf_space_name @@ -17,7 +17,7 @@ module "redis" { } module "logo_upload_bucket" { - source = "github.com/18f/terraform-cloudgov//s3?ref=v0.2.0" + source = "github.com/18f/terraform-cloudgov//s3?ref=v0.7.1" cf_org_name = local.cf_org_name cf_space_name = local.cf_space_name From 50e3560c6ff6c4835fd1a8dae218f5f1286d4fa6 Mon Sep 17 00:00:00 2001 From: Carlo Costino Date: Tue, 30 Jan 2024 11:06:13 -0500 Subject: [PATCH 4/4] Remove the profile attribute entirely This was what was apparently breaking our Terraform actions. I traced this to an undocumented breaking change with the AWS provider; more details can be seen here: https://discuss.hashicorp.com/t/error-error-configuring-terraform-aws-provider-failed-to-get-shared-config-profile-default/39417/2 Signed-off-by: Carlo Costino --- terraform/README.md | 2 ++ terraform/demo/providers.tf | 1 - terraform/development/reset.sh | 2 +- terraform/production/providers.tf | 1 - terraform/sandbox/providers.tf | 1 - terraform/staging/providers.tf | 1 - 6 files changed, 3 insertions(+), 5 deletions(-) diff --git a/terraform/README.md b/terraform/README.md index efab933fa3..7390e39473 100644 --- a/terraform/README.md +++ b/terraform/README.md @@ -88,6 +88,8 @@ The below steps rely on you first configuring access to the Terraform state in s terraform plan ``` + If the `terraform init` command fails, you may need to run `terraform init -upgrade` to make sure new module versions are picked up. + 1. Apply changes with `terraform apply`. 1. Remove the space deployer service instance if it doesn't need to be used again, such as when manually running terraform once. diff --git a/terraform/demo/providers.tf b/terraform/demo/providers.tf index 46ec2f376e..2ced7915f8 100644 --- a/terraform/demo/providers.tf +++ b/terraform/demo/providers.tf @@ -12,7 +12,6 @@ terraform { key = "admin.tfstate.demo" encrypt = "true" region = "us-gov-west-1" - profile = "notify-terraform-backend" } } diff --git a/terraform/development/reset.sh b/terraform/development/reset.sh index d51d43eec4..57c2f4d870 100755 --- a/terraform/development/reset.sh +++ b/terraform/development/reset.sh @@ -47,7 +47,7 @@ if [[ ! -s "secrets.auto.tfvars" ]]; then fi echo "Importing terraform state for $username" -terraform init +terraform init -upgrade key_name=$username-admin-dev-key diff --git a/terraform/production/providers.tf b/terraform/production/providers.tf index 9805aaf87b..ed822db442 100644 --- a/terraform/production/providers.tf +++ b/terraform/production/providers.tf @@ -12,7 +12,6 @@ terraform { key = "admin.tfstate.prod" encrypt = "true" region = "us-gov-west-1" - profile = "notify-terraform-backend" } } diff --git a/terraform/sandbox/providers.tf b/terraform/sandbox/providers.tf index d24d5a3263..09911edc43 100644 --- a/terraform/sandbox/providers.tf +++ b/terraform/sandbox/providers.tf @@ -12,7 +12,6 @@ terraform { key = "admin.tfstate.sandbox" encrypt = "true" region = "us-gov-west-1" - profile = "notify-terraform-backend" } } diff --git a/terraform/staging/providers.tf b/terraform/staging/providers.tf index a6f8f2a54c..d6928e61ee 100644 --- a/terraform/staging/providers.tf +++ b/terraform/staging/providers.tf @@ -12,7 +12,6 @@ terraform { key = "admin.tfstate.stage" encrypt = "true" region = "us-gov-west-1" - profile = "notify-terraform-backend" } }