From 3b9d896b9fdfef512ae424cf5a6cf6a73f3c1480 Mon Sep 17 00:00:00 2001 From: toddgiguere <83610458+toddgiguere@users.noreply.github.com> Date: Wed, 18 Sep 2024 04:48:58 -0400 Subject: [PATCH] feat: added new input `ignore_vpcs_for_cluster_deployment` to the OCP standard DA to allow you to specify a VPC that you do not wish to create a cluster in. By default a cluster will be created in all of the VPCs specified in the `vpcs` input. (#881) --- patterns/roks/main.tf | 1 + patterns/roks/module/config.tf | 5 ++++- patterns/roks/module/variables.tf | 7 +++++++ patterns/roks/variables.tf | 7 +++++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/patterns/roks/main.tf b/patterns/roks/main.tf index 0399f6f2..eba03ac3 100644 --- a/patterns/roks/main.tf +++ b/patterns/roks/main.tf @@ -27,6 +27,7 @@ module "roks_landing_zone" { wait_till = var.wait_till network_cidr = var.network_cidr vpcs = var.vpcs + ignore_vpcs_for_cluster_deployment = var.ignore_vpcs_for_cluster_deployment enable_transit_gateway = var.enable_transit_gateway transit_gateway_global = var.transit_gateway_global ssh_public_key = var.ssh_public_key diff --git a/patterns/roks/module/config.tf b/patterns/roks/module/config.tf index 897a29d5..6f436d5a 100644 --- a/patterns/roks/module/config.tf +++ b/patterns/roks/module/config.tf @@ -68,6 +68,9 @@ locals { # Dynamic configuration for landing zone environment ############################################################################## + # create cluster vpc list by subtracting names from supplied ignore list + cluster_vpcs = setsubtract(var.vpcs, var.ignore_vpcs_for_cluster_deployment) + config = { ############################################################################## @@ -75,7 +78,7 @@ locals { ############################################################################## clusters = [ # Dynamically create identical cluster in each VPC - for network in var.vpcs : + for network in local.cluster_vpcs : { name = "${network}-cluster" vpc_name = network diff --git a/patterns/roks/module/variables.tf b/patterns/roks/module/variables.tf index 89cb73e9..f7da01a4 100644 --- a/patterns/roks/module/variables.tf +++ b/patterns/roks/module/variables.tf @@ -50,6 +50,13 @@ variable "vpcs" { } } +variable "ignore_vpcs_for_cluster_deployment" { + description = "List of VPCs from input `vpcs` that should be ignored when deploying OpenShift clusters. If empty then a cluster will be deployed in all VPCs specified in input `vpcs`." + type = list(string) + default = [] + nullable = false +} + variable "enable_transit_gateway" { description = "Create transit gateway" type = bool diff --git a/patterns/roks/variables.tf b/patterns/roks/variables.tf index ed38efa1..1a4a4f77 100644 --- a/patterns/roks/variables.tf +++ b/patterns/roks/variables.tf @@ -56,6 +56,13 @@ variable "vpcs" { } } +variable "ignore_vpcs_for_cluster_deployment" { + description = "List of VPCs from input `vpcs` that should be ignored when deploying OpenShift clusters. If empty then a cluster will be deployed in all VPCs specified in input `vpcs`." + type = list(string) + default = [] + nullable = false +} + variable "enable_transit_gateway" { description = "Create transit gateway" type = bool