From e9cdf47b3c05c6976e7dec4e5dc0cb5fc7a111a7 Mon Sep 17 00:00:00 2001 From: William Shelley Date: Wed, 27 Nov 2024 10:24:24 +0000 Subject: [PATCH 01/15] fix: updated cdn module --- infra/terraform/modules/service/cdn.tf | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/infra/terraform/modules/service/cdn.tf b/infra/terraform/modules/service/cdn.tf index 9303426aa6..b2a1efad0f 100644 --- a/infra/terraform/modules/service/cdn.tf +++ b/infra/terraform/modules/service/cdn.tf @@ -13,20 +13,18 @@ provider "aws" { skip_requesting_account_id = false } -data "aws_route53_zone" "public" { - name = var.domain_name -} +data "aws_caller_identity" "current" {} -data "aws_caller_identity" "current_account_id" {} - -locals { - asset_bucket = "${data.aws_caller_identity.current_account_id.account_id}-vol-app-assets" -} data "aws_s3_bucket" "assets" { - bucket = local.asset_bucket + bucket = "vol-app-assets" +} + +data "aws_route53_zone" "public" { + name = var.domain_name } locals { + bucket = "${data.aws_caller_identity.current.account_id}-vol-app-assets" domain_name = data.aws_route53_zone.public.name subdomain = "${var.environment}-cdn" } @@ -102,7 +100,7 @@ module "cloudfront" { origin = { (local.oac_id) = { - domain_name = data.aws_s3_bucket.assets.bucket_regional_domain_name + domain_name = local.bucket.bucket_regional_domain_name origin_access_control = local.oac_id origin_path = "/${trimprefix(var.assets_version, "/")}" } From 75cdeb74f5ebc4f825c1597a00d5988c7226feae Mon Sep 17 00:00:00 2001 From: William Shelley Date: Wed, 27 Nov 2024 10:48:01 +0000 Subject: [PATCH 02/15] fix: remove original bucket ref --- infra/terraform/modules/service/README.md | 1 - infra/terraform/modules/service/cdn.tf | 4 ---- 2 files changed, 5 deletions(-) diff --git a/infra/terraform/modules/service/README.md b/infra/terraform/modules/service/README.md index f309333470..c6045efe25 100644 --- a/infra/terraform/modules/service/README.md +++ b/infra/terraform/modules/service/README.md @@ -41,7 +41,6 @@ | [aws_canonical_user_id.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/canonical_user_id) | data source | | [aws_cloudfront_log_delivery_canonical_user_id.cloudfront](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/cloudfront_log_delivery_canonical_user_id) | data source | | [aws_route53_zone.public](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source | -| [aws_s3_bucket.assets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/s3_bucket) | data source | ## Inputs diff --git a/infra/terraform/modules/service/cdn.tf b/infra/terraform/modules/service/cdn.tf index b2a1efad0f..c1e793c6bf 100644 --- a/infra/terraform/modules/service/cdn.tf +++ b/infra/terraform/modules/service/cdn.tf @@ -15,10 +15,6 @@ provider "aws" { data "aws_caller_identity" "current" {} -data "aws_s3_bucket" "assets" { - bucket = "vol-app-assets" -} - data "aws_route53_zone" "public" { name = var.domain_name } From 11f049d5d72b7132b17bc800b874fcdcdb7baa15 Mon Sep 17 00:00:00 2001 From: William Shelley Date: Wed, 27 Nov 2024 15:13:42 +0000 Subject: [PATCH 03/15] fix: duplicate ref --- infra/terraform/modules/service/README.md | 2 +- infra/terraform/modules/service/cdn.tf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/infra/terraform/modules/service/README.md b/infra/terraform/modules/service/README.md index c6045efe25..3d326dbd44 100644 --- a/infra/terraform/modules/service/README.md +++ b/infra/terraform/modules/service/README.md @@ -37,7 +37,7 @@ | [aws_lb_listener_rule.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener_rule) | resource | | [aws_lb_target_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group) | resource | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | -| [aws_caller_identity.current_account_id](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | +| [aws_caller_identity.current_account](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | | [aws_canonical_user_id.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/canonical_user_id) | data source | | [aws_cloudfront_log_delivery_canonical_user_id.cloudfront](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/cloudfront_log_delivery_canonical_user_id) | data source | | [aws_route53_zone.public](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source | diff --git a/infra/terraform/modules/service/cdn.tf b/infra/terraform/modules/service/cdn.tf index c1e793c6bf..82345cdf15 100644 --- a/infra/terraform/modules/service/cdn.tf +++ b/infra/terraform/modules/service/cdn.tf @@ -13,14 +13,14 @@ provider "aws" { skip_requesting_account_id = false } -data "aws_caller_identity" "current" {} +data "aws_caller_identity" "current_account" {} data "aws_route53_zone" "public" { name = var.domain_name } locals { - bucket = "${data.aws_caller_identity.current.account_id}-vol-app-assets" + bucket = "${data.aws_caller_identity.current_account.account_id}-vol-app-assets" domain_name = data.aws_route53_zone.public.name subdomain = "${var.environment}-cdn" } From 2ed246d05a9b0eae52be67dfa8190bfda74c0a4b Mon Sep 17 00:00:00 2001 From: William Shelley Date: Wed, 27 Nov 2024 15:50:16 +0000 Subject: [PATCH 04/15] fix: asset bucket attribute --- infra/terraform/environments/dev/main.tf | 1 + infra/terraform/modules/service/README.md | 1 + infra/terraform/modules/service/cdn.tf | 7 +++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/infra/terraform/environments/dev/main.tf b/infra/terraform/environments/dev/main.tf index 16b062e8ef..0728693a94 100644 --- a/infra/terraform/environments/dev/main.tf +++ b/infra/terraform/environments/dev/main.tf @@ -139,6 +139,7 @@ module "service" { source = "../../modules/service" environment = "dev" + account = "054614622558" legacy_environment = "DEV" diff --git a/infra/terraform/modules/service/README.md b/infra/terraform/modules/service/README.md index 3d326dbd44..2b8fdf495c 100644 --- a/infra/terraform/modules/service/README.md +++ b/infra/terraform/modules/service/README.md @@ -41,6 +41,7 @@ | [aws_canonical_user_id.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/canonical_user_id) | data source | | [aws_cloudfront_log_delivery_canonical_user_id.cloudfront](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/cloudfront_log_delivery_canonical_user_id) | data source | | [aws_route53_zone.public](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source | +| [aws_s3_bucket.assets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/s3_bucket) | data source | ## Inputs diff --git a/infra/terraform/modules/service/cdn.tf b/infra/terraform/modules/service/cdn.tf index 82345cdf15..f890875b2f 100644 --- a/infra/terraform/modules/service/cdn.tf +++ b/infra/terraform/modules/service/cdn.tf @@ -19,8 +19,11 @@ data "aws_route53_zone" "public" { name = var.domain_name } +data "aws_s3_bucket" "assets" { + bucket = "${var.account}-vol-app-assets" +} + locals { - bucket = "${data.aws_caller_identity.current_account.account_id}-vol-app-assets" domain_name = data.aws_route53_zone.public.name subdomain = "${var.environment}-cdn" } @@ -96,7 +99,7 @@ module "cloudfront" { origin = { (local.oac_id) = { - domain_name = local.bucket.bucket_regional_domain_name + domain_name = data.aws_s3_bucket.assets.bucket_regional_domain_name origin_access_control = local.oac_id origin_path = "/${trimprefix(var.assets_version, "/")}" } From e61ec497a166562d3d1d00162a2a1fdd18d05ae3 Mon Sep 17 00:00:00 2001 From: William Shelley Date: Wed, 27 Nov 2024 15:52:09 +0000 Subject: [PATCH 05/15] fix: removed unused ref --- infra/terraform/modules/service/README.md | 1 - infra/terraform/modules/service/cdn.tf | 2 -- 2 files changed, 3 deletions(-) diff --git a/infra/terraform/modules/service/README.md b/infra/terraform/modules/service/README.md index 2b8fdf495c..268d5f21fc 100644 --- a/infra/terraform/modules/service/README.md +++ b/infra/terraform/modules/service/README.md @@ -37,7 +37,6 @@ | [aws_lb_listener_rule.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener_rule) | resource | | [aws_lb_target_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group) | resource | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | -| [aws_caller_identity.current_account](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | | [aws_canonical_user_id.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/canonical_user_id) | data source | | [aws_cloudfront_log_delivery_canonical_user_id.cloudfront](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/cloudfront_log_delivery_canonical_user_id) | data source | | [aws_route53_zone.public](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source | diff --git a/infra/terraform/modules/service/cdn.tf b/infra/terraform/modules/service/cdn.tf index f890875b2f..818e342252 100644 --- a/infra/terraform/modules/service/cdn.tf +++ b/infra/terraform/modules/service/cdn.tf @@ -13,8 +13,6 @@ provider "aws" { skip_requesting_account_id = false } -data "aws_caller_identity" "current_account" {} - data "aws_route53_zone" "public" { name = var.domain_name } From 0f677f6c1484c89a586ca4fb903c9392750ae3a1 Mon Sep 17 00:00:00 2001 From: "laurence.barker@dvsa.gov.uk" Date: Wed, 27 Nov 2024 23:22:10 +0000 Subject: [PATCH 06/15] fix: asset bucket issue --- infra/terraform/environments/dev/main.tf | 1 - infra/terraform/modules/service/cdn.tf | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/infra/terraform/environments/dev/main.tf b/infra/terraform/environments/dev/main.tf index 0728693a94..16b062e8ef 100644 --- a/infra/terraform/environments/dev/main.tf +++ b/infra/terraform/environments/dev/main.tf @@ -139,7 +139,6 @@ module "service" { source = "../../modules/service" environment = "dev" - account = "054614622558" legacy_environment = "DEV" diff --git a/infra/terraform/modules/service/cdn.tf b/infra/terraform/modules/service/cdn.tf index 818e342252..59fb5b0baa 100644 --- a/infra/terraform/modules/service/cdn.tf +++ b/infra/terraform/modules/service/cdn.tf @@ -18,7 +18,7 @@ data "aws_route53_zone" "public" { } data "aws_s3_bucket" "assets" { - bucket = "${var.account}-vol-app-assets" + bucket = "*-vol-app-assets" } locals { From ab98a22bcf1f27b3598c21f9fad7649338cec183 Mon Sep 17 00:00:00 2001 From: "laurence.barker@dvsa.gov.uk" Date: Wed, 27 Nov 2024 23:46:11 +0000 Subject: [PATCH 07/15] fix: provider issue --- .../environments/dev/.terraform.lock.hcl | 26 +++++++++++++++++++ .../environments/int/.terraform.lock.hcl | 25 ++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 infra/terraform/environments/dev/.terraform.lock.hcl create mode 100644 infra/terraform/environments/int/.terraform.lock.hcl diff --git a/infra/terraform/environments/dev/.terraform.lock.hcl b/infra/terraform/environments/dev/.terraform.lock.hcl new file mode 100644 index 0000000000..4391c9733a --- /dev/null +++ b/infra/terraform/environments/dev/.terraform.lock.hcl @@ -0,0 +1,26 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/aws" { + version = "5.72.1" + constraints = ">= 4.0.0, >= 4.40.0, >= 4.66.1, >= 5.0.0, >= 5.12.0, >= 5.25.0, >= 5.37.0, >= 5.70.0, >= 5.72.0, >= 5.72.1" + hashes = [ + "h1:BkYfMmqLJIqLkLLz9sDRWJR5+7GCXTocNPN4pIHkhQo=", + "h1:ZpM0d+tK1vhOi6llGqex5PgzdlOURa543XU9uYvjA2E=", + "zh:0dea6843836e926d33469b48b948744079023816d16a2ff7666bcfb6aa3522d4", + "zh:195fa9513f75800a0d62797ebec75ee73e9b8c28d713fe9b63d3b1d1eec129b3", + "zh:1ed92f3961715bf0e024bcde3c12dfbdc50b00c1f8a43cc00802cfc45a256208", + "zh:2ac687e3a52606466cae4a6813e81d923042488df88d2424e28d3f8530f091bb", + "zh:32e7ca75f9314557daada3c44628fe1f3bf964a4f833bfb4b2295d833fe64b6f", + "zh:374ee0e6b4327cc6ef666908ce5d6450a3a56e90cd2b785e83c2bcfc100021d2", + "zh:5500fd6fdac44f96411fcf9c6d01691159ec35455ed127eb4c3a498e1cc92a64", + "zh:723a2dc4b064c12e7ee62ad4fbfd72fa5e025206ea47b735994ef53f3c373152", + "zh:89d97b87605f1d734f27e642567cbecf785b521af8ea81dac55c77ccde876221", + "zh:951ee1e5731e8d65d521d71b95927e55055b3c4656eef6d46fa580a63328befc", + "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", + "zh:9b2b362470b64ec227b2da64762ab8bc4111c6b80365fd9d82fc5e1e33f44038", + "zh:aa6e57d0cb974ff0da5dee5d43ad2745cbbc4a2b507d4c799839b9fa96daf688", + "zh:ba0d14c4a6b7aa844a830d47c0bf995b632e37f0795394b5b60c638b62b7fc03", + "zh:c9764065a9c5d324db0b02bd201b9e3a2118e49c4960884acdeea377173302e9", + ] +} diff --git a/infra/terraform/environments/int/.terraform.lock.hcl b/infra/terraform/environments/int/.terraform.lock.hcl new file mode 100644 index 0000000000..693d6e0aeb --- /dev/null +++ b/infra/terraform/environments/int/.terraform.lock.hcl @@ -0,0 +1,25 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/aws" { + version = "5.72.1" + constraints = ">= 4.0.0, >= 4.36.0, >= 4.40.0, >= 4.66.1, >= 5.0.0, >= 5.12.0, >= 5.25.0, >= 5.37.0, >= 5.61.0, >= 5.70.0, >= 5.72.1" + hashes = [ + "h1:BkYfMmqLJIqLkLLz9sDRWJR5+7GCXTocNPN4pIHkhQo=", + "zh:0dea6843836e926d33469b48b948744079023816d16a2ff7666bcfb6aa3522d4", + "zh:195fa9513f75800a0d62797ebec75ee73e9b8c28d713fe9b63d3b1d1eec129b3", + "zh:1ed92f3961715bf0e024bcde3c12dfbdc50b00c1f8a43cc00802cfc45a256208", + "zh:2ac687e3a52606466cae4a6813e81d923042488df88d2424e28d3f8530f091bb", + "zh:32e7ca75f9314557daada3c44628fe1f3bf964a4f833bfb4b2295d833fe64b6f", + "zh:374ee0e6b4327cc6ef666908ce5d6450a3a56e90cd2b785e83c2bcfc100021d2", + "zh:5500fd6fdac44f96411fcf9c6d01691159ec35455ed127eb4c3a498e1cc92a64", + "zh:723a2dc4b064c12e7ee62ad4fbfd72fa5e025206ea47b735994ef53f3c373152", + "zh:89d97b87605f1d734f27e642567cbecf785b521af8ea81dac55c77ccde876221", + "zh:951ee1e5731e8d65d521d71b95927e55055b3c4656eef6d46fa580a63328befc", + "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", + "zh:9b2b362470b64ec227b2da64762ab8bc4111c6b80365fd9d82fc5e1e33f44038", + "zh:aa6e57d0cb974ff0da5dee5d43ad2745cbbc4a2b507d4c799839b9fa96daf688", + "zh:ba0d14c4a6b7aa844a830d47c0bf995b632e37f0795394b5b60c638b62b7fc03", + "zh:c9764065a9c5d324db0b02bd201b9e3a2118e49c4960884acdeea377173302e9", + ] +} From 4b40c27faf89e3bdf7b1161f66c86970b0281105 Mon Sep 17 00:00:00 2001 From: "laurence.barker@dvsa.gov.uk" Date: Wed, 27 Nov 2024 23:49:39 +0000 Subject: [PATCH 08/15] fix: provider issue pt 2 --- .../accounts/_init/.terraform.lock.hcl | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 infra/terraform/accounts/_init/.terraform.lock.hcl diff --git a/infra/terraform/accounts/_init/.terraform.lock.hcl b/infra/terraform/accounts/_init/.terraform.lock.hcl new file mode 100644 index 0000000000..b26da4ac55 --- /dev/null +++ b/infra/terraform/accounts/_init/.terraform.lock.hcl @@ -0,0 +1,25 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/aws" { + version = "5.74.0" + constraints = ">= 4.0.0, >= 5.0, >= 5.6.0, >= 5.70.0, >= 5.72.1" + hashes = [ + "h1:0Iq3x8RSdWedvATBO1RZbCQqRCHPNsdhkYVrRs9crEE=", + "zh:1e2d65add4d63af5b396ae33d55c48303eca6c86bd1be0f6fae13267a9b47bc4", + "zh:20ddec3dac3d06a188f12e58b6428854949b1295e937c5d4dca4866dc1c937af", + "zh:35b72de4e6a3e3d69efc07184fb413406262fe447b2d82d57eaf8c787a068a06", + "zh:44eada24a50cd869aadc4b29f9e791fdf262d7f426921e9ac2893bbb86013176", + "zh:455e666e3a9a2312b3b9f434b87a404b6515d64a8853751e20566a6548f9df9e", + "zh:58b3ae74abfca7b9b61f42f0c8b10d97f9b01aff18bd1d4ab091129c9d203707", + "zh:840a8a32d5923f9e7422f9c80d165c3f89bb6ea370b8283095081e39050a8ea8", + "zh:87cb6dbbdbc1b73bdde4b8b5d6d780914a3e8f1df0385da4ea7323dc1a68468f", + "zh:8b8953e39b0e6e6156c5570d1ca653450bfa0d9b280e2475f01ee5c51a6554db", + "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", + "zh:9bd750262e2fb0187a8420a561e55b0a1da738f690f53f5c7df170cb1f380459", + "zh:9d2474c1432dfa5e1db197e2dd6cd61a6a15452e0bc7acd09ca86b3cdb228871", + "zh:b763ecaf471c7737a5c6e4cf257b5318e922a6610fd83b36ed8eb68582a8642e", + "zh:c1344cd8fe03ff7433a19b14b14a1898c2ca5ba22a468fb8e1687f0a7f564d52", + "zh:dc0e0abf3be7402d0d022ced82816884356115ed27646df9c7222609e96840e6", + ] +} From cc7d02de616efda3bafeb08fdcfa09a4713850ee Mon Sep 17 00:00:00 2001 From: "laurence.barker@dvsa.gov.uk" Date: Wed, 27 Nov 2024 23:55:33 +0000 Subject: [PATCH 09/15] fix: update lock files --- .../environments/dev/.terraform.lock.hcl | 35 +++++++++---------- .../environments/int/.terraform.lock.hcl | 34 +++++++++--------- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/infra/terraform/environments/dev/.terraform.lock.hcl b/infra/terraform/environments/dev/.terraform.lock.hcl index 4391c9733a..f545d22c70 100644 --- a/infra/terraform/environments/dev/.terraform.lock.hcl +++ b/infra/terraform/environments/dev/.terraform.lock.hcl @@ -2,25 +2,24 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/aws" { - version = "5.72.1" - constraints = ">= 4.0.0, >= 4.40.0, >= 4.66.1, >= 5.0.0, >= 5.12.0, >= 5.25.0, >= 5.37.0, >= 5.70.0, >= 5.72.0, >= 5.72.1" + version = "5.78.0" + constraints = ">= 4.0.0, >= 4.40.0, >= 4.66.1, >= 5.0.0, >= 5.12.0, >= 5.25.0, >= 5.37.0, >= 5.70.0, >= 5.72.1, >= 5.75.1" hashes = [ - "h1:BkYfMmqLJIqLkLLz9sDRWJR5+7GCXTocNPN4pIHkhQo=", - "h1:ZpM0d+tK1vhOi6llGqex5PgzdlOURa543XU9uYvjA2E=", - "zh:0dea6843836e926d33469b48b948744079023816d16a2ff7666bcfb6aa3522d4", - "zh:195fa9513f75800a0d62797ebec75ee73e9b8c28d713fe9b63d3b1d1eec129b3", - "zh:1ed92f3961715bf0e024bcde3c12dfbdc50b00c1f8a43cc00802cfc45a256208", - "zh:2ac687e3a52606466cae4a6813e81d923042488df88d2424e28d3f8530f091bb", - "zh:32e7ca75f9314557daada3c44628fe1f3bf964a4f833bfb4b2295d833fe64b6f", - "zh:374ee0e6b4327cc6ef666908ce5d6450a3a56e90cd2b785e83c2bcfc100021d2", - "zh:5500fd6fdac44f96411fcf9c6d01691159ec35455ed127eb4c3a498e1cc92a64", - "zh:723a2dc4b064c12e7ee62ad4fbfd72fa5e025206ea47b735994ef53f3c373152", - "zh:89d97b87605f1d734f27e642567cbecf785b521af8ea81dac55c77ccde876221", - "zh:951ee1e5731e8d65d521d71b95927e55055b3c4656eef6d46fa580a63328befc", + "h1:/EKXECKi3XzLR0SwaEyQucvsQx2TdyIF2DYabr9DVqM=", + "zh:0ae7d41b96441d0cf7ce2e1337657bdb2e1e5c9f1c2227b0642e1dcec2f9dfba", + "zh:21f8f1edf477681ea3b095c02cad6b8e85262e45015de58e84e0c7b2bfe9a1f6", + "zh:2bdc335e341bf98445255549ae93d66cfb9bca706e62b949da98fe467c182cad", + "zh:2fe4096e260367a225a9faf4a424d62b87e5498f12cb43bdb6f4e713d11b82c3", + "zh:3c63bb7a7925d65118d17461f4691a22dbb55ea39a7404e4d71f6ccca8765f8b", + "zh:6609a28a1c638a1901d8007b5386868ccfd313b4df2e98b35d9fdef436974e3b", + "zh:7ae3aef43bc4b365824cca4659cf92459d766800656e354bdbf83feabab835e8", "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:9b2b362470b64ec227b2da64762ab8bc4111c6b80365fd9d82fc5e1e33f44038", - "zh:aa6e57d0cb974ff0da5dee5d43ad2745cbbc4a2b507d4c799839b9fa96daf688", - "zh:ba0d14c4a6b7aa844a830d47c0bf995b632e37f0795394b5b60c638b62b7fc03", - "zh:c9764065a9c5d324db0b02bd201b9e3a2118e49c4960884acdeea377173302e9", + "zh:c314efe454adc6ca483261c6906e64315aeb9db0c0332818714e9b81e07df0f0", + "zh:cd3e30396b554bbc1d260252db8a0f344065d619038fe60ea870689cd32c6aa9", + "zh:d1ba48fd9d8a1cb1daa927fb9e8bb708b857f2792d796e110460c6fdcd896a47", + "zh:d31c8abe75cb9cdc1c59ad9d356a1c3ae1ba8cd29ac15eb7e01b6cd01221ab04", + "zh:dc27c5c2116b4d9b404753f73bccaa635bce21f3bfb4bb7bc8e63225c36c98fe", + "zh:de491f0d05408378413187475c815d8cb2ac6bfa63d0b42a30ad5ee492e51c07", + "zh:eb44b45a40f80a309dd5b0eb7d7fcb2cbfe588fe2f18b173ef5851346898a662", ] } diff --git a/infra/terraform/environments/int/.terraform.lock.hcl b/infra/terraform/environments/int/.terraform.lock.hcl index 693d6e0aeb..f545d22c70 100644 --- a/infra/terraform/environments/int/.terraform.lock.hcl +++ b/infra/terraform/environments/int/.terraform.lock.hcl @@ -2,24 +2,24 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/aws" { - version = "5.72.1" - constraints = ">= 4.0.0, >= 4.36.0, >= 4.40.0, >= 4.66.1, >= 5.0.0, >= 5.12.0, >= 5.25.0, >= 5.37.0, >= 5.61.0, >= 5.70.0, >= 5.72.1" + version = "5.78.0" + constraints = ">= 4.0.0, >= 4.40.0, >= 4.66.1, >= 5.0.0, >= 5.12.0, >= 5.25.0, >= 5.37.0, >= 5.70.0, >= 5.72.1, >= 5.75.1" hashes = [ - "h1:BkYfMmqLJIqLkLLz9sDRWJR5+7GCXTocNPN4pIHkhQo=", - "zh:0dea6843836e926d33469b48b948744079023816d16a2ff7666bcfb6aa3522d4", - "zh:195fa9513f75800a0d62797ebec75ee73e9b8c28d713fe9b63d3b1d1eec129b3", - "zh:1ed92f3961715bf0e024bcde3c12dfbdc50b00c1f8a43cc00802cfc45a256208", - "zh:2ac687e3a52606466cae4a6813e81d923042488df88d2424e28d3f8530f091bb", - "zh:32e7ca75f9314557daada3c44628fe1f3bf964a4f833bfb4b2295d833fe64b6f", - "zh:374ee0e6b4327cc6ef666908ce5d6450a3a56e90cd2b785e83c2bcfc100021d2", - "zh:5500fd6fdac44f96411fcf9c6d01691159ec35455ed127eb4c3a498e1cc92a64", - "zh:723a2dc4b064c12e7ee62ad4fbfd72fa5e025206ea47b735994ef53f3c373152", - "zh:89d97b87605f1d734f27e642567cbecf785b521af8ea81dac55c77ccde876221", - "zh:951ee1e5731e8d65d521d71b95927e55055b3c4656eef6d46fa580a63328befc", + "h1:/EKXECKi3XzLR0SwaEyQucvsQx2TdyIF2DYabr9DVqM=", + "zh:0ae7d41b96441d0cf7ce2e1337657bdb2e1e5c9f1c2227b0642e1dcec2f9dfba", + "zh:21f8f1edf477681ea3b095c02cad6b8e85262e45015de58e84e0c7b2bfe9a1f6", + "zh:2bdc335e341bf98445255549ae93d66cfb9bca706e62b949da98fe467c182cad", + "zh:2fe4096e260367a225a9faf4a424d62b87e5498f12cb43bdb6f4e713d11b82c3", + "zh:3c63bb7a7925d65118d17461f4691a22dbb55ea39a7404e4d71f6ccca8765f8b", + "zh:6609a28a1c638a1901d8007b5386868ccfd313b4df2e98b35d9fdef436974e3b", + "zh:7ae3aef43bc4b365824cca4659cf92459d766800656e354bdbf83feabab835e8", "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:9b2b362470b64ec227b2da64762ab8bc4111c6b80365fd9d82fc5e1e33f44038", - "zh:aa6e57d0cb974ff0da5dee5d43ad2745cbbc4a2b507d4c799839b9fa96daf688", - "zh:ba0d14c4a6b7aa844a830d47c0bf995b632e37f0795394b5b60c638b62b7fc03", - "zh:c9764065a9c5d324db0b02bd201b9e3a2118e49c4960884acdeea377173302e9", + "zh:c314efe454adc6ca483261c6906e64315aeb9db0c0332818714e9b81e07df0f0", + "zh:cd3e30396b554bbc1d260252db8a0f344065d619038fe60ea870689cd32c6aa9", + "zh:d1ba48fd9d8a1cb1daa927fb9e8bb708b857f2792d796e110460c6fdcd896a47", + "zh:d31c8abe75cb9cdc1c59ad9d356a1c3ae1ba8cd29ac15eb7e01b6cd01221ab04", + "zh:dc27c5c2116b4d9b404753f73bccaa635bce21f3bfb4bb7bc8e63225c36c98fe", + "zh:de491f0d05408378413187475c815d8cb2ac6bfa63d0b42a30ad5ee492e51c07", + "zh:eb44b45a40f80a309dd5b0eb7d7fcb2cbfe588fe2f18b173ef5851346898a662", ] } From 29232dbada0ea27b21ed44f1d68c761ae41d36fa Mon Sep 17 00:00:00 2001 From: "laurence.barker@dvsa.gov.uk" Date: Thu, 28 Nov 2024 00:54:18 +0000 Subject: [PATCH 10/15] fix: include .gitignore files and remove lock files to resolve issues once and for all --- .../accounts/_init/.terraform.lock.hcl | 25 ------------------- .../environments/dev/.terraform.lock.hcl | 25 ------------------- .../environments/int/.terraform.lock.hcl | 25 ------------------- 3 files changed, 75 deletions(-) delete mode 100644 infra/terraform/accounts/_init/.terraform.lock.hcl delete mode 100644 infra/terraform/environments/dev/.terraform.lock.hcl delete mode 100644 infra/terraform/environments/int/.terraform.lock.hcl diff --git a/infra/terraform/accounts/_init/.terraform.lock.hcl b/infra/terraform/accounts/_init/.terraform.lock.hcl deleted file mode 100644 index b26da4ac55..0000000000 --- a/infra/terraform/accounts/_init/.terraform.lock.hcl +++ /dev/null @@ -1,25 +0,0 @@ -# This file is maintained automatically by "terraform init". -# Manual edits may be lost in future updates. - -provider "registry.terraform.io/hashicorp/aws" { - version = "5.74.0" - constraints = ">= 4.0.0, >= 5.0, >= 5.6.0, >= 5.70.0, >= 5.72.1" - hashes = [ - "h1:0Iq3x8RSdWedvATBO1RZbCQqRCHPNsdhkYVrRs9crEE=", - "zh:1e2d65add4d63af5b396ae33d55c48303eca6c86bd1be0f6fae13267a9b47bc4", - "zh:20ddec3dac3d06a188f12e58b6428854949b1295e937c5d4dca4866dc1c937af", - "zh:35b72de4e6a3e3d69efc07184fb413406262fe447b2d82d57eaf8c787a068a06", - "zh:44eada24a50cd869aadc4b29f9e791fdf262d7f426921e9ac2893bbb86013176", - "zh:455e666e3a9a2312b3b9f434b87a404b6515d64a8853751e20566a6548f9df9e", - "zh:58b3ae74abfca7b9b61f42f0c8b10d97f9b01aff18bd1d4ab091129c9d203707", - "zh:840a8a32d5923f9e7422f9c80d165c3f89bb6ea370b8283095081e39050a8ea8", - "zh:87cb6dbbdbc1b73bdde4b8b5d6d780914a3e8f1df0385da4ea7323dc1a68468f", - "zh:8b8953e39b0e6e6156c5570d1ca653450bfa0d9b280e2475f01ee5c51a6554db", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:9bd750262e2fb0187a8420a561e55b0a1da738f690f53f5c7df170cb1f380459", - "zh:9d2474c1432dfa5e1db197e2dd6cd61a6a15452e0bc7acd09ca86b3cdb228871", - "zh:b763ecaf471c7737a5c6e4cf257b5318e922a6610fd83b36ed8eb68582a8642e", - "zh:c1344cd8fe03ff7433a19b14b14a1898c2ca5ba22a468fb8e1687f0a7f564d52", - "zh:dc0e0abf3be7402d0d022ced82816884356115ed27646df9c7222609e96840e6", - ] -} diff --git a/infra/terraform/environments/dev/.terraform.lock.hcl b/infra/terraform/environments/dev/.terraform.lock.hcl deleted file mode 100644 index f545d22c70..0000000000 --- a/infra/terraform/environments/dev/.terraform.lock.hcl +++ /dev/null @@ -1,25 +0,0 @@ -# This file is maintained automatically by "terraform init". -# Manual edits may be lost in future updates. - -provider "registry.terraform.io/hashicorp/aws" { - version = "5.78.0" - constraints = ">= 4.0.0, >= 4.40.0, >= 4.66.1, >= 5.0.0, >= 5.12.0, >= 5.25.0, >= 5.37.0, >= 5.70.0, >= 5.72.1, >= 5.75.1" - hashes = [ - "h1:/EKXECKi3XzLR0SwaEyQucvsQx2TdyIF2DYabr9DVqM=", - "zh:0ae7d41b96441d0cf7ce2e1337657bdb2e1e5c9f1c2227b0642e1dcec2f9dfba", - "zh:21f8f1edf477681ea3b095c02cad6b8e85262e45015de58e84e0c7b2bfe9a1f6", - "zh:2bdc335e341bf98445255549ae93d66cfb9bca706e62b949da98fe467c182cad", - "zh:2fe4096e260367a225a9faf4a424d62b87e5498f12cb43bdb6f4e713d11b82c3", - "zh:3c63bb7a7925d65118d17461f4691a22dbb55ea39a7404e4d71f6ccca8765f8b", - "zh:6609a28a1c638a1901d8007b5386868ccfd313b4df2e98b35d9fdef436974e3b", - "zh:7ae3aef43bc4b365824cca4659cf92459d766800656e354bdbf83feabab835e8", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:c314efe454adc6ca483261c6906e64315aeb9db0c0332818714e9b81e07df0f0", - "zh:cd3e30396b554bbc1d260252db8a0f344065d619038fe60ea870689cd32c6aa9", - "zh:d1ba48fd9d8a1cb1daa927fb9e8bb708b857f2792d796e110460c6fdcd896a47", - "zh:d31c8abe75cb9cdc1c59ad9d356a1c3ae1ba8cd29ac15eb7e01b6cd01221ab04", - "zh:dc27c5c2116b4d9b404753f73bccaa635bce21f3bfb4bb7bc8e63225c36c98fe", - "zh:de491f0d05408378413187475c815d8cb2ac6bfa63d0b42a30ad5ee492e51c07", - "zh:eb44b45a40f80a309dd5b0eb7d7fcb2cbfe588fe2f18b173ef5851346898a662", - ] -} diff --git a/infra/terraform/environments/int/.terraform.lock.hcl b/infra/terraform/environments/int/.terraform.lock.hcl deleted file mode 100644 index f545d22c70..0000000000 --- a/infra/terraform/environments/int/.terraform.lock.hcl +++ /dev/null @@ -1,25 +0,0 @@ -# This file is maintained automatically by "terraform init". -# Manual edits may be lost in future updates. - -provider "registry.terraform.io/hashicorp/aws" { - version = "5.78.0" - constraints = ">= 4.0.0, >= 4.40.0, >= 4.66.1, >= 5.0.0, >= 5.12.0, >= 5.25.0, >= 5.37.0, >= 5.70.0, >= 5.72.1, >= 5.75.1" - hashes = [ - "h1:/EKXECKi3XzLR0SwaEyQucvsQx2TdyIF2DYabr9DVqM=", - "zh:0ae7d41b96441d0cf7ce2e1337657bdb2e1e5c9f1c2227b0642e1dcec2f9dfba", - "zh:21f8f1edf477681ea3b095c02cad6b8e85262e45015de58e84e0c7b2bfe9a1f6", - "zh:2bdc335e341bf98445255549ae93d66cfb9bca706e62b949da98fe467c182cad", - "zh:2fe4096e260367a225a9faf4a424d62b87e5498f12cb43bdb6f4e713d11b82c3", - "zh:3c63bb7a7925d65118d17461f4691a22dbb55ea39a7404e4d71f6ccca8765f8b", - "zh:6609a28a1c638a1901d8007b5386868ccfd313b4df2e98b35d9fdef436974e3b", - "zh:7ae3aef43bc4b365824cca4659cf92459d766800656e354bdbf83feabab835e8", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:c314efe454adc6ca483261c6906e64315aeb9db0c0332818714e9b81e07df0f0", - "zh:cd3e30396b554bbc1d260252db8a0f344065d619038fe60ea870689cd32c6aa9", - "zh:d1ba48fd9d8a1cb1daa927fb9e8bb708b857f2792d796e110460c6fdcd896a47", - "zh:d31c8abe75cb9cdc1c59ad9d356a1c3ae1ba8cd29ac15eb7e01b6cd01221ab04", - "zh:dc27c5c2116b4d9b404753f73bccaa635bce21f3bfb4bb7bc8e63225c36c98fe", - "zh:de491f0d05408378413187475c815d8cb2ac6bfa63d0b42a30ad5ee492e51c07", - "zh:eb44b45a40f80a309dd5b0eb7d7fcb2cbfe588fe2f18b173ef5851346898a662", - ] -} From d74d78cc73738a8f4352821e3517881e1c8dcc78 Mon Sep 17 00:00:00 2001 From: "laurence.barker@dvsa.gov.uk" Date: Thu, 28 Nov 2024 01:20:03 +0000 Subject: [PATCH 11/15] fix: bucket name using local --- infra/terraform/modules/service/cdn.tf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/infra/terraform/modules/service/cdn.tf b/infra/terraform/modules/service/cdn.tf index 59fb5b0baa..1ed5216ad3 100644 --- a/infra/terraform/modules/service/cdn.tf +++ b/infra/terraform/modules/service/cdn.tf @@ -17,8 +17,13 @@ data "aws_route53_zone" "public" { name = var.domain_name } +data "aws_caller_identity" "current_account_id" {} + +locals { + asset_bucket = "${data.aws_caller_identity.current_account_id.account_id}-vol-app-assets" +} data "aws_s3_bucket" "assets" { - bucket = "*-vol-app-assets" + bucket = "${local.asset_bucket}" } locals { From 96038f7be205369941c7511a4ff3eb3a767caee7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 28 Nov 2024 01:20:25 +0000 Subject: [PATCH 12/15] docs: update Terraform docs --- infra/terraform/modules/service/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/infra/terraform/modules/service/README.md b/infra/terraform/modules/service/README.md index 268d5f21fc..f309333470 100644 --- a/infra/terraform/modules/service/README.md +++ b/infra/terraform/modules/service/README.md @@ -37,6 +37,7 @@ | [aws_lb_listener_rule.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener_rule) | resource | | [aws_lb_target_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group) | resource | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | +| [aws_caller_identity.current_account_id](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | | [aws_canonical_user_id.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/canonical_user_id) | data source | | [aws_cloudfront_log_delivery_canonical_user_id.cloudfront](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/cloudfront_log_delivery_canonical_user_id) | data source | | [aws_route53_zone.public](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source | From f0f00ca111ec2a8de40302ef8042b419620d37df Mon Sep 17 00:00:00 2001 From: William Shelley Date: Thu, 28 Nov 2024 09:51:50 +0000 Subject: [PATCH 13/15] fix: tf-formatting --- infra/terraform/modules/service/cdn.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infra/terraform/modules/service/cdn.tf b/infra/terraform/modules/service/cdn.tf index 1ed5216ad3..9303426aa6 100644 --- a/infra/terraform/modules/service/cdn.tf +++ b/infra/terraform/modules/service/cdn.tf @@ -23,7 +23,7 @@ locals { asset_bucket = "${data.aws_caller_identity.current_account_id.account_id}-vol-app-assets" } data "aws_s3_bucket" "assets" { - bucket = "${local.asset_bucket}" + bucket = local.asset_bucket } locals { From c445427d28ae50ebd0bb7e7f30e20f851c226f52 Mon Sep 17 00:00:00 2001 From: William Shelley Date: Thu, 28 Nov 2024 15:23:19 +0000 Subject: [PATCH 14/15] fix: remove sts assume role from assets bucket --- infra/terraform/modules/account/main.tf | 4 ---- 1 file changed, 4 deletions(-) diff --git a/infra/terraform/modules/account/main.tf b/infra/terraform/modules/account/main.tf index 39104eafec..8dce0f65fb 100644 --- a/infra/terraform/modules/account/main.tf +++ b/infra/terraform/modules/account/main.tf @@ -22,10 +22,6 @@ data "aws_iam_policy_document" "s3_policy" { type = "Service" identifiers = ["cloudfront.amazonaws.com"] } - principals { - type = "AWS" - identifiers = ["arn:aws:sts::${local.account_id}:assumed-role/${var.assets_bucket_policy_role}"] - } } } From a581ea47d68b0954d8df4dfc0796609a31aca877 Mon Sep 17 00:00:00 2001 From: William Shelley Date: Thu, 28 Nov 2024 15:26:58 +0000 Subject: [PATCH 15/15] fix: lint - remove unused variable --- infra/terraform/accounts/nonprod/main.tf | 2 -- infra/terraform/accounts/prod/main.tf | 2 -- infra/terraform/modules/account/README.md | 1 - infra/terraform/modules/account/variables.tf | 6 ------ 4 files changed, 11 deletions(-) diff --git a/infra/terraform/accounts/nonprod/main.tf b/infra/terraform/accounts/nonprod/main.tf index fe6d1d58a5..49fa96b258 100644 --- a/infra/terraform/accounts/nonprod/main.tf +++ b/infra/terraform/accounts/nonprod/main.tf @@ -24,8 +24,6 @@ module "environment-remote-state" { module "account" { source = "../../modules/account" - assets_bucket_policy_role = "OLCS-DEVAPPCI-DEVCI-OLCSCISLAVE" - create_ecr_resources = true create_assets_bucket = true create_github_resources = true diff --git a/infra/terraform/accounts/prod/main.tf b/infra/terraform/accounts/prod/main.tf index d13d2ae09a..a1a91bf79b 100644 --- a/infra/terraform/accounts/prod/main.tf +++ b/infra/terraform/accounts/prod/main.tf @@ -24,8 +24,6 @@ module "environment-remote-state" { module "account" { source = "../../modules/account" - assets_bucket_policy_role = "OLCS-APPCI-CI-OLCSCISLAVE" - create_ecr_resources = true create_assets_bucket = true create_github_resources = true diff --git a/infra/terraform/modules/account/README.md b/infra/terraform/modules/account/README.md index 837c08c914..11805900db 100644 --- a/infra/terraform/modules/account/README.md +++ b/infra/terraform/modules/account/README.md @@ -33,7 +33,6 @@ | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [assets\_bucket\_policy\_role](#input\_assets\_bucket\_policy\_role) | Assets bucket policy role | `string` | `""` | no | | [create\_assets\_bucket](#input\_create\_assets\_bucket) | Whether to create the assets bucket. | `bool` | `false` | no | | [create\_ecr\_resources](#input\_create\_ecr\_resources) | Whether to create the ECR resources. | `bool` | `false` | no | | [create\_github\_resources](#input\_create\_github\_resources) | Whether to create the GitHub resources. | `bool` | `false` | no | diff --git a/infra/terraform/modules/account/variables.tf b/infra/terraform/modules/account/variables.tf index 5c8ea575b9..577066a6a1 100644 --- a/infra/terraform/modules/account/variables.tf +++ b/infra/terraform/modules/account/variables.tf @@ -51,9 +51,3 @@ variable "create_assets_bucket" { description = "Whether to create the assets bucket." default = false } - -variable "assets_bucket_policy_role" { - type = string - description = "Assets bucket policy role " - default = "" -}