From 37744b71fafd0a08b09dab66248962acb22fc4cb Mon Sep 17 00:00:00 2001 From: Aditya Ranjan <48973656+Aditya-ranjan-16@users.noreply.github.com> Date: Thu, 28 Nov 2024 16:21:13 +0530 Subject: [PATCH] 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) --- cra-config.yaml | 1 + ibm_catalog.json | 34 ++++++++++++++++++++++++++++++++ solutions/agents/provider.tf | 1 + solutions/agents/variables.tf | 9 +++++++++ solutions/instances/README.md | 1 + solutions/instances/provider.tf | 3 +++ solutions/instances/variables.tf | 10 ++++++++++ tests/pr_test.go | 3 +++ 8 files changed, 62 insertions(+) diff --git a/cra-config.yaml b/cra-config.yaml index 1c95429..ccac19f 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 c61996e..2f2e4f3 100644 --- a/ibm_catalog.json +++ b/ibm_catalog.json @@ -60,6 +60,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": "use_existing_resource_group" }, @@ -376,6 +393,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": "name" }, diff --git a/solutions/agents/provider.tf b/solutions/agents/provider.tf index 18eefa1..73d8908 100644 --- a/solutions/agents/provider.tf +++ b/solutions/agents/provider.tf @@ -5,6 +5,7 @@ provider "ibm" { ibmcloud_api_key = var.ibmcloud_api_key region = var.region + visibility = var.provider_visibility } provider "kubernetes" { diff --git a/solutions/agents/variables.tf b/solutions/agents/variables.tf index 95bbb0f..ec09a16 100644 --- a/solutions/agents/variables.tf +++ b/solutions/agents/variables.tf @@ -7,7 +7,16 @@ variable "ibmcloud_api_key" { description = "The IBM Cloud API key to deploy resources." sensitive = true } +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'." + } +} ######################################################################################################################## # SCC Workload Protection Agent variables ######################################################################################################################## diff --git a/solutions/instances/README.md b/solutions/instances/README.md index 326ea73..c1f1be1 100644 --- a/solutions/instances/README.md +++ b/solutions/instances/README.md @@ -77,6 +77,7 @@ This solution supports provisioning and configuring the following infrastructure | [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 | | [prefix](#input\_prefix) | The prefix to add to all resources created by this solution. | `string` | `null` | no | | [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)` |
[| no | +| [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 | | [provision\_scc\_workload\_protection](#input\_provision\_scc\_workload\_protection) | Whether to provision a Workload Protection instance. | `bool` | `true` | no | | [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 `
"IBM Cloud Framework for Financial Services"
]