diff --git a/.github/settings.yml b/.github/settings.yml index fbbda70..279afe7 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -22,7 +22,7 @@ repository: # Uncomment this description property # and update the description to the current repo description. - description: "This module installs a WebSphere® Liberty operator and create an instance of WebSphere Liberty operator on IBM Cloud Red Hat OpenShift cluster on VPC Gen2." + description: "Installs a WebSphere Liberty operator on your Red Hat OpenShift Container Platform on VPC landing zone." # Use a comma-separated list of topics to set on the repo (ensure not to use any caps in the topic string). - topics: terraform, ibm-cloud, terraform-module + topics: terraform, ibm-cloud, terraform-module, websphere-liberty-operator diff --git a/README.md b/README.md index a3ac53c..90ffc11 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# WebSphere Liberty operator on Red Hat OpenShift VPC cluster module +# WebSphere Liberty on Red Hat OpenShift Container Platform module -Use this module to install a WebSphere® Liberty operator and create an instance of WebSphere Liberty operator on IBM Cloud Red Hat OpenShift cluster on VPC Gen2. +Use this module to install a WebSphere Liberty operator on your Red Hat OpenShift Container Platform on VPC landing zone. -For more information about the WebSphere Liberty operator refer to the official documentation avaiable [here](https://www.ibm.com/docs/en/was-liberty/core?topic=container-running-websphere-liberty-operator) +For more information about the IBM WebSphere Liberty operator refer to the official documentation avaiable [here](https://www.ibm.com/docs/en/was-liberty/core?topic=container-running-websphere-liberty-operator) ## Overview * [terraform-ibm-websphere-liberty-operator](#terraform-ibm-websphere-liberty-operator) * [Examples](./examples) - * [Complete example](./examples/complete) + * [Complete example for Websphere Liberty operator](./examples/complete) * [Contributing](#contributing) @@ -122,26 +122,24 @@ No modules. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [add\_ibm\_operator\_catalog](#input\_add\_ibm\_operator\_catalog) | Flag to configure the IBM Operator Catalog in the cluster before installing the WebSphere Liberty Operator. Default is true | `bool` | `true` | no | +| [add\_ibm\_operator\_catalog](#input\_add\_ibm\_operator\_catalog) | Whether to configure the IBM Operator Catalog in the cluster before the IBM WebSphere Liberty operator is installed. Default is `true`. | `bool` | `true` | no | | [cluster\_config\_endpoint\_type](#input\_cluster\_config\_endpoint\_type) | Specify which type of endpoint to use for for cluster config access: 'default', 'private', 'vpe', 'link'. 'default' value will use the default endpoint of the cluster. | `string` | `"default"` | no | -| [cluster\_id](#input\_cluster\_id) | Id of the target IBM Cloud OpenShift Cluster | `string` | n/a | yes | -| [create\_ws\_liberty\_operator\_namespace](#input\_create\_ws\_liberty\_operator\_namespace) | Flag to create the namespace where to deploy the WebSphere Liberty Operator. Default to false | `bool` | `false` | no | -| [ibmcloud\_api\_key](#input\_ibmcloud\_api\_key) | APIkey that's associated with the account to use | `string` | `null` | no | -| [install\_wslo\_sampleapp](#input\_install\_wslo\_sampleapp) | Flag to deploy the WebSphere Liberty sample application. Default to false | `bool` | `false` | no | -| [operator\_helm\_release\_namespace](#input\_operator\_helm\_release\_namespace) | Namespace to deploy the helm releases. Default to liberty-operator-helm-release | `string` | `"liberty-operator"` | no | -| [region](#input\_region) | Cluster region | `string` | n/a | yes | -| [ws\_liberty\_operator\_namespace](#input\_ws\_liberty\_operator\_namespace) | Namespace to install the WebSphere Liberty Operator. Default to openshift-operators | `string` | `"openshift-operators"` | no | -| [ws\_liberty\_operator\_target\_namespace](#input\_ws\_liberty\_operator\_target\_namespace) | Namespace to be watched by the WebSphere Liberty Operator. Default to null (operator to watch all namespaces) | `string` | `null` | no | -| [wslo\_sampleapp\_name](#input\_wslo\_sampleapp\_name) | Application name to use for the WebSphere Liberty sample application | `string` | `"websphereliberty-app-sample"` | no | -| [wslo\_sampleapp\_namespace](#input\_wslo\_sampleapp\_namespace) | Namespace to deploy the WebSphere Liberty sample application | `string` | `"samplelibertyapp"` | no | +| [cluster\_id](#input\_cluster\_id) | Id of the target IBM Cloud OpenShift Cluster. | `string` | n/a | yes | +| [create\_ws\_liberty\_operator\_namespace](#input\_create\_ws\_liberty\_operator\_namespace) | Whether to create the namespace where the IBM WebSphere Liberty operator is deployed. Default is `false`. | `bool` | `false` | no | +| [install\_wslo\_sampleapp](#input\_install\_wslo\_sampleapp) | Whether to deploy the WebSphere Application Server Liberty sample application. Default is `false`. | `bool` | `false` | no | +| [operator\_helm\_release\_namespace](#input\_operator\_helm\_release\_namespace) | Namespace to deploy the helm releases. Default to liberty-operator-helm-release. | `string` | `"liberty-operator"` | no | +| [ws\_liberty\_operator\_namespace](#input\_ws\_liberty\_operator\_namespace) | Namespace where the IBM WebSphere Liberty operator is deployed. Default is `openshift-operators`. | `string` | `"openshift-operators"` | no | +| [ws\_liberty\_operator\_target\_namespace](#input\_ws\_liberty\_operator\_target\_namespace) | Namespace that the the IBM WebSphere Liberty operator watches. Default is `null`, which means that the operator watches all the namespaces. | `string` | `null` | no | +| [wslo\_sampleapp\_name](#input\_wslo\_sampleapp\_name) | Application name to use for the WebSphere Application Server Liberty sample application. | `string` | `"websphereliberty-app-sample"` | no | +| [wslo\_sampleapp\_namespace](#input\_wslo\_sampleapp\_namespace) | Namespace where the WebSphere Application Server Liberty sample application is deployed. | `string` | `"samplelibertyapp"` | no | ### Outputs | Name | Description | |------|-------------| -| [websphere\_liberty\_operator\_sampleapp\_url](#output\_websphere\_liberty\_operator\_sampleapp\_url) | WebSphere Liberty sample application URL | -| [ws\_liberty\_operator\_namespace](#output\_ws\_liberty\_operator\_namespace) | Namespace where the WebSphere Liberty operator is installed | -| [ws\_liberty\_operator\_target\_namespace](#output\_ws\_liberty\_operator\_target\_namespace) | Namespace watched by the WebSphere Liberty operator | +| [websphere\_liberty\_operator\_sampleapp\_url](#output\_websphere\_liberty\_operator\_sampleapp\_url) | WebSphere Application Server Liberty sample application URL. | +| [ws\_liberty\_operator\_namespace](#output\_ws\_liberty\_operator\_namespace) | Namespace where the IBM WebSphere Liberty operator is installed. | +| [ws\_liberty\_operator\_target\_namespace](#output\_ws\_liberty\_operator\_target\_namespace) | Namespace watched by the IBM WebSphere Liberty operator. | diff --git a/chart/ibm-operator-catalog/Chart.yaml b/chart/ibm-operator-catalog/Chart.yaml index 2ec4e9e..a3fa4eb 100644 --- a/chart/ibm-operator-catalog/Chart.yaml +++ b/chart/ibm-operator-catalog/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: ibm-websphere-liberty-operator -description: A Helm chart to configure the Operator Catalog source for the IBM operator catalog +description: A Helm chart to configure the IBM Operator Catalog source type: application # This is the chart version. This version number should be incremented each time you make changes diff --git a/examples/complete/README.md b/examples/complete/README.md index 2efdcfa..a5fda1f 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -1,7 +1,7 @@ -# Complete example +# Complete example for Websphere Liberty operator -An end-to-end complete example that will provision the following: -- A new resource group if one is not passed in. -- A new VPC with 3 subnets and a new OpenShift cluster in the VPC with 3 workers pools -- The IBM WebSphere Liberty operator in the default operator namespace -- The IBM WebSphere Liberty sample app +An end-to-end complete example that provisions the following resources: +- A new resource group, if one is not passed in. +- A new VPC with two subnets and a new OpenShift cluster in the VPC with one worker pool. +- The IBM WebSphere Liberty operator in the default operator namespace. +- The IBM WebSphere Liberty sample app. diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 1f55436..98f3764 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -23,7 +23,7 @@ resource "ibm_is_vpc" "vpc" { # public gws resource "ibm_is_public_gateway" "gateway" { - for_each = toset(["1", "2", "3"]) + for_each = toset(["1", "2"]) name = "${var.prefix}-gateway-${each.key}" vpc = ibm_is_vpc.vpc.id resource_group = module.resource_group.resource_group_id @@ -32,7 +32,7 @@ resource "ibm_is_public_gateway" "gateway" { resource "ibm_is_subnet" "cluster_subnets" { - for_each = toset(["1", "2", "3"]) + for_each = toset(["1", "2"]) name = "${var.prefix}-subnet-${each.key}" vpc = ibm_is_vpc.vpc.id resource_group = module.resource_group.resource_group_id @@ -58,32 +58,16 @@ locals { # mapping of cluster worker pool names to subnets cluster_vpc_subnets = { - zone-1 = local.subnets, - zone-2 = local.subnets, - zone-3 = local.subnets + zone-1 = local.subnets } worker_pools = [ { subnet_prefix = "zone-1" - pool_name = "default" # ibm_container_vpc_cluster automatically names default pool "default" (See https://github.com/IBM-Cloud/terraform-provider-ibm/issues/2849) + pool_name = "default" machine_type = "bx2.4x16" workers_per_zone = 1 labels = {} - }, - { - subnet_prefix = "zone-2" - pool_name = "zone-2" - machine_type = "bx2.4x16" - workers_per_zone = 1 - labels = { "dedicated" : "edge" } - }, - { - subnet_prefix = "zone-3" - pool_name = "zone-3" - machine_type = "bx2.4x16" - workers_per_zone = 1 - labels = { "dedicated" : "transit" } } ] } @@ -112,9 +96,7 @@ module "ocp_base" { module "websphere_liberty_operator" { source = "../.." - region = var.region cluster_id = module.ocp_base.cluster_id create_ws_liberty_operator_namespace = false install_wslo_sampleapp = true - ibmcloud_api_key = var.ibmcloud_api_key } diff --git a/examples/complete/outputs.tf b/examples/complete/outputs.tf index 526e37f..c312731 100644 --- a/examples/complete/outputs.tf +++ b/examples/complete/outputs.tf @@ -3,16 +3,16 @@ ######################################################################################################################## output "resource_group_name" { - description = "Resource group name" + description = "Resource group name." value = module.resource_group.resource_group_name } output "cluster_id" { - description = "Cluster ID" + description = "Cluster ID." value = module.ocp_base.cluster_id } output "websphere_liberty_sampleapp_url" { - description = "Url of the IBM WebSphere Liberty sample application" + description = "URL of the IBM WebSphere Liberty sample application." value = module.websphere_liberty_operator.websphere_liberty_operator_sampleapp_url } diff --git a/extensions/landing-zone/README.md b/extensions/landing-zone/README.md index 221c490..015c4d6 100644 --- a/extensions/landing-zone/README.md +++ b/extensions/landing-zone/README.md @@ -1,3 +1,3 @@ -### # Client-To-Site VPN extension for landing zone +### WebSphere Liberty operator extension for landing zone Tutorial: TBD diff --git a/extensions/landing-zone/kubeconfig/.gitignore b/extensions/landing-zone/kubeconfig/.gitignore new file mode 100644 index 0000000..632a28f --- /dev/null +++ b/extensions/landing-zone/kubeconfig/.gitignore @@ -0,0 +1,6 @@ +# Ignore everything +* + +# But not these files... +!.gitignore +!README.md diff --git a/extensions/landing-zone/kubeconfig/README.md b/extensions/landing-zone/kubeconfig/README.md new file mode 100644 index 0000000..e85afee --- /dev/null +++ b/extensions/landing-zone/kubeconfig/README.md @@ -0,0 +1,2 @@ +This directory must exist in source control so the `ibm_container_cluster_config` data lookup can use it to place the +config.yml used to connect to a kubernetes cluster. diff --git a/extensions/landing-zone/main.tf b/extensions/landing-zone/main.tf index 5294cd0..84b9788 100644 --- a/extensions/landing-zone/main.tf +++ b/extensions/landing-zone/main.tf @@ -4,14 +4,12 @@ data "ibm_container_cluster_config" "cluster_config" { cluster_name_id = var.cluster_id - # config_dir = "../../kubeconfig" - endpoint_type = var.cluster_config_endpoint_type != "default" ? var.cluster_config_endpoint_type : null # null represents default + config_dir = "${path.module}/kubeconfig" + endpoint_type = var.cluster_config_endpoint_type != "default" ? var.cluster_config_endpoint_type : null # null represents default } module "websphere_liberty_operator" { source = "../.." - ibmcloud_api_key = var.ibmcloud_api_key - region = var.region cluster_id = var.cluster_id add_ibm_operator_catalog = var.add_ibm_operator_catalog create_ws_liberty_operator_namespace = var.create_ws_liberty_operator_namespace @@ -23,3 +21,7 @@ module "websphere_liberty_operator" { wslo_sampleapp_namespace = var.wslo_sampleapp_namespace operator_helm_release_namespace = var.operator_helm_release_namespace } + +locals { + websphere_liberty_operator_sampleapp_url = var.install_wslo_sampleapp == true ? "https://${module.websphere_liberty_operator.websphere_liberty_operator_sampleapp_url}" : null +} diff --git a/extensions/landing-zone/outputs.tf b/extensions/landing-zone/outputs.tf index a75f2bd..7f8a919 100644 --- a/extensions/landing-zone/outputs.tf +++ b/extensions/landing-zone/outputs.tf @@ -2,7 +2,17 @@ # Outputs ######################################################################################################################## -output "websphere_liberty_operator" { - description = "Resource group name" - value = module.websphere_liberty_operator +output "websphere_liberty_operator_deployment_namespace" { + description = "Namespace where the IBM WebSphere Liberty operator is installed." + value = module.websphere_liberty_operator.ws_liberty_operator_namespace +} + +output "websphere_liberty_operator_deployment_target_namespace" { + description = "Namespace watched by the IBM WebSphere Liberty operator." + value = module.websphere_liberty_operator.ws_liberty_operator_target_namespace +} + +output "websphere_liberty_operator_sample_app_url" { + description = "URL of the IBM WebSphere Liberty operator sample app if deployed." + value = local.websphere_liberty_operator_sampleapp_url } diff --git a/extensions/landing-zone/variables.tf b/extensions/landing-zone/variables.tf index ece0cce..e0e910a 100644 --- a/extensions/landing-zone/variables.tf +++ b/extensions/landing-zone/variables.tf @@ -1,48 +1,48 @@ variable "ibmcloud_api_key" { type = string - description = "APIkey associated with the account to use" + description = "APIkey associated with the account to use." sensitive = true } variable "region" { type = string - description = "Region to provision all resources created by this solution" - default = "au-syd" + description = "Region where the target IBM Cloud OpenShift Cluster is deployed." + nullable = false } variable "cluster_id" { type = string - description = "Id of the target IBM Cloud OpenShift Cluster" + description = "Id of the target IBM Cloud OpenShift Cluster." nullable = false } variable "operator_helm_release_namespace" { type = string - description = "Namespace to deploy the helm releases. Default to liberty-operator-helm-release" + description = "Namespace to deploy the helm releases. Default to liberty-operator-helm-release." default = "liberty-operator-helm-release" } variable "add_ibm_operator_catalog" { type = bool - description = "Flag to configure the IBM Operator Catalog in the cluster before installing the WebSphere Liberty Operator. Default is true" + description = "Flag to configure the IBM Operator Catalog in the cluster before installing the WebSphere Liberty Operator. Default is true." default = true } variable "create_ws_liberty_operator_namespace" { type = bool - description = "Flag to create the namespace where to deploy the WebSphere Liberty Operator. Default to false" + description = "Flag to create the namespace where to deploy the WebSphere Liberty Operator. Default to false." default = false } variable "ws_liberty_operator_namespace" { type = string - description = "Namespace to install the WebSphere Liberty Operator. Default to openshift-operators" + description = "Namespace to install the IBM WebSphere Liberty operator. Default to openshift-operators." default = "openshift-operators" } variable "ws_liberty_operator_target_namespace" { type = string - description = "Namespace to be watched by the WebSphere Liberty Operator. Default to null (operator to watch all namespaces)" + description = "Namespace that the IBM WebSphere Liberty operator watches. Default is `null`, which means that the operator watches all the namespaces." default = null } @@ -58,19 +58,19 @@ variable "cluster_config_endpoint_type" { } variable "install_wslo_sampleapp" { - description = "Flag to deploy the WebSphere Liberty sample application. Default to false" + description = "Whether to deploy the WebSphere Application Server Liberty sample application. Default is `true`." type = bool - default = false + default = true } variable "wslo_sampleapp_name" { - description = "Application name to use for the WebSphere Liberty sample application" + description = "Application name to use for the WebSphere Application Server Liberty sample application." type = string default = "websphereliberty-app-sample" } variable "wslo_sampleapp_namespace" { - description = "Namespace to deploy the WebSphere Liberty sample application" + description = "Namespace where the WebSphere Application Server Liberty sample application is deployed." type = string default = "samplelibertyapp" } diff --git a/kubeconfig/README.md b/kubeconfig/README.md index dff9dd4..e85afee 100644 --- a/kubeconfig/README.md +++ b/kubeconfig/README.md @@ -1,2 +1,2 @@ This directory must exist in source control so the `ibm_container_cluster_config` data lookup can use it to place the -config.yml used to connect to a kubernetes cluster (See https://github.ibm.com/GoldenEye/issues/issues/552). +config.yml used to connect to a kubernetes cluster. diff --git a/main.tf b/main.tf index 444948f..9d48957 100644 --- a/main.tf +++ b/main.tf @@ -2,7 +2,7 @@ locals { # sleep times definition sleep_time_catalog_create = "60s" sleep_time_operator_create = "120s" - sleep_time_sampleapp_create = "30s" + sleep_time_sampleapp_create = "60s" # time to wait for the sampleapp route to be defined # helm chart names ibm_operator_catalog_chart = "ibm-operator-catalog" @@ -57,12 +57,10 @@ resource "helm_release" "ibm_operator_catalog" { namespace = var.operator_helm_release_namespace create_namespace = false timeout = 300 - # dependency_update = true - # force_update = false - force_update = true - cleanup_on_fail = false - wait = true - recreate_pods = true + force_update = true + cleanup_on_fail = false + wait = true + recreate_pods = true disable_openapi_validation = false @@ -96,12 +94,10 @@ resource "helm_release" "websphere_liberty_operator_group" { namespace = var.operator_helm_release_namespace create_namespace = false timeout = 300 - # dependency_update = true - force_update = true - # force_update = false - cleanup_on_fail = false - wait = true - recreate_pods = true + force_update = true + cleanup_on_fail = false + wait = true + recreate_pods = true disable_openapi_validation = false @@ -146,12 +142,10 @@ resource "helm_release" "websphere_liberty_operator" { namespace = var.operator_helm_release_namespace create_namespace = false timeout = 300 - # dependency_update = true - # force_update = false - force_update = true - cleanup_on_fail = false - wait = true - recreate_pods = true + force_update = true + cleanup_on_fail = false + wait = true + recreate_pods = true disable_openapi_validation = false @@ -227,12 +221,10 @@ resource "helm_release" "websphere_liberty_operator_sampleapp" { namespace = var.operator_helm_release_namespace create_namespace = false timeout = 300 - # dependency_update = true - # force_update = false - force_update = true - cleanup_on_fail = false - wait = true - recreate_pods = true + force_update = true + cleanup_on_fail = false + wait = true + recreate_pods = true disable_openapi_validation = false diff --git a/outputs.tf b/outputs.tf index 8325fa3..0deb5db 100644 --- a/outputs.tf +++ b/outputs.tf @@ -3,16 +3,16 @@ ######################################################################################################################## output "ws_liberty_operator_namespace" { - description = "Namespace where the WebSphere Liberty operator is installed" + description = "Namespace where the IBM WebSphere Liberty operator is installed." value = var.ws_liberty_operator_namespace } output "ws_liberty_operator_target_namespace" { - description = "Namespace watched by the WebSphere Liberty operator" + description = "Namespace watched by the IBM WebSphere Liberty operator." value = var.ws_liberty_operator_target_namespace } output "websphere_liberty_operator_sampleapp_url" { value = data.external.websphere_liberty_operator_sampleapp_url.result.sampleapp_url - description = "WebSphere Liberty sample application URL" + description = "WebSphere Application Server Liberty sample application URL." } diff --git a/provider.tf b/provider.tf deleted file mode 100644 index 494c945..0000000 --- a/provider.tf +++ /dev/null @@ -1,20 +0,0 @@ -############################################################################## -# Config providers -############################################################################## - -provider "ibm" { - ibmcloud_api_key = var.ibmcloud_api_key - region = var.region -} - -provider "helm" { - kubernetes { - host = data.ibm_container_cluster_config.cluster_config.host - token = data.ibm_container_cluster_config.cluster_config.token - } -} - -provider "kubernetes" { - host = data.ibm_container_cluster_config.cluster_config.host - token = data.ibm_container_cluster_config.cluster_config.token -} diff --git a/scripts/confirm-wsloperator-operational.sh b/scripts/confirm-wsloperator-operational.sh index ab3ab25..1f4d4be 100755 --- a/scripts/confirm-wsloperator-operational.sh +++ b/scripts/confirm-wsloperator-operational.sh @@ -31,7 +31,7 @@ if [ ${fail} == true ]; then kubectl describe CatalogSource ibm-operator-catalog -n openshift-marketplace echo echo "Describe output of ibm-websphere-liberty Subscription in ${namespace} namespace" - kubectl describe Subscription ibm-websphere-liberty -n "${namespace}" -o wide + kubectl describe Subscription ibm-websphere-liberty -n "${namespace}" echo echo "List of ${WSLO_DEPLOYMENT_NAME} deployments in ${namespace} namespace" kubectl get deployment "${WSLO_DEPLOYMENT_NAME}" -n "${namespace}" -o wide diff --git a/tests/other_test.go b/tests/other_test.go index b2cc9c2..2e59960 100644 --- a/tests/other_test.go +++ b/tests/other_test.go @@ -2,7 +2,6 @@ package test import ( - "github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testhelper" "testing" "github.com/stretchr/testify/assert" diff --git a/tests/pr_test.go b/tests/pr_test.go index 55f2d75..71ae4bd 100644 --- a/tests/pr_test.go +++ b/tests/pr_test.go @@ -3,10 +3,12 @@ package test import ( "fmt" - "github.com/stretchr/testify/require" "os" "strings" "testing" + "time" + + "github.com/stretchr/testify/require" "github.com/gruntwork-io/terratest/modules/files" "github.com/gruntwork-io/terratest/modules/logger" @@ -61,8 +63,16 @@ func TestRunSLZExample(t *testing.T) { require.True(t, present, checkVariable+" environment variable not set") require.NotEqual(t, "", val, checkVariable+" environment variable is empty") - // Programmatically determine region to use based on availability - region, _ := testhelper.GetBestVpcRegion(val, "../common-dev-assets/common-go-assets/cloudinfo-region-vpc-gen2-prefs.yaml", "eu-de") + // Verify region variable is set, otherwise it computes it + region := "" + checkRegion := "TF_VAR_region" + valRegion, presentRegion := os.LookupEnv(checkRegion) + if presentRegion { + region = valRegion + } else { + // Programmatically determine region to use based on availability + region, _ = testhelper.GetBestVpcRegion(val, "../common-dev-assets/common-go-assets/cloudinfo-region-vpc-gen2-prefs.yaml", "eu-de") + } logger.Log(t, "Tempdir: ", tempTerraformDir) existingTerraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ @@ -86,13 +96,17 @@ func TestRunSLZExample(t *testing.T) { // Deploy WAS extension // ------------------------------------------------------------------------------------ + rbacSynchSleepTime := 180 + logger.Log(t, fmt.Sprintf("Sleeping for %d seconds to allow RBAC to sync", rbacSynchSleepTime)) + time.Sleep(time.Duration(rbacSynchSleepTime) * time.Second) + options := testhelper.TestOptionsDefault(&testhelper.TestOptions{ Testing: t, TerraformDir: "extensions/landing-zone", // Do not hard fail the test if the implicit destroy steps fail to allow a full destroy of resource to occur ImplicitRequired: false, TerraformVars: map[string]interface{}{ - "cluster_id": terraform.Output(t, existingTerraformOptions, "management_cluster_id"), + "cluster_id": terraform.Output(t, existingTerraformOptions, "workload_cluster_id"), "region": terraform.Output(t, existingTerraformOptions, "region"), }, }) diff --git a/tests/resources/main.tf b/tests/resources/main.tf index b43b7c3..d85b714 100644 --- a/tests/resources/main.tf +++ b/tests/resources/main.tf @@ -193,17 +193,17 @@ module "landing_zone" { { "create": true, "name": "wlslz-service-rg", - "use_prefix": false + "use_prefix": true }, { "create": true, "name": "wlslz-management-rg", - "use_prefix": false + "use_prefix": true }, { "create": true, "name": "wlslz-workload-rg", - "use_prefix": false + "use_prefix": true } ], "secrets_manager": { diff --git a/tests/resources/outputs.tf b/tests/resources/outputs.tf index 962d522..88d6740 100644 --- a/tests/resources/outputs.tf +++ b/tests/resources/outputs.tf @@ -16,12 +16,12 @@ output "management_cluster_id" { value = lookup( [for cluster in module.landing_zone.cluster_data : cluster if strcontains(cluster.resource_group_name, "management")][0], "id", "" ) - description = "management cluster ID" + description = "management cluster ID." } output "workload_cluster_id" { value = lookup( [for cluster in module.landing_zone.cluster_data : cluster if strcontains(cluster.resource_group_name, "workload")][0], "id", "" ) - description = "workload cluster ID" + description = "workload cluster ID." } diff --git a/tests/resources/variables.tf b/tests/resources/variables.tf index 28441e1..8b38fc9 100644 --- a/tests/resources/variables.tf +++ b/tests/resources/variables.tf @@ -1,23 +1,23 @@ variable "ibmcloud_api_key" { type = string - description = "The IBM Cloud API Key" + description = "The IBM Cloud API Key." sensitive = true } variable "region" { type = string - description = "Region to provision all resources created by this example" + description = "Region to provision all resources created by this example." default = "us-south" } variable "prefix" { type = string - description = "Prefix to append to all resources created by this example" + description = "Prefix to append to all resources created by this example." default = "was-slz" } variable "resource_tags" { type = list(string) - description = "Optional list of tags to be added to created resources" + description = "Optional list of tags to be added to created resources." default = [] } diff --git a/variables.tf b/variables.tf index 89ea465..cd61bca 100644 --- a/variables.tf +++ b/variables.tf @@ -2,54 +2,41 @@ # Input Variables ############################################################################## -variable "ibmcloud_api_key" { - description = "APIkey that's associated with the account to use" - type = string - sensitive = true - default = null -} - -variable "region" { - description = "Cluster region" - type = string - nullable = false -} - variable "cluster_id" { type = string - description = "Id of the target IBM Cloud OpenShift Cluster" + description = "Id of the target IBM Cloud OpenShift Cluster." nullable = false } variable "operator_helm_release_namespace" { type = string - description = "Namespace to deploy the helm releases. Default to liberty-operator-helm-release" + description = "Namespace to deploy the helm releases. Default to liberty-operator-helm-release." default = "liberty-operator" nullable = false } variable "add_ibm_operator_catalog" { type = bool - description = "Flag to configure the IBM Operator Catalog in the cluster before installing the WebSphere Liberty Operator. Default is true" + description = "Whether to configure the IBM Operator Catalog in the cluster before the IBM WebSphere Liberty operator is installed. Default is `true`." default = true } variable "create_ws_liberty_operator_namespace" { type = bool - description = "Flag to create the namespace where to deploy the WebSphere Liberty Operator. Default to false" + description = "Whether to create the namespace where the IBM WebSphere Liberty operator is deployed. Default is `false`." default = false } variable "ws_liberty_operator_namespace" { type = string - description = "Namespace to install the WebSphere Liberty Operator. Default to openshift-operators" + description = "Namespace where the IBM WebSphere Liberty operator is deployed. Default is `openshift-operators`." default = "openshift-operators" nullable = false } variable "ws_liberty_operator_target_namespace" { type = string - description = "Namespace to be watched by the WebSphere Liberty Operator. Default to null (operator to watch all namespaces)" + description = "Namespace that the the IBM WebSphere Liberty operator watches. Default is `null`, which means that the operator watches all the namespaces." default = null } @@ -65,20 +52,20 @@ variable "cluster_config_endpoint_type" { } variable "install_wslo_sampleapp" { - description = "Flag to deploy the WebSphere Liberty sample application. Default to false" + description = "Whether to deploy the WebSphere Application Server Liberty sample application. Default is `false`." type = bool default = false nullable = false } variable "wslo_sampleapp_name" { - description = "Application name to use for the WebSphere Liberty sample application" + description = "Application name to use for the WebSphere Application Server Liberty sample application." type = string default = "websphereliberty-app-sample" } variable "wslo_sampleapp_namespace" { - description = "Namespace to deploy the WebSphere Liberty sample application" + description = "Namespace where the WebSphere Application Server Liberty sample application is deployed." type = string default = "samplelibertyapp" }