From df1b98af8637ecf837e7d32cc96ae39b8da835be Mon Sep 17 00:00:00 2001 From: Valerio Bontempi Date: Fri, 28 Jun 2024 20:16:21 +0200 Subject: [PATCH] test: Fixed advanced example to handle ingress check (#469) * fix: fixed advanced example to handle ingress check SKIP UPGRADE TEST * fix: fixed gateways --- examples/advanced/README.md | 2 +- examples/advanced/main.tf | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/advanced/README.md b/examples/advanced/README.md index a5096db1..0b770bfb 100644 --- a/examples/advanced/README.md +++ b/examples/advanced/README.md @@ -6,7 +6,7 @@ The following resources are provisioned by this example: - A new resource group, if an existing one is not passed in. - A Key Protect instance with 2 root keys, one for cluster encryption, and one for worker block storage encryption. - A VPC with subnets across 3 zones. -- A public gateway only in zone-1. +- A public gateway for all the three zones - A multi-zone (3 zone) KMS encrypted OCP VPC cluster, with worker pools in each zone. - Auto scaling enabled for the default worker pool. - Taints against the workers in zone-2 and zone-3. diff --git a/examples/advanced/main.tf b/examples/advanced/main.tf index 0a506958..bc4ea05d 100644 --- a/examples/advanced/main.tf +++ b/examples/advanced/main.tf @@ -56,14 +56,16 @@ resource "ibm_is_vpc" "vpc" { ######################################################################################################################## resource "ibm_is_public_gateway" "gateway" { - name = "${var.prefix}-gateway-1" + for_each = toset(["1", "2", "3"]) + name = "${var.prefix}-gateway-${each.key}" vpc = ibm_is_vpc.vpc.id resource_group = module.resource_group.resource_group_id - zone = "${var.region}-1" + zone = "${var.region}-${each.key}" } ######################################################################################################################## -# Subnets accross 3 zones (pub gw only attached to zone-1) +# Subnets accross 3 zones +# Public gateway attached to all the zones ######################################################################################################################## resource "ibm_is_subnet" "subnets" { @@ -73,8 +75,7 @@ resource "ibm_is_subnet" "subnets" { resource_group = module.resource_group.resource_group_id zone = "${var.region}-${each.key}" total_ipv4_address_count = 256 - # for this example, gateway only goes on zone-1 - public_gateway = (each.key == "1") ? ibm_is_public_gateway.gateway.id : null + public_gateway = ibm_is_public_gateway.gateway[each.key].id } ########################################################################################################################