Skip to content

Commit 991fe28

Browse files
feat: exposes the ability to set the provider_visibility in the DAs (#216)
[Learn more](/registry.terraform.io/providers/IBM-Cloud/IBM/latest/docs#visibility-1) --------- Co-authored-by: Shikha Maheshwari <[email protected]>
1 parent 87300e0 commit 991fe28

File tree

7 files changed

+60
-0
lines changed

7 files changed

+60
-0
lines changed

cra-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ CRA_TARGETS:
77
CRA_ENVIRONMENT_VARIABLES:
88
TF_VAR_resource_group_name: "test"
99
TF_VAR_existing_kms_instance_crn: "crn:v1:bluemix:public:hs-crypto:us-south:a/abac0df06b644a9cabc6e44f55b3880e:e6dce284-e80f-46e1-a3c1-830f7adff7a9::"
10+
TF_VAR_provider_visibility: "public"

ibm_catalog.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,23 @@
106106
{
107107
"key": "ibmcloud_api_key"
108108
},
109+
{
110+
"key": "provider_visibility",
111+
"options": [
112+
{
113+
"displayname": "private",
114+
"value": "private"
115+
},
116+
{
117+
"displayname": "public",
118+
"value": "public"
119+
},
120+
{
121+
"displayname": "public-and-private",
122+
"value": "public-and-private"
123+
}
124+
]
125+
},
109126
{
110127
"key": "prefix"
111128
},
@@ -506,6 +523,23 @@
506523
{
507524
"key": "ibmcloud_api_key"
508525
},
526+
{
527+
"key": "provider_visibility",
528+
"options": [
529+
{
530+
"displayname": "private",
531+
"value": "private"
532+
},
533+
{
534+
"displayname": "public",
535+
"value": "public"
536+
},
537+
{
538+
"displayname": "public-and-private",
539+
"value": "public-and-private"
540+
}
541+
]
542+
},
509543
{
510544
"key": "prefix"
511545
},

solutions/agents/provider.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
provider "ibm" {
22
ibmcloud_api_key = var.ibmcloud_api_key
3+
visibility = var.provider_visibility
34
}
45

56
provider "kubernetes" {

solutions/agents/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,16 @@ variable "prefix" {
99
description = "The prefix for resources created by this solution."
1010
default = null
1111
}
12+
variable "provider_visibility" {
13+
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)."
14+
type = string
15+
default = "private"
1216

17+
validation {
18+
condition = contains(["public", "private", "public-and-private"], var.provider_visibility)
19+
error_message = "Invalid visibility option. Allowed values are 'public', 'private', or 'public-and-private'."
20+
}
21+
}
1322
##############################################################################
1423
# Cluster variables
1524
##############################################################################

solutions/instances/provider.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,20 @@
55
provider "ibm" {
66
ibmcloud_api_key = var.ibmcloud_api_key
77
region = var.region
8+
visibility = var.provider_visibility
89
}
910

1011
provider "ibm" {
1112
alias = "cos"
1213
ibmcloud_api_key = var.ibmcloud_cos_api_key != null ? var.ibmcloud_cos_api_key : var.ibmcloud_api_key
1314
region = local.default_cos_region
15+
visibility = var.provider_visibility
1416
}
1517

1618

1719
provider "ibm" {
1820
alias = "kms"
1921
ibmcloud_api_key = var.ibmcloud_kms_api_key != null ? var.ibmcloud_kms_api_key : var.ibmcloud_api_key
2022
region = local.kms_region
23+
visibility = var.provider_visibility
2124
}

solutions/instances/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,16 @@ variable "prefix" {
5050
description = "The prefix to add to all resources that this solution creates."
5151
default = null
5252
}
53+
variable "provider_visibility" {
54+
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)."
55+
type = string
56+
default = "private"
5357

58+
validation {
59+
condition = contains(["public", "private", "public-and-private"], var.provider_visibility)
60+
error_message = "Invalid visibility option. Allowed values are 'public', 'private', or 'public-and-private'."
61+
}
62+
}
5463
##############################################################################
5564
# IBM Cloud Logs
5665
##############################################################################

tests/pr_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ func TestRunUpgradeSolutionInstances(t *testing.T) {
117117
"cos_instance_access_tags": permanentResources["accessTags"],
118118
"existing_kms_instance_crn": permanentResources["hpcs_south_crn"],
119119
"kms_endpoint_type": "public",
120+
"provider_visibility": "public",
120121
"management_endpoint_type_for_bucket": "public",
121122
"enable_platform_logs": "false",
122123
"enable_platform_metrics": "false",
@@ -290,6 +291,7 @@ func TestRunExistingResourcesInstances(t *testing.T) {
290291
},
291292
},
292293
"management_endpoint_type_for_bucket": "public",
294+
"provider_visibility": "public",
293295
"enable_platform_metrics": "false",
294296
"enable_platform_logs": "false",
295297
"cloud_logs_policies": []map[string]interface{}{
@@ -327,6 +329,7 @@ func TestRunExistingResourcesInstances(t *testing.T) {
327329
"existing_kms_instance_crn": permanentResources["hpcs_south_crn"],
328330
"existing_cos_kms_key_crn": permanentResources["hpcs_south_root_key_crn"],
329331
"kms_endpoint_type": "public",
332+
"provider_visibility": "public",
330333
"existing_cos_instance_crn": terraform.Output(t, existingTerraformOptions, "cos_crn"),
331334
"management_endpoint_type_for_bucket": "public",
332335
"enable_platform_metrics": "false",

0 commit comments

Comments
 (0)