terraform-ibm-modules/terraform-ibm-mas

Update tests to use SLZ roks module with override json

Closed this issue · 2 comments

In #56 terraform code was added in tests/resources to create an OCP cluster which is used by the PR tests. The code is using the IBM provider directly to provision the cluster, when really we should be using the secure landing zone OCP module with the override json file that will be documented for customers.

Actions:

  • Update the code in tests/resources to use SLZ. EG:
module "landing_zone" {
  source                 = "git::https://github.com/terraform-ibm-modules/terraform-ibm-landing-zone//patterns//roks//module?ref=v5.21.0"
  region                 = var.region
  prefix                 = var.prefix
  tags                   = var.resource_tags
  enable_transit_gateway = false
  add_atracker_route     = false
  override = true

(NOTE: override = true above means it will use the override details from a file called override.json, so you need to add that into the directory)

  • The outputs.tf in this directory will also need to be updated to parse the cluster ID. EG:
output "cluster_id" {
  value = lookup(
    [for cluster in module.landing_zone.cluster_data : cluster if strcontains(cluster.resource_group_name, "management")][0], "id", ""
  )
  description = "cluster ID"
}

In #56 I have updated the test to deploy the roks landing zone however I used override_json_string variable and manually added some json to deploy a single pubic cluster.
Ideally whatever override.json file is added to the docs, this test should use directly (using override = true instead of the override_json_string variable)

This issue is fixed & merged in main branch..Hence closing it..will add a symbolic link in github repo to the override.json file used. Will add the link to it in our documentation..