From 2d72fd48ae6d70a125ad5bfd3594e11e3f9d4291 Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 13 Nov 2023 15:00:24 -0500 Subject: [PATCH 1/7] add missing TF version requirements --- terraform/modules/tcp-routing/versions.tf | 4 ++-- terraform/modules/test_cdn/versions.tf | 14 ++++++++++++++ terraform/stack/versions.tf | 4 ++-- 3 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 terraform/modules/test_cdn/versions.tf diff --git a/terraform/modules/tcp-routing/versions.tf b/terraform/modules/tcp-routing/versions.tf index 35bdad6d..0a9f8a9c 100644 --- a/terraform/modules/tcp-routing/versions.tf +++ b/terraform/modules/tcp-routing/versions.tf @@ -1,9 +1,9 @@ terraform { - required_version = ">= 0.14" + required_version = "< 2.0.0" required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" - version = "0.14.0" + version = "< 1.0.0" } } } diff --git a/terraform/modules/test_cdn/versions.tf b/terraform/modules/test_cdn/versions.tf new file mode 100644 index 00000000..c97b87e5 --- /dev/null +++ b/terraform/modules/test_cdn/versions.tf @@ -0,0 +1,14 @@ +terraform { + required_version = "< 2.0.0" + required_providers { + cloudfoundry = { + source = "cloudfoundry-community/cloudfoundry" + version = "< 1.0.0" + } + + zipper = { + source = "ArthurHlt/zipper" + version = "< 1.0.0" + } + } +} diff --git a/terraform/stack/versions.tf b/terraform/stack/versions.tf index 2231e93b..8ba4e0a4 100644 --- a/terraform/stack/versions.tf +++ b/terraform/stack/versions.tf @@ -3,7 +3,7 @@ terraform { required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" - version = "0.14.0" + version = "< 1.0.0" } } -} \ No newline at end of file +} From eaea6d5289903acdefd1491aa06226a731bd17c4 Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 13 Nov 2023 15:07:33 -0500 Subject: [PATCH 2/7] update version --- terraform/modules/test_cdn/versions.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/modules/test_cdn/versions.tf b/terraform/modules/test_cdn/versions.tf index c97b87e5..83fcfd3e 100644 --- a/terraform/modules/test_cdn/versions.tf +++ b/terraform/modules/test_cdn/versions.tf @@ -7,8 +7,8 @@ terraform { } zipper = { - source = "ArthurHlt/zipper" - version = "< 1.0.0" + source = "ArthurHlt/zipper" + version = "0.14.0" } } } From 387b4a3ef8095a12bb0b9b2fbb20c9fafd51e1c1 Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 13 Nov 2023 15:09:16 -0500 Subject: [PATCH 3/7] move provider definition --- terraform/modules/test_cdn/providers.tf | 3 +++ terraform/stack/providers.tf | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 terraform/modules/test_cdn/providers.tf diff --git a/terraform/modules/test_cdn/providers.tf b/terraform/modules/test_cdn/providers.tf new file mode 100644 index 00000000..6fe3eaa2 --- /dev/null +++ b/terraform/modules/test_cdn/providers.tf @@ -0,0 +1,3 @@ +provider "zipper" { + skip_ssl_validation = false +} diff --git a/terraform/stack/providers.tf b/terraform/stack/providers.tf index 5dd3d779..b912bb86 100644 --- a/terraform/stack/providers.tf +++ b/terraform/stack/providers.tf @@ -1,6 +1,2 @@ provider "cloudfoundry" { } - -provider "zipper" { - skip_ssl_validation = false -} From 07582c80de2d0750fe6026c3974cb9883a685071 Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 13 Nov 2023 15:12:22 -0500 Subject: [PATCH 4/7] move provider definitions to top-level --- terraform/modules/test_cdn/providers.tf | 3 --- terraform/stack/main.tf | 5 +++++ terraform/stack/providers.tf | 4 ++++ terraform/stack/versions.tf | 5 +++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/terraform/modules/test_cdn/providers.tf b/terraform/modules/test_cdn/providers.tf index 6fe3eaa2..e69de29b 100644 --- a/terraform/modules/test_cdn/providers.tf +++ b/terraform/modules/test_cdn/providers.tf @@ -1,3 +0,0 @@ -provider "zipper" { - skip_ssl_validation = false -} diff --git a/terraform/stack/main.tf b/terraform/stack/main.tf index 8809a9c5..047f8758 100644 --- a/terraform/stack/main.tf +++ b/terraform/stack/main.tf @@ -3,4 +3,9 @@ module "test_cdn" { source = "../modules/test_cdn" iaas_stack_name = var.iaas_stack_name space_id = data.cloudfoundry_space.hello_worlds.id + + providers = { + cloudfoundry = cloudfoundry + zipper = zipper + } } diff --git a/terraform/stack/providers.tf b/terraform/stack/providers.tf index b912bb86..5dd3d779 100644 --- a/terraform/stack/providers.tf +++ b/terraform/stack/providers.tf @@ -1,2 +1,6 @@ provider "cloudfoundry" { } + +provider "zipper" { + skip_ssl_validation = false +} diff --git a/terraform/stack/versions.tf b/terraform/stack/versions.tf index 8ba4e0a4..54355b8a 100644 --- a/terraform/stack/versions.tf +++ b/terraform/stack/versions.tf @@ -5,5 +5,10 @@ terraform { source = "cloudfoundry-community/cloudfoundry" version = "< 1.0.0" } + + zipper = { + source = "ArthurHlt/zipper" + version = "0.14.0" + } } } From a55b992a4dc589b4ee5fe42236b04c9150febaf1 Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 13 Nov 2023 15:15:54 -0500 Subject: [PATCH 5/7] move data source --- terraform/modules/test_cdn/test_cdn.tf | 11 ++++++++--- terraform/modules/test_cdn/variables.tf | 5 ----- terraform/stack/data.tf | 5 ----- terraform/stack/main.tf | 1 - 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/terraform/modules/test_cdn/test_cdn.tf b/terraform/modules/test_cdn/test_cdn.tf index 565b4621..ee0a4528 100644 --- a/terraform/modules/test_cdn/test_cdn.tf +++ b/terraform/modules/test_cdn/test_cdn.tf @@ -10,6 +10,11 @@ data "cloudfoundry_service" "external_domain" { name = "external-domain" } +data "cloudfoundry_space" "hello_worlds" { + name = "hello-worlds" + org = cloudfoundry_org.cloud-gov.id +} + resource "zipper_file" "test_cdn_src" { source = "https://github.com/cloud-gov/cf-hello-worlds/tree/main/static" output_path = "test-static-app.zip" @@ -17,7 +22,7 @@ resource "zipper_file" "test_cdn_src" { resource "cloudfoundry_route" "test_cdn_route" { domain = data.cloudfoundry_domain.fr_domain.id - space = var.space_id + space = data.cloudfoundry_space.hello_worlds.id hostname = "test-cdn" } @@ -26,7 +31,7 @@ resource "cloudfoundry_route" "test_cdn_route" { # https://github.com/cloud-gov/cg-provision/blob/417000c786a101988c3edd965f7c78f66ad334fe/terraform/stacks/dns/production.tf#L12-L17 resource "cloudfoundry_service_instance" "test_cdn_instance" { name = "test-cdn-service" - space = var.space_id + space = data.cloudfoundry_space.hello_worlds.id service_plan = data.cloudfoundry_service.external_domain.service_plans["domain-with-cdn"] json_params = "{\"domains\": \"test-cdn.${local.domain_name}\"}" } @@ -34,7 +39,7 @@ resource "cloudfoundry_service_instance" "test_cdn_instance" { resource "cloudfoundry_app" "test-cdn" { name = "test-cdn" buildpack = "staticfile_buildpack" - space = var.space_id + space = data.cloudfoundry_space.hello_worlds.id path = zipper_file.test_cdn_src.output_path source_code_hash = zipper_file.test_cdn_src.output_sha diff --git a/terraform/modules/test_cdn/variables.tf b/terraform/modules/test_cdn/variables.tf index 697900ff..aad6f717 100644 --- a/terraform/modules/test_cdn/variables.tf +++ b/terraform/modules/test_cdn/variables.tf @@ -1,7 +1,2 @@ variable "iaas_stack_name" { } - -variable "space_id" { - type = string - description = "Space GUID to deploy test CDN app" -} diff --git a/terraform/stack/data.tf b/terraform/stack/data.tf index 7031a53d..8e23cc26 100644 --- a/terraform/stack/data.tf +++ b/terraform/stack/data.tf @@ -13,8 +13,3 @@ data "terraform_remote_state" "tooling" { key = "${var.tooling_stack_name}/terraform.tfstate" } } - -data "cloudfoundry_space" "hello_worlds" { - name = "hello-worlds" - org = cloudfoundry_org.cloud-gov.id -} diff --git a/terraform/stack/main.tf b/terraform/stack/main.tf index 047f8758..a950e9ad 100644 --- a/terraform/stack/main.tf +++ b/terraform/stack/main.tf @@ -2,7 +2,6 @@ module "test_cdn" { count = var.iaas_stack_name == "development" ? 0 : 1 source = "../modules/test_cdn" iaas_stack_name = var.iaas_stack_name - space_id = data.cloudfoundry_space.hello_worlds.id providers = { cloudfoundry = cloudfoundry From fd090e340e94e8f54966b02644aa19bda10ff7bf Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 13 Nov 2023 15:19:47 -0500 Subject: [PATCH 6/7] refactor --- terraform/modules/test_cdn/test_cdn.tf | 4 ++-- terraform/modules/test_cdn/variables.tf | 11 +++++++++++ terraform/stack/main.tf | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/terraform/modules/test_cdn/test_cdn.tf b/terraform/modules/test_cdn/test_cdn.tf index ee0a4528..08aec039 100644 --- a/terraform/modules/test_cdn/test_cdn.tf +++ b/terraform/modules/test_cdn/test_cdn.tf @@ -11,8 +11,8 @@ data "cloudfoundry_service" "external_domain" { } data "cloudfoundry_space" "hello_worlds" { - name = "hello-worlds" - org = cloudfoundry_org.cloud-gov.id + name = var.space_name + org = var.organization_id } resource "zipper_file" "test_cdn_src" { diff --git a/terraform/modules/test_cdn/variables.tf b/terraform/modules/test_cdn/variables.tf index aad6f717..fdd3e9b7 100644 --- a/terraform/modules/test_cdn/variables.tf +++ b/terraform/modules/test_cdn/variables.tf @@ -1,2 +1,13 @@ variable "iaas_stack_name" { } + +variable "organization_id" { + type = string + description = "Organization GUID to use for test CDN app" +} + +variable "space_name" { + type = string + description = "Space name to use for test CDN app" + default = "hello-worlds" +} diff --git a/terraform/stack/main.tf b/terraform/stack/main.tf index a950e9ad..192a3def 100644 --- a/terraform/stack/main.tf +++ b/terraform/stack/main.tf @@ -2,6 +2,7 @@ module "test_cdn" { count = var.iaas_stack_name == "development" ? 0 : 1 source = "../modules/test_cdn" iaas_stack_name = var.iaas_stack_name + organization_id = cloudfoundry_org.cloud-gov.id providers = { cloudfoundry = cloudfoundry From 48d73f47ca352d9d027023a7d08eb921e2c275fa Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 13 Nov 2023 15:28:02 -0500 Subject: [PATCH 7/7] delete file --- terraform/modules/test_cdn/providers.tf | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 terraform/modules/test_cdn/providers.tf diff --git a/terraform/modules/test_cdn/providers.tf b/terraform/modules/test_cdn/providers.tf deleted file mode 100644 index e69de29b..00000000