Skip to content

Commit 91a0392

Browse files
fix: added a new attribute service_endpoints to the key_management object to address issue where service_endpoints variable value was not being used for Key Protect (#723)
1 parent 52039d0 commit 91a0392

File tree

11 files changed

+29
-25
lines changed

11 files changed

+29
-25
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,13 +908,13 @@ module "cluster_pattern" {
908908
| <a name="input_enable_transit_gateway"></a> [enable\_transit\_gateway](#input\_enable\_transit\_gateway) | Create transit gateway | `bool` | `true` | no |
909909
| <a name="input_f5_template_data"></a> [f5\_template\_data](#input\_f5\_template\_data) | Data for all f5 templates | <pre>object({<br> tmos_admin_password = optional(string)<br> license_type = optional(string)<br> byol_license_basekey = optional(string)<br> license_host = optional(string)<br> license_username = optional(string)<br> license_password = optional(string)<br> license_pool = optional(string)<br> license_sku_keyword_1 = optional(string)<br> license_sku_keyword_2 = optional(string)<br> license_unit_of_measure = optional(string)<br> do_declaration_url = optional(string)<br> as3_declaration_url = optional(string)<br> ts_declaration_url = optional(string)<br> phone_home_url = optional(string)<br> template_source = optional(string)<br> template_version = optional(string)<br> app_id = optional(string)<br> tgactive_url = optional(string)<br> tgstandby_url = optional(string)<br> tgrefresh_url = optional(string)<br> })</pre> | <pre>{<br> "license_type": "none"<br>}</pre> | no |
910910
| <a name="input_f5_vsi"></a> [f5\_vsi](#input\_f5\_vsi) | A list describing F5 VSI workloads to create | <pre>list(<br> object({<br> name = string<br> vpc_name = string<br> primary_subnet_name = string<br> secondary_subnet_names = list(string)<br> secondary_subnet_security_group_names = list(<br> object({<br> group_name = string<br> interface_name = string<br> })<br> )<br> ssh_keys = list(string)<br> f5_image_name = string<br> machine_type = string<br> resource_group = optional(string)<br> enable_management_floating_ip = optional(bool)<br> enable_external_floating_ip = optional(bool)<br> security_groups = optional(list(string))<br> boot_volume_encryption_key_name = optional(string)<br> hostname = string<br> domain = string<br> access_tags = optional(list(string), [])<br> security_group = optional(<br> object({<br> name = string<br> rules = list(<br> object({<br> name = string<br> direction = string<br> source = string<br> tcp = optional(<br> object({<br> port_max = number<br> port_min = number<br> })<br> )<br> udp = optional(<br> object({<br> port_max = number<br> port_min = number<br> })<br> )<br> icmp = optional(<br> object({<br> type = number<br> code = number<br> })<br> )<br> })<br> )<br> })<br> )<br> block_storage_volumes = optional(list(<br> object({<br> name = string<br> profile = string<br> capacity = optional(number)<br> iops = optional(number)<br> encryption_key = optional(string)<br> })<br> ))<br> load_balancers = optional(list(<br> object({<br> name = string<br> type = string<br> listener_port = number<br> listener_protocol = string<br> connection_limit = number<br> algorithm = string<br> protocol = string<br> health_delay = number<br> health_retries = number<br> health_timeout = number<br> health_type = string<br> pool_member_port = string<br> idle_connection_timeout = optional(number)<br> security_group = optional(<br> object({<br> name = string<br> rules = list(<br> object({<br> name = string<br> direction = string<br> source = string<br> tcp = optional(<br> object({<br> port_max = number<br> port_min = number<br> })<br> )<br> udp = optional(<br> object({<br> port_max = number<br> port_min = number<br> })<br> )<br> icmp = optional(<br> object({<br> type = number<br> code = number<br> })<br> )<br> })<br> )<br> })<br> )<br> })<br> ))<br> })<br> )</pre> | `[]` | no |
911-
| <a name="input_key_management"></a> [key\_management](#input\_key\_management) | Key Protect instance variables | <pre>object({<br> name = optional(string)<br> resource_group = optional(string)<br> use_data = optional(bool)<br> use_hs_crypto = optional(bool)<br> access_tags = optional(list(string), [])<br> keys = optional(<br> list(<br> object({<br> name = string<br> root_key = optional(bool)<br> payload = optional(string)<br> key_ring = optional(string) # Any key_ring added will be created<br> force_delete = optional(bool)<br> existing_key_crn = optional(string) # CRN of an existing key in the same or different account.<br> endpoint = optional(string) # can be public or private<br> iv_value = optional(string) # (Optional, Forces new resource, String) Used with import tokens. The initialization vector (IV) that is generated when you encrypt a nonce. The IV value is required to decrypt the encrypted nonce value that you provide when you make a key import request to the service. To generate an IV, encrypt the nonce by running ibmcloud kp import-token encrypt-nonce. Only for imported root key.<br> encrypted_nonce = optional(string) # The encrypted nonce value that verifies your request to import a key to Key Protect. This value must be encrypted by using the key that you want to import to the service. To retrieve a nonce, use the ibmcloud kp import-token get command. Then, encrypt the value by running ibmcloud kp import-token encrypt-nonce. Only for imported root key.<br> policies = optional(<br> object({<br> rotation = optional(<br> object({<br> interval_month = number<br> })<br> )<br> dual_auth_delete = optional(<br> object({<br> enabled = bool<br> })<br> )<br> })<br> )<br> })<br> )<br> )<br> })</pre> | n/a | yes |
911+
| <a name="input_key_management"></a> [key\_management](#input\_key\_management) | Key Protect instance variables | <pre>object({<br> name = optional(string)<br> resource_group = optional(string)<br> use_data = optional(bool)<br> use_hs_crypto = optional(bool)<br> access_tags = optional(list(string), [])<br> service_endpoints = optional(string, "public-and-private")<br> keys = optional(<br> list(<br> object({<br> name = string<br> root_key = optional(bool)<br> payload = optional(string)<br> key_ring = optional(string) # Any key_ring added will be created<br> force_delete = optional(bool)<br> existing_key_crn = optional(string) # CRN of an existing key in the same or different account.<br> endpoint = optional(string) # can be public or private<br> iv_value = optional(string) # (Optional, Forces new resource, String) Used with import tokens. The initialization vector (IV) that is generated when you encrypt a nonce. The IV value is required to decrypt the encrypted nonce value that you provide when you make a key import request to the service. To generate an IV, encrypt the nonce by running ibmcloud kp import-token encrypt-nonce. Only for imported root key.<br> encrypted_nonce = optional(string) # The encrypted nonce value that verifies your request to import a key to Key Protect. This value must be encrypted by using the key that you want to import to the service. To retrieve a nonce, use the ibmcloud kp import-token get command. Then, encrypt the value by running ibmcloud kp import-token encrypt-nonce. Only for imported root key.<br> policies = optional(<br> object({<br> rotation = optional(<br> object({<br> interval_month = number<br> })<br> )<br> dual_auth_delete = optional(<br> object({<br> enabled = bool<br> })<br> )<br> })<br> )<br> })<br> )<br> )<br> })</pre> | n/a | yes |
912912
| <a name="input_network_cidr"></a> [network\_cidr](#input\_network\_cidr) | Network CIDR for the VPC. This is used to manage network ACL rules for cluster provisioning. | `string` | `"10.0.0.0/8"` | no |
913913
| <a name="input_prefix"></a> [prefix](#input\_prefix) | A unique identifier for resources. Must begin with a letter and end with a letter or number. This prefix will be prepended to any resources provisioned by this template. Prefixes must be 16 or fewer characters. | `string` | n/a | yes |
914914
| <a name="input_region"></a> [region](#input\_region) | Region where VPC will be created. To find your VPC region, use `ibmcloud is regions` command to find available regions. | `string` | n/a | yes |
915915
| <a name="input_resource_groups"></a> [resource\_groups](#input\_resource\_groups) | Object describing resource groups to create or reference | <pre>list(<br> object({<br> name = string<br> create = optional(bool)<br> use_prefix = optional(bool)<br> })<br> )</pre> | n/a | yes |
916916
| <a name="input_security_groups"></a> [security\_groups](#input\_security\_groups) | Security groups for VPC | <pre>list(<br> object({<br> name = string<br> vpc_name = string<br> resource_group = optional(string)<br> access_tags = optional(list(string), [])<br> rules = list(<br> object({<br> name = string<br> direction = string<br> source = string<br> tcp = optional(<br> object({<br> port_max = number<br> port_min = number<br> })<br> )<br> udp = optional(<br> object({<br> port_max = number<br> port_min = number<br> })<br> )<br> icmp = optional(<br> object({<br> type = number<br> code = number<br> })<br> )<br> })<br> )<br> })<br> )</pre> | `[]` | no |
917-
| <a name="input_service_endpoints"></a> [service\_endpoints](#input\_service\_endpoints) | Service endpoints. Can be `public`, `private`, or `public-and-private` | `string` | `"public-and-private"` | no |
917+
| <a name="input_service_endpoints"></a> [service\_endpoints](#input\_service\_endpoints) | Service endpoints for the App ID resource when created by the module. Can be `public`, `private`, or `public-and-private` | `string` | `"public-and-private"` | no |
918918
| <a name="input_skip_all_s2s_auth_policies"></a> [skip\_all\_s2s\_auth\_policies](#input\_skip\_all\_s2s\_auth\_policies) | Whether to skip the creation of all of the service-to-service authorization policies. If setting to true, policies must be in place on the account before provisioning. | `bool` | `false` | no |
919919
| <a name="input_skip_kms_block_storage_s2s_auth_policy"></a> [skip\_kms\_block\_storage\_s2s\_auth\_policy](#input\_skip\_kms\_block\_storage\_s2s\_auth\_policy) | Whether to skip the creation of a service-to-service authorization policy between block storage and the key management service. | `bool` | `false` | no |
920920
| <a name="input_ssh_keys"></a> [ssh\_keys](#input\_ssh\_keys) | SSH keys to use to provision a VSI. Must be an RSA key with a key size of either 2048 bits or 4096 bits (recommended). If `public_key` is not provided, the named key will be looked up from data. If a resource group name is added, it must be included in `var.resource_groups`. See https://cloud.ibm.com/docs/vpc?topic=vpc-ssh-keys. | <pre>list(<br> object({<br> name = string<br> public_key = optional(string)<br> resource_group = optional(string)<br> })<br> )</pre> | n/a | yes |

examples/one-vpc-one-vsi/override.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@
7777
],
7878
"name": "slz-kms",
7979
"resource_group": "slz-service-rg",
80-
"use_hs_crypto": false
80+
"use_hs_crypto": false,
81+
"service_endpoints": "public-and-private"
8182
},
8283
"resource_groups": [
8384
{

examples/override-example/override.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@
177177
],
178178
"name": "slz-kms",
179179
"resource_group": "slz-service-rg",
180-
"use_hs_crypto": false
180+
"use_hs_crypto": false,
181+
"service_endpoints": "public-and-private"
181182
},
182183
"resource_groups": [
183184
{

kms/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ locals {
88
keys = module.dynamic_values.keys
99
key_rings = module.dynamic_values.key_rings
1010
policies = module.dynamic_values.policies
11+
service_endpoints = var.key_management.service_endpoints == "private" ? "private-only" : "public-and-private"
1112
}
1213

1314
##############################################################################
@@ -26,7 +27,7 @@ resource "ibm_resource_instance" "kms" {
2627
resource_group_id = var.key_management.resource_group_id
2728
tags = var.key_management.tags
2829
parameters = {
29-
allowed_network : var.service_endpoints
30+
allowed_network : local.service_endpoints
3031
}
3132
}
3233

kms/variables.tf

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ variable "key_management" {
2323
resource_group_id = optional(string)
2424
tags = list(string)
2525
access_tags = optional(list(string), [])
26+
service_endpoints = optional(string)
2627
})
2728
}
2829

@@ -83,14 +84,4 @@ variable "keys" {
8384
}
8485
}
8586

86-
variable "service_endpoints" {
87-
description = "Service endpoints. Can be `public`, `private`, or `public-and-private`"
88-
type = string
89-
default = "public-and-private"
90-
91-
validation {
92-
error_message = "Service endpoints can only be `public`, `private`, or `public-and-private`."
93-
condition = contains(["public", "private", "public-and-private"], var.service_endpoints)
94-
}
95-
}
9687
##############################################################################

patterns/mixed/override.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@
160160
],
161161
"name": "slz-slz-kms",
162162
"resource_group": "slz-service-rg",
163-
"use_hs_crypto": false
163+
"use_hs_crypto": false,
164+
"service_endpoints": "public-and-private"
164165
},
165166
"resource_groups": [
166167
{

patterns/roks/override.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@
194194
],
195195
"name": "slz-slz-kms",
196196
"resource_group": "slz-service-rg",
197-
"use_hs_crypto": false
197+
"use_hs_crypto": false,
198+
"service_endpoints": "public-and-private"
198199
},
199200
"resource_groups": [
200201
{

patterns/vpc/override.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@
120120
],
121121
"name": "slz-slz-kms",
122122
"resource_group": "slz-service-rg",
123-
"use_hs_crypto": false
123+
"use_hs_crypto": false,
124+
"service_endpoints": "public-and-private"
124125
},
125126
"resource_groups": [
126127
{

patterns/vsi/override.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@
120120
],
121121
"name": "slz-slz-kms",
122122
"resource_group": "slz-service-rg",
123-
"use_hs_crypto": false
123+
"use_hs_crypto": false,
124+
"service_endpoints": "public-and-private"
124125
},
125126
"resource_groups": [
126127
{

services.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module "key_management" {
1111
use_data = var.key_management.use_data
1212
use_hs_crypto = var.key_management.use_hs_crypto
1313
tags = var.tags
14+
service_endpoints = var.key_management.service_endpoints
1415
}
1516
keys = var.key_management.keys == null ? [] : var.key_management.keys
1617
}

0 commit comments

Comments
 (0)