From 5720af664c9c16190ad2a653f5f46b0891dd79f0 Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 8 Jul 2024 15:39:56 -0400 Subject: [PATCH 1/3] break up TF code into named files --- terraform/stack/asg.tf | 152 -------------------------------------- terraform/stack/iso.tf | 10 +++ terraform/stack/orgs.tf | 10 +++ terraform/stack/quotas.tf | 20 +++++ terraform/stack/spaces.tf | 113 ++++++++++++++++++++++++++++ 5 files changed, 153 insertions(+), 152 deletions(-) create mode 100644 terraform/stack/iso.tf create mode 100644 terraform/stack/orgs.tf create mode 100644 terraform/stack/quotas.tf create mode 100644 terraform/stack/spaces.tf diff --git a/terraform/stack/asg.tf b/terraform/stack/asg.tf index e1b9484c..a4cd111e 100644 --- a/terraform/stack/asg.tf +++ b/terraform/stack/asg.tf @@ -338,155 +338,3 @@ resource "cloudfoundry_default_asg" "staging" { ] } -resource "cloudfoundry_org_quota" "default-tts" { - name = "default-tts" - allow_paid_service_plans = true - total_memory = 81920 - total_routes = 1000 - total_services = 200 - total_route_ports = -1 -} - -resource "cloudfoundry_org" "cloud-gov" { - name = "cloud-gov" - quota = cloudfoundry_org_quota.default-tts.id -} - -resource "cloudfoundry_isolation_segment" "platform" { - name = "platform" -} - -resource "cloudfoundry_isolation_segment_entitlement" "platform" { - segment = cloudfoundry_isolation_segment.platform.id - orgs = [ - cloudfoundry_org.cloud-gov.id - ] -} - -resource "cloudfoundry_space" "services" { - name = "services" - org = cloudfoundry_org.cloud-gov.id - asgs = [ - cloudfoundry_asg.public_networks.id, - cloudfoundry_asg.trusted_local_networks.id, - cloudfoundry_asg.dns.id, - cloudfoundry_asg.brokers.id, - cloudfoundry_asg.smtp.id, - ] - staging_asgs = [ - cloudfoundry_asg.trusted_local_networks.id, - cloudfoundry_asg.public_networks.id, - cloudfoundry_asg.dns.id, - ] - isolation_segment = cloudfoundry_isolation_segment.platform.id -} - -resource "cloudfoundry_space" "dashboard" { - name = "dashboard" - org = cloudfoundry_org.cloud-gov.id - asgs = [ - cloudfoundry_asg.trusted_local_networks.id, - cloudfoundry_asg.public_networks.id, - cloudfoundry_asg.dns.id, - cloudfoundry_asg.smtp.id, - ] - staging_asgs = [ - cloudfoundry_asg.trusted_local_networks.id, - cloudfoundry_asg.public_networks.id, - cloudfoundry_asg.dns.id, - ] -} - -resource "cloudfoundry_space" "cg-ui" { - name = "cg-ui" - org = cloudfoundry_org.cloud-gov.id - asgs = [ - cloudfoundry_asg.trusted_local_networks.id, - cloudfoundry_asg.public_networks.id, - cloudfoundry_asg.dns.id, - cloudfoundry_asg.smtp.id, - ] - staging_asgs = [ - cloudfoundry_asg.trusted_local_networks.id, - cloudfoundry_asg.public_networks.id, - cloudfoundry_asg.dns.id, - ] -} - -resource "cloudfoundry_space" "uaa-extras" { - name = "uaa-extras" - org = cloudfoundry_org.cloud-gov.id - asgs = [ - cloudfoundry_asg.trusted_local_networks.id, - cloudfoundry_asg.public_networks.id, - cloudfoundry_asg.dns.id, - cloudfoundry_asg.smtp.id, - ] - staging_asgs = [ - cloudfoundry_asg.trusted_local_networks.id, - cloudfoundry_asg.public_networks.id, - cloudfoundry_asg.dns.id, - ] -} - -resource "cloudfoundry_space" "cspr-collector" { - name = "cspr-collector" - org = cloudfoundry_org.cloud-gov.id - asgs = [ - cloudfoundry_asg.trusted_local_networks.id, - cloudfoundry_asg.public_networks.id, - cloudfoundry_asg.dns.id, - cloudfoundry_asg.smtp.id, - ] - staging_asgs = [ - cloudfoundry_asg.trusted_local_networks.id, - cloudfoundry_asg.public_networks.id, - cloudfoundry_asg.dns.id, - ] -} - -resource "cloudfoundry_space" "opensearch-dashboards-proxy" { - name = "opensearch-dashboards-proxy" - org = cloudfoundry_org.cloud-gov.id - asgs = [ - cloudfoundry_asg.public_networks_egress.id, - cloudfoundry_asg.dns.id, - ] - staging_asgs = [ - cloudfoundry_asg.dns.id, - ] -} - -# Federalist/Pages - -data "cloudfoundry_org" "gsa-18f-federalist" { - name = "gsa-18f-federalist" -} - -resource "cloudfoundry_space_quota" "tiny" { - name = "tiny-tf-managed" - allow_paid_service_plans = true - total_memory = 1024 - total_routes = -1 - total_services = -1 - total_route_ports = -1 - org = data.cloudfoundry_org.gsa-18f-federalist.id -} - -resource "cloudfoundry_space" "email" { - name = "email" - org = data.cloudfoundry_org.gsa-18f-federalist.id - quota = cloudfoundry_space_quota.tiny.id - asgs = [ - cloudfoundry_asg.public_networks.id, - cloudfoundry_asg.trusted_local_networks.id, - cloudfoundry_asg.public_networks.id, - cloudfoundry_asg.dns.id, - cloudfoundry_asg.smtp.id, - ] - staging_asgs = [ - cloudfoundry_asg.trusted_local_networks.id, - cloudfoundry_asg.public_networks.id, - cloudfoundry_asg.dns.id, - ] -} diff --git a/terraform/stack/iso.tf b/terraform/stack/iso.tf new file mode 100644 index 00000000..e48aa5d3 --- /dev/null +++ b/terraform/stack/iso.tf @@ -0,0 +1,10 @@ +resource "cloudfoundry_isolation_segment" "platform" { + name = "platform" +} + +resource "cloudfoundry_isolation_segment_entitlement" "platform" { + segment = cloudfoundry_isolation_segment.platform.id + orgs = [ + cloudfoundry_org.cloud-gov.id + ] +} diff --git a/terraform/stack/orgs.tf b/terraform/stack/orgs.tf new file mode 100644 index 00000000..bb22b90e --- /dev/null +++ b/terraform/stack/orgs.tf @@ -0,0 +1,10 @@ +resource "cloudfoundry_org" "cloud-gov" { + name = "cloud-gov" + quota = cloudfoundry_org_quota.default-tts.id +} + +# Federalist/Pages + +data "cloudfoundry_org" "gsa-18f-federalist" { + name = "gsa-18f-federalist" +} diff --git a/terraform/stack/quotas.tf b/terraform/stack/quotas.tf new file mode 100644 index 00000000..5cd7759e --- /dev/null +++ b/terraform/stack/quotas.tf @@ -0,0 +1,20 @@ +resource "cloudfoundry_org_quota" "default-tts" { + name = "default-tts" + allow_paid_service_plans = true + total_memory = 81920 + total_routes = 1000 + total_services = 200 + total_route_ports = -1 +} + +# Federalist/ Pages + +resource "cloudfoundry_space_quota" "tiny" { + name = "tiny-tf-managed" + allow_paid_service_plans = true + total_memory = 1024 + total_routes = -1 + total_services = -1 + total_route_ports = -1 + org = data.cloudfoundry_org.gsa-18f-federalist.id +} diff --git a/terraform/stack/spaces.tf b/terraform/stack/spaces.tf new file mode 100644 index 00000000..ed2b8be4 --- /dev/null +++ b/terraform/stack/spaces.tf @@ -0,0 +1,113 @@ +resource "cloudfoundry_space" "services" { + name = "services" + org = cloudfoundry_org.cloud-gov.id + asgs = [ + cloudfoundry_asg.public_networks.id, + cloudfoundry_asg.trusted_local_networks.id, + cloudfoundry_asg.dns.id, + cloudfoundry_asg.brokers.id, + cloudfoundry_asg.smtp.id, + ] + staging_asgs = [ + cloudfoundry_asg.trusted_local_networks.id, + cloudfoundry_asg.public_networks.id, + cloudfoundry_asg.dns.id, + ] + isolation_segment = cloudfoundry_isolation_segment.platform.id +} + +resource "cloudfoundry_space" "dashboard" { + name = "dashboard" + org = cloudfoundry_org.cloud-gov.id + asgs = [ + cloudfoundry_asg.trusted_local_networks.id, + cloudfoundry_asg.public_networks.id, + cloudfoundry_asg.dns.id, + cloudfoundry_asg.smtp.id, + ] + staging_asgs = [ + cloudfoundry_asg.trusted_local_networks.id, + cloudfoundry_asg.public_networks.id, + cloudfoundry_asg.dns.id, + ] +} + +resource "cloudfoundry_space" "cg-ui" { + name = "cg-ui" + org = cloudfoundry_org.cloud-gov.id + asgs = [ + cloudfoundry_asg.trusted_local_networks.id, + cloudfoundry_asg.public_networks.id, + cloudfoundry_asg.dns.id, + cloudfoundry_asg.smtp.id, + ] + staging_asgs = [ + cloudfoundry_asg.trusted_local_networks.id, + cloudfoundry_asg.public_networks.id, + cloudfoundry_asg.dns.id, + ] +} + +resource "cloudfoundry_space" "uaa-extras" { + name = "uaa-extras" + org = cloudfoundry_org.cloud-gov.id + asgs = [ + cloudfoundry_asg.trusted_local_networks.id, + cloudfoundry_asg.public_networks.id, + cloudfoundry_asg.dns.id, + cloudfoundry_asg.smtp.id, + ] + staging_asgs = [ + cloudfoundry_asg.trusted_local_networks.id, + cloudfoundry_asg.public_networks.id, + cloudfoundry_asg.dns.id, + ] +} + +resource "cloudfoundry_space" "cspr-collector" { + name = "cspr-collector" + org = cloudfoundry_org.cloud-gov.id + asgs = [ + cloudfoundry_asg.trusted_local_networks.id, + cloudfoundry_asg.public_networks.id, + cloudfoundry_asg.dns.id, + cloudfoundry_asg.smtp.id, + ] + staging_asgs = [ + cloudfoundry_asg.trusted_local_networks.id, + cloudfoundry_asg.public_networks.id, + cloudfoundry_asg.dns.id, + ] +} + +resource "cloudfoundry_space" "opensearch-dashboards-proxy" { + name = "opensearch-dashboards-proxy" + org = cloudfoundry_org.cloud-gov.id + asgs = [ + cloudfoundry_asg.public_networks_egress.id, + cloudfoundry_asg.dns.id, + ] + staging_asgs = [ + cloudfoundry_asg.dns.id, + ] +} + +# Federalist/ Pages + +resource "cloudfoundry_space" "email" { + name = "email" + org = data.cloudfoundry_org.gsa-18f-federalist.id + quota = cloudfoundry_space_quota.tiny.id + asgs = [ + cloudfoundry_asg.public_networks.id, + cloudfoundry_asg.trusted_local_networks.id, + cloudfoundry_asg.public_networks.id, + cloudfoundry_asg.dns.id, + cloudfoundry_asg.smtp.id, + ] + staging_asgs = [ + cloudfoundry_asg.trusted_local_networks.id, + cloudfoundry_asg.public_networks.id, + cloudfoundry_asg.dns.id, + ] +} From e1671d5084e7d013ff7bb990b387041762d280e6 Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 8 Jul 2024 15:41:03 -0400 Subject: [PATCH 2/3] add space for external domain broker tests --- terraform/stack/spaces.tf | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/terraform/stack/spaces.tf b/terraform/stack/spaces.tf index ed2b8be4..5c1289d8 100644 --- a/terraform/stack/spaces.tf +++ b/terraform/stack/spaces.tf @@ -92,6 +92,19 @@ resource "cloudfoundry_space" "opensearch-dashboards-proxy" { ] } +resource "cloudfoundry_space" "external_domain_broker_tests" { + name = "external-domain-broker-tests" + org = cloudfoundry_org.cloud-gov.id + asgs = [ + cloudfoundry_asg.public_networks.id, + cloudfoundry_asg.dns.id, + ] + staging_asgs = [ + cloudfoundry_asg.public_networks.id, + cloudfoundry_asg.dns.id, + ] +} + # Federalist/ Pages resource "cloudfoundry_space" "email" { From 78a2e1191033dc8c3f0f391a7ebf7690f2c6d302 Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 8 Jul 2024 15:48:32 -0400 Subject: [PATCH 3/3] add new org for acceptance tests --- terraform/stack/orgs.tf | 5 +++++ terraform/stack/spaces.tf | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/terraform/stack/orgs.tf b/terraform/stack/orgs.tf index bb22b90e..f5c166f7 100644 --- a/terraform/stack/orgs.tf +++ b/terraform/stack/orgs.tf @@ -3,6 +3,11 @@ resource "cloudfoundry_org" "cloud-gov" { quota = cloudfoundry_org_quota.default-tts.id } +resource "cloudfoundry_org" "acceptance_tests" { + name = "cloud-gov-acceptance-tests" + quota = cloudfoundry_org_quota.default-tts.id +} + # Federalist/Pages data "cloudfoundry_org" "gsa-18f-federalist" { diff --git a/terraform/stack/spaces.tf b/terraform/stack/spaces.tf index 5c1289d8..a43b7287 100644 --- a/terraform/stack/spaces.tf +++ b/terraform/stack/spaces.tf @@ -94,7 +94,7 @@ resource "cloudfoundry_space" "opensearch-dashboards-proxy" { resource "cloudfoundry_space" "external_domain_broker_tests" { name = "external-domain-broker-tests" - org = cloudfoundry_org.cloud-gov.id + org = cloudfoundry_org.acceptance_tests.id asgs = [ cloudfoundry_asg.public_networks.id, cloudfoundry_asg.dns.id,