Skip to content

Commit fced704

Browse files
feat: exposed the ability to set the provider_visibility in the DA [Learn more](https://registry.terraform.io/providers/IBM-Cloud/IBM/latest/docs#visibility-1)(#227)
1 parent c9e8935 commit fced704

File tree

6 files changed

+32
-0
lines changed

6 files changed

+32
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ statement instead the previous block.
159159
| <a name="input_existing_studio_instance"></a> [existing\_studio\_instance](#input\_existing\_studio\_instance) | CRN of the an existing Watson Studio instance. | `string` | `null` | no |
160160
| <a name="input_ibmcloud_api_key"></a> [ibmcloud\_api\_key](#input\_ibmcloud\_api\_key) | The API key that's used with the IBM Cloud Terraform IBM provider. | `string` | n/a | yes |
161161
| <a name="input_location"></a> [location](#input\_location) | The location that's used with the IBM Cloud Terraform IBM provider. It's also used during resource creation. | `string` | `"us-south"` | no |
162+
| <a name="input_provider_visibility"></a> [provider\_visibility](#input\_provider\_visibility) | 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). | `string` | `"private"` | no |
162163
| <a name="input_resource_group_name"></a> [resource\_group\_name](#input\_resource\_group\_name) | The name of a new or an existing resource group where the resources are created. | `string` | n/a | yes |
163164
| <a name="input_resource_prefix"></a> [resource\_prefix](#input\_resource\_prefix) | The name to be used on all Watson resources as a prefix. | `string` | `"watsonx-poc"` | no |
164165
| <a name="input_use_existing_resource_group"></a> [use\_existing\_resource\_group](#input\_use\_existing\_resource\_group) | Determines whether to use an existing resource group. | `bool` | `false` | no |

cra-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ CRA_TARGETS:
88
TF_VAR_watsonx_admin_api_key: "fake_value"
99
TF_VAR_resource_group_name: "test"
1010
TF_VAR_cos_kms_crn: "crn:v1:bluemix:public:kms:us-south:a/abac0df06b644a9cabc6e44f55b3880e:a20230fb-9ec3-4376-a27d-8ca21a94728a::"
11+
TF_VAR_provider_visibility: "public"

ibm_catalog.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,23 @@
7272
"required": true,
7373
"type": "password"
7474
},
75+
{
76+
"key": "provider_visibility",
77+
"options": [
78+
{
79+
"displayname": "private",
80+
"value": "private"
81+
},
82+
{
83+
"displayname": "public",
84+
"value": "public"
85+
},
86+
{
87+
"displayname": "public-and-private",
88+
"value": "public-and-private"
89+
}
90+
]
91+
},
7592
{
7693
"key": "location",
7794
"type": "string",

providers.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ provider "ibm" {
22
alias = "deployer"
33
ibmcloud_api_key = var.ibmcloud_api_key
44
region = var.location
5+
visibility = var.provider_visibility
56
}
67

78
provider "ibm" {
89
alias = "watsonx_admin"
910
ibmcloud_api_key = var.watsonx_admin_api_key == null || var.watsonx_admin_api_key == "" ? var.ibmcloud_api_key : var.watsonx_admin_api_key
1011
region = var.location
12+
visibility = var.provider_visibility
1113
}
1214

1315

tests/pr_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func setupOptionsRootDA(t *testing.T, prefix string, dir string) *testhelper.Tes
6666
"location": validRegions[rand.Intn(len(validRegions))],
6767
"resource_group_name": prefix,
6868
"enable_cos_kms_encryption": false,
69+
"provider_visibility": "public",
6970
},
7071
})
7172

@@ -153,6 +154,7 @@ func TestWithExistingKP(t *testing.T) {
153154
TerraformVars: map[string]interface{}{
154155
"location": validRegions[rand.Intn(len(validRegions))],
155156
"resource_group_name": prefix,
157+
"provider_visibility": "public",
156158
"cos_kms_crn": terraform.Output(t, existingTerraformOptions, "key_protect_crn"),
157159
"cos_kms_key_crn": terraform.Output(t, existingTerraformOptions, "kms_key_crn"),
158160
},

variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@ variable "ibmcloud_api_key" {
33
sensitive = true
44
type = string
55
}
6+
variable "provider_visibility" {
7+
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)."
8+
type = string
9+
default = "private"
610

11+
validation {
12+
condition = contains(["public", "private", "public-and-private"], var.provider_visibility)
13+
error_message = "Invalid visibility option. Allowed values are 'public', 'private', or 'public-and-private'."
14+
}
15+
}
716
variable "watsonx_admin_api_key" {
817
default = null
918
description = "The API key of the IBM watsonx administrator in the target account. The API key is used to configure the user and the project."

0 commit comments

Comments
 (0)