diff --git a/cra-config.yaml b/cra-config.yaml index 1c95429a..ccac19fc 100644 --- a/cra-config.yaml +++ b/cra-config.yaml @@ -7,3 +7,4 @@ CRA_TARGETS: CRA_ENVIRONMENT_VARIABLES: TF_VAR_resource_group_name: "test" TF_VAR_existing_kms_instance_crn: "crn:v1:bluemix:public:hs-crypto:us-south:a/abac0df06b644a9cabc6e44f55b3880e:e6dce284-e80f-46e1-a3c1-830f7adff7a9::" + TF_VAR_provider_visibility: "public" diff --git a/ibm_catalog.json b/ibm_catalog.json index 289ac351..3146b889 100644 --- a/ibm_catalog.json +++ b/ibm_catalog.json @@ -106,6 +106,23 @@ { "key": "ibmcloud_api_key" }, + { + "key": "provider_visibility", + "options": [ + { + "displayname": "private", + "value": "private" + }, + { + "displayname": "public", + "value": "public" + }, + { + "displayname": "public-and-private", + "value": "public-and-private" + } + ] + }, { "key": "prefix" }, @@ -506,6 +523,23 @@ { "key": "ibmcloud_api_key" }, + { + "key": "provider_visibility", + "options": [ + { + "displayname": "private", + "value": "private" + }, + { + "displayname": "public", + "value": "public" + }, + { + "displayname": "public-and-private", + "value": "public-and-private" + } + ] + }, { "key": "prefix" }, diff --git a/solutions/agents/provider.tf b/solutions/agents/provider.tf index 769107c2..a09823a0 100644 --- a/solutions/agents/provider.tf +++ b/solutions/agents/provider.tf @@ -1,5 +1,6 @@ provider "ibm" { ibmcloud_api_key = var.ibmcloud_api_key + visibility = var.provider_visibility } provider "kubernetes" { diff --git a/solutions/agents/variables.tf b/solutions/agents/variables.tf index b723e779..dd6db963 100644 --- a/solutions/agents/variables.tf +++ b/solutions/agents/variables.tf @@ -9,7 +9,16 @@ variable "prefix" { description = "The prefix for resources created by this solution." default = null } +variable "provider_visibility" { + description = "Set the visibility value for the IBM terraform provider. Supported values are `public`, `private`, `public-and-private`. [Learn more](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/guides/custom-service-endpoints)." + type = string + default = "private" + validation { + condition = contains(["public", "private", "public-and-private"], var.provider_visibility) + error_message = "Invalid visibility option. Allowed values are 'public', 'private', or 'public-and-private'." + } +} ############################################################################## # Cluster variables ############################################################################## diff --git a/solutions/instances/provider.tf b/solutions/instances/provider.tf index a940eb9d..817e08a7 100644 --- a/solutions/instances/provider.tf +++ b/solutions/instances/provider.tf @@ -5,12 +5,14 @@ provider "ibm" { ibmcloud_api_key = var.ibmcloud_api_key region = var.region + visibility = var.provider_visibility } provider "ibm" { alias = "cos" ibmcloud_api_key = var.ibmcloud_cos_api_key != null ? var.ibmcloud_cos_api_key : var.ibmcloud_api_key region = local.default_cos_region + visibility = var.provider_visibility } @@ -18,4 +20,5 @@ provider "ibm" { alias = "kms" ibmcloud_api_key = var.ibmcloud_kms_api_key != null ? var.ibmcloud_kms_api_key : var.ibmcloud_api_key region = local.kms_region + visibility = var.provider_visibility } diff --git a/solutions/instances/variables.tf b/solutions/instances/variables.tf index 40b1bb4b..a79002f4 100644 --- a/solutions/instances/variables.tf +++ b/solutions/instances/variables.tf @@ -50,7 +50,16 @@ variable "prefix" { description = "The prefix to add to all resources that this solution creates." default = null } +variable "provider_visibility" { + description = "Set the visibility value for the IBM terraform provider. Supported values are `public`, `private`, `public-and-private`. [Learn more](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/guides/custom-service-endpoints)." + type = string + default = "private" + validation { + condition = contains(["public", "private", "public-and-private"], var.provider_visibility) + error_message = "Invalid visibility option. Allowed values are 'public', 'private', or 'public-and-private'." + } +} ############################################################################## # IBM Cloud Logs ############################################################################## diff --git a/tests/pr_test.go b/tests/pr_test.go index 96e70ebb..4c91a978 100644 --- a/tests/pr_test.go +++ b/tests/pr_test.go @@ -117,6 +117,7 @@ func TestRunUpgradeSolutionInstances(t *testing.T) { "cos_instance_access_tags": permanentResources["accessTags"], "existing_kms_instance_crn": permanentResources["hpcs_south_crn"], "kms_endpoint_type": "public", + "provider_visibility": "public", "management_endpoint_type_for_bucket": "public", "enable_platform_logs": "false", "enable_platform_metrics": "false", @@ -290,6 +291,7 @@ func TestRunExistingResourcesInstances(t *testing.T) { }, }, "management_endpoint_type_for_bucket": "public", + "provider_visibility": "public", "enable_platform_metrics": "false", "enable_platform_logs": "false", "cloud_logs_policies": []map[string]interface{}{ @@ -327,6 +329,7 @@ func TestRunExistingResourcesInstances(t *testing.T) { "existing_kms_instance_crn": permanentResources["hpcs_south_crn"], "existing_cos_kms_key_crn": permanentResources["hpcs_south_root_key_crn"], "kms_endpoint_type": "public", + "provider_visibility": "public", "existing_cos_instance_crn": terraform.Output(t, existingTerraformOptions, "cos_crn"), "management_endpoint_type_for_bucket": "public", "enable_platform_metrics": "false",