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/test_cdn.tf b/terraform/modules/test_cdn/test_cdn.tf index 565b4621..08aec039 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 = var.space_name + org = var.organization_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..fdd3e9b7 100644 --- a/terraform/modules/test_cdn/variables.tf +++ b/terraform/modules/test_cdn/variables.tf @@ -1,7 +1,13 @@ variable "iaas_stack_name" { } -variable "space_id" { +variable "organization_id" { type = string - description = "Space GUID to deploy test CDN app" + 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/modules/test_cdn/versions.tf b/terraform/modules/test_cdn/versions.tf new file mode 100644 index 00000000..83fcfd3e --- /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 = "0.14.0" + } + } +} 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 8809a9c5..192a3def 100644 --- a/terraform/stack/main.tf +++ b/terraform/stack/main.tf @@ -2,5 +2,10 @@ 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 + organization_id = cloudfoundry_org.cloud-gov.id + + providers = { + cloudfoundry = cloudfoundry + zipper = zipper + } } diff --git a/terraform/stack/versions.tf b/terraform/stack/versions.tf index 2231e93b..54355b8a 100644 --- a/terraform/stack/versions.tf +++ b/terraform/stack/versions.tf @@ -3,7 +3,12 @@ terraform { required_providers { cloudfoundry = { source = "cloudfoundry-community/cloudfoundry" + version = "< 1.0.0" + } + + zipper = { + source = "ArthurHlt/zipper" version = "0.14.0" } } -} \ No newline at end of file +}