Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:exposed visibility value for the provider in the DA #245

Merged
merged 6 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cra-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ CRA_TARGETS:
TF_VAR_resource_group_name: "terraform-ibm-cloudant"
TF_VAR_instance_name: "mock"
TF_VAR_environment_crn: "test-env-crn"
TF_VAR_provider_visibility: "public"
5 changes: 3 additions & 2 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ locals {
? local.validate_sm_region_msg
: ""))

sm_guid = var.existing_sm_instance_guid == null ? module.secrets_manager.secrets_manager_guid : var.existing_sm_instance_guid
sm_guid = var.existing_sm_instance_guid == null ? module.secrets_manager[0].secrets_manager_guid : var.existing_sm_instance_guid
sm_region = var.existing_sm_instance_region == null ? var.region : var.existing_sm_instance_region
}

Expand All @@ -25,7 +25,7 @@ module "resource_group" {
}

##############################################################################
# Standard Cloudant Instance with IAM authentication
# Standard Cloudant Instance with IAM Authentication
##############################################################################

module "create_cloudant" {
Expand Down Expand Up @@ -78,6 +78,7 @@ resource "ibm_iam_access_group_members" "accgroupmem" {

# Create Secrets Manager Instance
module "secrets_manager" {
count = var.existing_sm_instance_guid == null ? 1 : 0
source = "terraform-ibm-modules/secrets-manager/ibm"
version = "1.18.14"
resource_group_id = module.resource_group.resource_group_id
Expand Down
19 changes: 19 additions & 0 deletions ibm_catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,26 @@
"description": "This architecture supports creating and configuring an IBM Cloudant instance and database in an existing IBM Dedicated environment."
}
]
},
"configuration":[
{
"key": "provider_visibility",
"options": [
{
"displayname": "private",
"value": "private"
},
{
"displayname": "public",
"value": "public"
},
{
"displayname": "public-and-private",
"value": "public-and-private"
}
]
}
]
}
]
}
Expand Down
1 change: 1 addition & 0 deletions solutions/dedicated/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ provider "ibm" {
ibmcloud_api_key = var.ibmcloud_api_key
region = var.region
ibmcloud_timeout = 60
visibility = var.provider_visibility
}
10 changes: 10 additions & 0 deletions solutions/dedicated/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,13 @@ variable "database_config" {
description = "The databases to create in the IBM Cloudant instance with options to create partitions and shards."
default = []
}
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'."
}
}
1 change: 1 addition & 0 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func TestRunDedicatedSolution(t *testing.T) {
// crn of the dedicated host
"environment_crn": permanentResources["dedicatedHostCrn"],
"existing_resource_group": true,
"provider_visibility": "public",
"resource_group_name": options.ResourceGroup,
"instance_name": options.Prefix,
"database_config": []map[string]interface{}{
Expand Down