Skip to content

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

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

Merged
merged 6 commits into from
Nov 26, 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 @@ -7,6 +7,7 @@ CRA_TARGETS:
CRA_ENVIRONMENT_VARIABLES:
TF_VAR_acme_letsencrypt_private_key: "DUMMY VALUE FOR CRA"
TF_VAR_cis_id: "crn:v1:bluemix:public:internet-svcs:global:a/abac0df06b644a9cabc6e44f55b3880e:59aa1a88-ac47-45e4-bd96-2bc778d26ca7::"
TF_VAR_provider_visibility: "public"
# SCC_INSTANCE_ID: "" # The SCC instance ID to use to download profile for CRA scan. If not provided, a default global value will be used.
# SCC_REGION: "" # The IBM Cloud region that the SCC instance is in. If not provided, a default global value will be used.
# CRA_ENVIRONMENT_VARIABLES: # An optional map of environment variables for CRA, where the key is the variable name and value is the value. Useful for providing TF_VARs.
Expand Down
168 changes: 168 additions & 0 deletions ibm_catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,127 @@
"description": "This deployable architecture creates IBM Cloud Code Engine and configures the project, apps, domain mappings, secrets, configmaps, and service bindings."
}
]
},
"configuration":[
{
"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": "existing_resource_group"
},
{
"key": "resource_group_name"
},
{
"key": "region",
"type": "string",
"custom_config": {
"type": "region",
"grouping": "deployment",
"original_grouping": "deployment",
"config_constraints": {
"showKinds": [
"region"
]
}
}
},
{
"key": "project_name"
},
{
"key": "existing_project_id"
},
{
"key": "app_name"
},
{
"key": "image_reference"
},
{
"key": "image_secret"
},
{
"key": "run_env_variables"
},
{
"key": "run_volume_mounts"
},
{
"key":"image_port"
},
{
"key":"managed_domain_mappings"
},
{
"key":"run_arguments"
},
{
"key":"run_as_user"
},
{
"key":"run_commands"
},
{
"key":"run_service_account"
},
{
"key":"scale_concurrency"
},
{
"key":"scale_concurrency_target"
},
{
"key":"scale_cpu_limit"
},
{
"key":"scale_ephemeral_storage_limit"
},
{
"key":"scale_initial_instances"
},
{
"key":"scale_max_instances"
},
{
"key":"scale_memory_limit"
},
{
"key":"scale_min_instances"
},
{
"key":"scale_request_timeout"
},
{
"key":"config_maps"
},
{
"key":"secrets"
},
{
"key":"domain_mappings"
},
{
"key":"bindings"
}
]
},
{
"label": "New Code Engine projects",
Expand Down Expand Up @@ -157,7 +277,55 @@
"description": "This deployable architecture creates IBM Cloud Code Engine projects"
}
]
},
"configuration":[
{
"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": "prefix"
},
{
"key": "existing_resource_group"
},
{
"key": "resource_group_name"
},
{
"key": "region",
"type": "string",
"custom_config": {
"type": "region",
"grouping": "deployment",
"original_grouping": "deployment",
"config_constraints": {
"showKinds": [
"region"
]
}
}
},
{
"key": "project_names"
}
]
}
]
}
Expand Down
1 change: 1 addition & 0 deletions solutions/apps/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
provider "ibm" {
ibmcloud_api_key = var.ibmcloud_api_key
region = var.region
visibility = var.provider_visibility
}
11 changes: 11 additions & 0 deletions solutions/apps/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ variable "ibmcloud_api_key" {
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'."
}
}

variable "region" {
type = string
description = "The region in which to provision all resources created by this solution."
Expand Down
1 change: 1 addition & 0 deletions solutions/projects/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
provider "ibm" {
ibmcloud_api_key = var.ibmcloud_api_key
region = var.region
visibility = var.provider_visibility
}
9 changes: 9 additions & 0 deletions solutions/projects/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@ variable "ibmcloud_api_key" {
description = "The IBM Cloud API key."
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'."
}
}
variable "prefix" {
type = string
description = "Prefix to added to all projects created by this solution."
Expand Down
3 changes: 3 additions & 0 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func TestRunUpgradeAppSolution(t *testing.T) {
"existing_resource_group": true,
"app_name": options.Prefix + "-app",
"image_reference": "icr.io/codeengine/helloworld",
"provider_visibility": "public",
"secrets": "{" + options.Prefix + "-secret:{format:\"generic\", data:{ key_1 : \"value_1\" }}}", // pragma: allowlist secret
"config_maps": "{" + options.Prefix + "-cm:{data:{ key_1 : \"value_1\" }}}",
"project_name": options.Prefix + "-pro",
Expand All @@ -187,6 +188,7 @@ func TestUpgradeCEProjectsDA(t *testing.T) {
options.TerraformVars = map[string]interface{}{
"resource_group_name": resourceGroup,
"existing_resource_group": true,
"provider_visibility": "public",
"prefix": options.Prefix,
"project_names": "[\"test-1\", \"test-2\", \"test-3\", \"test-4\", \"test-5\"]",
}
Expand All @@ -212,6 +214,7 @@ func TestDeployCEProjectsDA(t *testing.T) {
"resource_group_name": resourceGroup,
"existing_resource_group": true,
"prefix": options.Prefix,
"provider_visibility": "public",
"project_names": "[\"test-1\", \"test-2\", \"test-3\", \"test-4\", \"test-5\"]",
}

Expand Down