Skip to content

Commit a105268

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) (#245)
1 parent 61bb635 commit a105268

File tree

6 files changed

+35
-2
lines changed

6 files changed

+35
-2
lines changed

cra-config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ CRA_TARGETS:
88
TF_VAR_resource_group_name: "terraform-ibm-cloudant"
99
TF_VAR_instance_name: "mock"
1010
TF_VAR_environment_crn: "test-env-crn"
11+
TF_VAR_provider_visibility: "public"

examples/complete/main.tf

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ locals {
88
? local.validate_sm_region_msg
99
: ""))
1010

11-
sm_guid = var.existing_sm_instance_guid == null ? module.secrets_manager.secrets_manager_guid : var.existing_sm_instance_guid
11+
sm_guid = var.existing_sm_instance_guid == null ? module.secrets_manager[0].secrets_manager_guid : var.existing_sm_instance_guid
1212
sm_region = var.existing_sm_instance_region == null ? var.region : var.existing_sm_instance_region
1313
}
1414

@@ -25,7 +25,7 @@ module "resource_group" {
2525
}
2626

2727
##############################################################################
28-
# Standard Cloudant Instance with IAM authentication
28+
# Standard Cloudant Instance with IAM Authentication
2929
##############################################################################
3030

3131
module "create_cloudant" {
@@ -78,6 +78,7 @@ resource "ibm_iam_access_group_members" "accgroupmem" {
7878

7979
# Create Secrets Manager Instance
8080
module "secrets_manager" {
81+
count = var.existing_sm_instance_guid == null ? 1 : 0
8182
source = "terraform-ibm-modules/secrets-manager/ibm"
8283
version = "1.18.14"
8384
resource_group_id = module.resource_group.resource_group_id

ibm_catalog.json

+19
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,26 @@
9292
"description": "This architecture supports creating and configuring an IBM Cloudant instance and database in an existing IBM Dedicated environment."
9393
}
9494
]
95+
},
96+
"configuration":[
97+
{
98+
"key": "provider_visibility",
99+
"options": [
100+
{
101+
"displayname": "private",
102+
"value": "private"
103+
},
104+
{
105+
"displayname": "public",
106+
"value": "public"
107+
},
108+
{
109+
"displayname": "public-and-private",
110+
"value": "public-and-private"
111+
}
112+
]
95113
}
114+
]
96115
}
97116
]
98117
}

solutions/dedicated/provider.tf

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ provider "ibm" {
22
ibmcloud_api_key = var.ibmcloud_api_key
33
region = var.region
44
ibmcloud_timeout = 60
5+
visibility = var.provider_visibility
56
}

solutions/dedicated/variables.tf

+10
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,13 @@ variable "database_config" {
8383
description = "The databases to create in the IBM Cloudant instance with options to create partitions and shards."
8484
default = []
8585
}
86+
variable "provider_visibility" {
87+
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)."
88+
type = string
89+
default = "private"
90+
91+
validation {
92+
condition = contains(["public", "private", "public-and-private"], var.provider_visibility)
93+
error_message = "Invalid visibility option. Allowed values are 'public', 'private', or 'public-and-private'."
94+
}
95+
}

tests/pr_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ func TestRunDedicatedSolution(t *testing.T) {
7878
// crn of the dedicated host
7979
"environment_crn": permanentResources["dedicatedHostCrn"],
8080
"existing_resource_group": true,
81+
"provider_visibility": "public",
8182
"resource_group_name": options.ResourceGroup,
8283
"instance_name": options.Prefix,
8384
"database_config": []map[string]interface{}{

0 commit comments

Comments
 (0)