Skip to content

Commit 6411830

Browse files
authored
fix: update DA to use private resource controller endpoint by default<br>* updated prefix validation for DA<br>* removed compliance claim from DA (not applicable for this DA) (#248)
1 parent 7c0b62c commit 6411830

File tree

11 files changed

+41
-25
lines changed

11 files changed

+41
-25
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ unless real values don't help users know what to change.
4747
data "ibm_iam_auth_token" "auth_token" {}
4848
4949
provider "restapi" {
50-
uri = "https://resource-controller.cloud.ibm.com" # https://private.resource-controller.cloud.ibm.com for private
50+
# see https://cloud.ibm.com/apidocs/resource-controller/resource-controller#endpoint-url for full list of available resource controller endpoints
51+
uri = "https://resource-controller.cloud.ibm.com"
5152
headers = {
5253
Authorization = data.ibm_iam_auth_token.auth_token.iam_access_token
5354
}
@@ -101,7 +102,7 @@ statement instead the previous block.
101102

102103
| Name | Version |
103104
|------|---------|
104-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 |
105+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.9.0 |
105106
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.70.0, <2.0.0 |
106107
| <a name="requirement_restapi"></a> [restapi](#requirement\_restapi) | >=1.20.0, <2.0.0 |
107108

examples/advanced/version.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 1.3.0"
2+
required_version = ">= 1.9.0"
33
required_providers {
44
# Use latest version of provider in non-basic examples to verify latest version works with module
55
ibm = {

examples/basic/version.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 1.3.0"
2+
required_version = ">= 1.9.0"
33
required_providers {
44
# Pin to the lowest provider version of the range defined in the main module's version.tf to ensure lowest version still works
55
ibm = {

examples/enterprise/version.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 1.3.0"
2+
required_version = ">= 1.9.0"
33
required_providers {
44
ibm = {
55
source = "ibm-cloud/ibm"

ibm_catalog.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,6 @@
4747
"name": "fully-configurable",
4848
"working_directory": "solutions/fully-configurable",
4949
"install_type": "fullstack",
50-
"compliance": {
51-
"authority": "scc-v3",
52-
"profiles": [
53-
{
54-
"profile_name": "IBM Cloud Framework for Financial Services",
55-
"profile_version": "1.7.0"
56-
}
57-
]
58-
},
5950
"dependency_version_2": true,
6051
"dependencies": [
6152
{

solutions/fully-configurable/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ There is currently a [known issue](https://github.com/terraform-ibm-modules/terr
1818

1919
| Name | Version |
2020
|------|---------|
21-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.4.0 |
21+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.9.0 |
2222
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | 1.78.3 |
2323
| <a name="requirement_restapi"></a> [restapi](#requirement\_restapi) | 1.20.0 |
2424

@@ -45,8 +45,8 @@ There is currently a [known issue](https://github.com/terraform-ibm-modules/terr
4545
| <a name="input_existing_monitoring_crn"></a> [existing\_monitoring\_crn](#input\_existing\_monitoring\_crn) | The CRN of an IBM Cloud Monitoring instance to to send Workload Protection data. If no value passed, metrics are sent to the instance associated to the container's location unless otherwise specified in the Metrics Router service configuration. | `string` | `null` | no |
4646
| <a name="input_existing_resource_group_name"></a> [existing\_resource\_group\_name](#input\_existing\_resource\_group\_name) | The name of a an existing resource group in which to provision resources to. | `string` | `"Default"` | no |
4747
| <a name="input_ibmcloud_api_key"></a> [ibmcloud\_api\_key](#input\_ibmcloud\_api\_key) | The IBM Cloud API key to deploy resources. | `string` | n/a | yes |
48-
| <a name="input_ibmcloud_resource_controller_api_endpoint"></a> [ibmcloud\_resource\_controller\_api\_endpoint](#input\_ibmcloud\_resource\_controller\_api\_endpoint) | The URI of the Resource Controller service. This is used to update the Workload Protection instance to enable CSPM once the trusted profiles have been created. | `string` | `"https://resource-controller.cloud.ibm.com"` | no |
49-
| <a name="input_prefix"></a> [prefix](#input\_prefix) | The prefix to add to all resources that this solution creates (e.g `prod`, `test`, `dev`). To not use any prefix value, you can set this value to `null` or an empty string. | `string` | n/a | yes |
48+
| <a name="input_ibmcloud_resource_controller_api_endpoint"></a> [ibmcloud\_resource\_controller\_api\_endpoint](#input\_ibmcloud\_resource\_controller\_api\_endpoint) | The IBM Cloud [resource controller endpoint](https://cloud.ibm.com/apidocs/resource-controller/resource-controller#endpoint-url) to use. This is used to update the Workload Protection instance to enable CSPM once the trusted profiles have been created. | `string` | `"https://private.us-south.resource-controller.cloud.ibm.com"` | no |
49+
| <a name="input_prefix"></a> [prefix](#input\_prefix) | The prefix to be added to all resources created by this solution. To skip using a prefix, set this value to null or an empty string. The prefix must begin with a lowercase letter and may contain only lowercase letters, digits, and hyphens '-'. It should not exceed 16 characters, must not end with a hyphen('-'), and can not contain consecutive hyphens ('--'). Example: prod-scc-wp. | `string` | n/a | yes |
5050
| <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 |
5151
| <a name="input_region"></a> [region](#input\_region) | The region to provision Security and Compliance Center Workload Protection resources in. | `string` | `"us-south"` | no |
5252
| <a name="input_scc_workload_protection_access_tags"></a> [scc\_workload\_protection\_access\_tags](#input\_scc\_workload\_protection\_access\_tags) | A list of access tags to apply to the Workload Protection instance. Maximum length: 128 characters. Possible characters are A-Z, 0-9, spaces, underscores, hyphens, periods, and colons. [Learn more](https://cloud.ibm.com/docs/account?topic=account-tag&interface=ui#limits). | `list(string)` | `[]` | no |
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
22
"ibmcloud_api_key": $VALIDATION_APIKEY,
3-
"existing_resource_group_name": "geretain-test-resources"
3+
"prefix": $PREFIX,
4+
"existing_resource_group_name": "geretain-test-resources",
5+
"app_config_crn": $APP_CONFIG_CRN
46
}

solutions/fully-configurable/variables.tf

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,29 @@ variable "existing_monitoring_crn" {
2323

2424
variable "prefix" {
2525
type = string
26-
description = "The prefix to add to all resources that this solution creates (e.g `prod`, `test`, `dev`). To not use any prefix value, you can set this value to `null` or an empty string."
26+
nullable = true
27+
description = "The prefix to be added to all resources created by this solution. To skip using a prefix, set this value to null or an empty string. The prefix must begin with a lowercase letter and may contain only lowercase letters, digits, and hyphens '-'. It should not exceed 16 characters, must not end with a hyphen('-'), and can not contain consecutive hyphens ('--'). Example: prod-scc-wp."
28+
29+
validation {
30+
# - null and empty string is allowed
31+
# - Must not contain consecutive hyphens (--): length(regexall("--", var.prefix)) == 0
32+
# - Starts with a lowercase letter: [a-z]
33+
# - Contains only lowercase letters (a–z), digits (0–9), and hyphens (-)
34+
# - Must not end with a hyphen (-): [a-z0-9]
35+
condition = (var.prefix == null || var.prefix == "" ? true :
36+
alltrue([
37+
can(regex("^[a-z][-a-z0-9]*[a-z0-9]$", var.prefix)),
38+
length(regexall("--", var.prefix)) == 0
39+
])
40+
)
41+
error_message = "Prefix must begin with a lowercase letter and may contain only lowercase letters, digits, and hyphens '-'. It must not end with a hyphen('-'), and cannot contain consecutive hyphens ('--')."
42+
}
43+
44+
validation {
45+
# must not exceed 16 characters in length
46+
condition = length(var.prefix) <= 16
47+
error_message = "Prefix must not exceed 16 characters."
48+
}
2749
}
2850

2951
variable "provider_visibility" {
@@ -134,10 +156,10 @@ variable "app_config_crn" {
134156
}
135157

136158
variable "ibmcloud_resource_controller_api_endpoint" {
137-
description = "The URI of the Resource Controller service. This is used to update the Workload Protection instance to enable CSPM once the trusted profiles have been created."
159+
description = "The IBM Cloud [resource controller endpoint](https://cloud.ibm.com/apidocs/resource-controller/resource-controller#endpoint-url) to use. This is used to update the Workload Protection instance to enable CSPM once the trusted profiles have been created."
138160
type = string
139-
# TODO: Use private endpoint: https://github.com/terraform-ibm-modules/terraform-ibm-scc-workload-protection/issues/244
140-
default = "https://resource-controller.cloud.ibm.com"
161+
# TODO: When Schematics re-platform and add support for VPE, we can change this default to be "private.resource-controller.cloud.ibm.com"
162+
default = "https://private.us-south.resource-controller.cloud.ibm.com"
141163
validation {
142164
condition = !(var.cspm_enabled && var.ibmcloud_resource_controller_api_endpoint == null)
143165
error_message = "This value cannot be `null` if `cspm_enabled` is set to `true`."

solutions/fully-configurable/version.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 1.4.0"
2+
required_version = ">= 1.9.0"
33
# Lock DA into an exact provider version - renovate automation will keep it updated
44
required_providers {
55
ibm = {

0 commit comments

Comments
 (0)