Skip to content
This repository was archived by the owner on Mar 19, 2025. It is now read-only.

Commit 37744b7

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). (#229)
1 parent cf3447c commit 37744b7

File tree

8 files changed

+62
-0
lines changed

8 files changed

+62
-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
@@ -60,6 +60,23 @@
6060
{
6161
"key": "ibmcloud_api_key"
6262
},
63+
{
64+
"key": "provider_visibility",
65+
"options": [
66+
{
67+
"displayname": "private",
68+
"value": "private"
69+
},
70+
{
71+
"displayname": "public",
72+
"value": "public"
73+
},
74+
{
75+
"displayname": "public-and-private",
76+
"value": "public-and-private"
77+
}
78+
]
79+
},
6380
{
6481
"key": "use_existing_resource_group"
6582
},
@@ -376,6 +393,23 @@
376393
{
377394
"key": "ibmcloud_api_key"
378395
},
396+
{
397+
"key": "provider_visibility",
398+
"options": [
399+
{
400+
"displayname": "private",
401+
"value": "private"
402+
},
403+
{
404+
"displayname": "public",
405+
"value": "public"
406+
},
407+
{
408+
"displayname": "public-and-private",
409+
"value": "public-and-private"
410+
}
411+
]
412+
},
379413
{
380414
"key": "name"
381415
},

solutions/agents/provider.tf

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

1011
provider "kubernetes" {

solutions/agents/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@ variable "ibmcloud_api_key" {
77
description = "The IBM Cloud API key to deploy resources."
88
sensitive = true
99
}
10+
variable "provider_visibility" {
11+
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)."
12+
type = string
13+
default = "private"
1014

15+
validation {
16+
condition = contains(["public", "private", "public-and-private"], var.provider_visibility)
17+
error_message = "Invalid visibility option. Allowed values are 'public', 'private', or 'public-and-private'."
18+
}
19+
}
1120
########################################################################################################################
1221
# SCC Workload Protection Agent variables
1322
########################################################################################################################

solutions/instances/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ This solution supports provisioning and configuring the following infrastructure
7777
| <a name="input_management_endpoint_type_for_bucket"></a> [management\_endpoint\_type\_for\_bucket](#input\_management\_endpoint\_type\_for\_bucket) | The type of endpoint for the IBM Terraform provider to use to manage Object Storage buckets. Possible values: `public`, `private`m `direct`. If you specify `private`, enable virtual routing and forwarding in your account, and the Terraform runtime must have access to the the IBM Cloud private network. | `string` | `"private"` | no |
7878
| <a name="input_prefix"></a> [prefix](#input\_prefix) | The prefix to add to all resources created by this solution. | `string` | `null` | no |
7979
| <a name="input_profile_attachments"></a> [profile\_attachments](#input\_profile\_attachments) | The list of Security and Compliance Center profile attachments to create that are scoped to your IBM Cloud account. The attachment schedule runs daily and defaults to the latest version of the specified profile attachments. | `list(string)` | <pre>[<br/> "IBM Cloud Framework for Financial Services"<br/>]</pre> | no |
80+
| <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 |
8081
| <a name="input_provision_scc_workload_protection"></a> [provision\_scc\_workload\_protection](#input\_provision\_scc\_workload\_protection) | Whether to provision a Workload Protection instance. | `bool` | `true` | no |
8182
| <a name="input_resource_group_name"></a> [resource\_group\_name](#input\_resource\_group\_name) | The name of a new or an existing resource group in which to provision resources to. If a prefix input variable is specified, the prefix is added to the name in the `<prefix>-<name>` format. | `string` | n/a | yes |
8283
| <a name="input_resource_groups_scope"></a> [resource\_groups\_scope](#input\_resource\_groups\_scope) | The resource group to associate with the Security and Compliance Center profile attachments. If not specified, the attachments are scoped to the current account ID. Only one resource group is allowed. | `list(string)` | `[]` | no |

solutions/instances/provider.tf

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

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

1618
provider "ibm" {
1719
alias = "cos"
1820
ibmcloud_api_key = var.ibmcloud_api_key
1921
region = var.cos_region
22+
visibility = var.provider_visibility
2023
}

solutions/instances/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ variable "prefix" {
3232
default = null
3333
}
3434

35+
variable "provider_visibility" {
36+
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)."
37+
type = string
38+
default = "private"
39+
40+
validation {
41+
condition = contains(["public", "private", "public-and-private"], var.provider_visibility)
42+
error_message = "Invalid visibility option. Allowed values are 'public', 'private', or 'public-and-private'."
43+
}
44+
}
3545
########################################################################################################################
3646
# KMS variables
3747
########################################################################################################################

tests/pr_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ func TestRunUpgradeInstances(t *testing.T) {
182182
"resource_group_name": options.Prefix,
183183
"existing_kms_instance_crn": permanentResources["hpcs_south_crn"],
184184
"kms_endpoint_type": "public",
185+
"provider_visibility": "public",
185186
"management_endpoint_type_for_bucket": "public",
186187
}
187188

@@ -251,6 +252,7 @@ func TestRunExistingResourcesInstances(t *testing.T) {
251252
"existing_scc_cos_bucket_name": terraform.Output(t, existingTerraformOptions, "bucket_name"),
252253
"existing_cos_instance_crn": terraform.Output(t, existingTerraformOptions, "cos_crn"),
253254
"management_endpoint_type_for_bucket": "public",
255+
"provider_visibility": "public",
254256
"existing_en_crn": terraform.Output(t, existingTerraformOptions, "en_crn"),
255257
"en_source_name": prefix, // needs to be unique per EN instance
256258
},
@@ -278,6 +280,7 @@ func TestRunExistingResourcesInstances(t *testing.T) {
278280
"existing_monitoring_crn": terraform.Output(t, existingTerraformOptions, "monitoring_crn"),
279281
"existing_kms_instance_crn": permanentResources["hpcs_south_crn"],
280282
"kms_endpoint_type": "public",
283+
"provider_visibility": "public",
281284
"existing_cos_instance_crn": terraform.Output(t, existingTerraformOptions, "cos_crn"),
282285
"management_endpoint_type_for_bucket": "public",
283286
},

0 commit comments

Comments
 (0)