Skip to content

Commit 99aa12c

Browse files
authored
feat: added the ability to skip the explicit creation of the cluster apikey using new input skip_cluster_apikey_creation (#828)
1 parent ddd568a commit 99aa12c

File tree

11 files changed

+38
-0
lines changed

11 files changed

+38
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ Optionally, you need the following permissions to attach Access Management tags
364364
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The ID of an existing IBM Cloud resource group where the cluster is grouped. | `string` | n/a | yes |
365365
| <a name="input_secrets_manager_secret_group_id"></a> [secrets\_manager\_secret\_group\_id](#input\_secrets\_manager\_secret\_group\_id) | Secret group ID where Ingress secrets are stored in the Secrets Manager instance. | `string` | `null` | no |
366366
| <a name="input_service_subnet_cidr"></a> [service\_subnet\_cidr](#input\_service\_subnet\_cidr) | Specify a custom subnet CIDR to provide private IP addresses for services. The subnet must be at least `/24` or larger. Default value is `172.21.0.0/16` when the variable is set to `null`. | `string` | `null` | no |
367+
| <a name="input_skip_cluster_apikey_creation"></a> [skip\_cluster\_apikey\_creation](#input\_skip\_cluster\_apikey\_creation) | Set to true to skip explicit creation of the `containers-kubernetes-key` for the given region and resource group. You can set this to false if you plan to manually create this key, or if you want to allow the cluster creation process to create it. Please be aware that it may take multiple apply attempts when allowing the cluster creation process to create it it before it will be successful. | `bool` | `false` | no |
367368
| <a name="input_skip_ocp_secrets_manager_iam_auth_policy"></a> [skip\_ocp\_secrets\_manager\_iam\_auth\_policy](#input\_skip\_ocp\_secrets\_manager\_iam\_auth\_policy) | To skip creating auth policy that allows OCP cluster 'Manager' role access in the existing Secrets Manager instance for managing ingress certificates. | `bool` | `false` | no |
368369
| <a name="input_tags"></a> [tags](#input\_tags) | Metadata labels describing this cluster deployment, i.e. test | `list(string)` | `[]` | no |
369370
| <a name="input_use_existing_cos"></a> [use\_existing\_cos](#input\_use\_existing\_cos) | Flag indicating whether or not to use an existing COS instance for OpenShift internal registry storage. Only applicable if 'enable\_registry\_storage' is true | `bool` | `false` | no |

ibm_catalog.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,9 @@
928928
"key": "skip_ocp_secrets_manager_iam_auth_policy",
929929
"hidden": true
930930
},
931+
{
932+
"key": "skip_cluster_apikey_creation"
933+
},
931934
{
932935
"key": "subnets",
933936
"default_value": "{\n zone-1 = [\n {\n name = \"subnet-a\"\n cidr = \"10.10.10.0/24\"\n public_gateway = true\n acl_name = \"vpc-acl\"\n no_addr_prefix = false\n }\n ],\n zone-2 = [\n {\n name = \"subnet-b\"\n cidr = \"10.20.10.0/24\"\n public_gateway = true\n acl_name = \"vpc-acl\"\n no_addr_prefix = false\n }\n ],\n zone-3 = [\n {\n name = \"subnet-c\"\n cidr = \"10.30.10.0/24\"\n public_gateway = true\n acl_name = \"vpc-acl\"\n no_addr_prefix = false\n }\n ]\n }",
@@ -1518,6 +1521,10 @@
15181521
"key": "address_prefix",
15191522
"hidden": true
15201523
},
1524+
{
1525+
"key": "skip_cluster_apikey_creation",
1526+
"hidden": true
1527+
},
15211528
{
15221529
"key": "ocp_entitlement"
15231530
},

main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,11 +442,13 @@ resource "ibm_resource_tag" "cluster_access_tag" {
442442
# Enhancement Request: Add support to skip API key reset if a valid key already exists (https://github.com/IBM-Cloud/terraform-provider-ibm/issues/6468).
443443

444444
resource "ibm_container_api_key_reset" "reset_api_key" {
445+
count = var.skip_cluster_apikey_creation ? 0 : 1
445446
region = var.region
446447
resource_group_id = var.resource_group_id
447448
}
448449

449450
resource "time_sleep" "wait_for_reset_api_key" {
451+
count = var.skip_cluster_apikey_creation ? 0 : 1
450452
depends_on = [ibm_container_api_key_reset.reset_api_key]
451453
create_duration = "10s"
452454
}

modules/fscloud/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ No resources.
135135
| <a name="input_region"></a> [region](#input\_region) | The IBM Cloud region where the cluster will be provisioned. | `string` | n/a | yes |
136136
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The Id of an existing IBM Cloud resource group where the cluster will be grouped. | `string` | n/a | yes |
137137
| <a name="input_service_subnet_cidr"></a> [service\_subnet\_cidr](#input\_service\_subnet\_cidr) | Specify a custom subnet CIDR to provide private IP addresses for services. The subnet must be at least `/24` or larger. Default value is `172.21.0.0/16` when the variable is set to `null`. | `string` | `null` | no |
138+
| <a name="input_skip_cluster_apikey_creation"></a> [skip\_cluster\_apikey\_creation](#input\_skip\_cluster\_apikey\_creation) | Set to true to skip explicit creation of the `containers-kubernetes-key` for the given region and resource group. You can set this to false if you plan to manually create this key, or if you want to allow the cluster creation process to create it. Please be aware that it may take multiple apply attempts when allowing the cluster creation process to create it it before it will be successful. | `bool` | `false` | no |
138139
| <a name="input_tags"></a> [tags](#input\_tags) | Metadata labels describing this cluster deployment | `list(string)` | `[]` | no |
139140
| <a name="input_verify_worker_network_readiness"></a> [verify\_worker\_network\_readiness](#input\_verify\_worker\_network\_readiness) | By setting this to true, a script will run kubectl commands to verify that all worker nodes can communicate successfully with the master. If the runtime does not have access to the kube cluster to run kubectl commands, this should be set to false. | `bool` | `true` | no |
140141
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | ID of the VPC instance where this cluster will be provisioned | `string` | n/a | yes |

modules/fscloud/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ module "fscloud" {
3434
additional_vpe_security_group_ids = var.additional_vpe_security_group_ids
3535
cbr_rules = var.cbr_rules
3636
enable_ocp_console = var.enable_ocp_console
37+
skip_cluster_apikey_creation = var.skip_cluster_apikey_creation
3738
}

modules/fscloud/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,3 +287,9 @@ variable "enable_ocp_console" {
287287
type = bool
288288
default = true
289289
}
290+
291+
variable "skip_cluster_apikey_creation" {
292+
type = bool
293+
description = "Set to true to skip explicit creation of the `containers-kubernetes-key` for the given region and resource group. You can set this to false if you plan to manually create this key, or if you want to allow the cluster creation process to create it. Please be aware that it may take multiple apply attempts when allowing the cluster creation process to create it it before it will be successful."
294+
default = false
295+
}

solutions/fully-configurable/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ module "ocp_base" {
239239
existing_secrets_manager_instance_crn = var.existing_secrets_manager_instance_crn
240240
secrets_manager_secret_group_id = var.secrets_manager_secret_group_id != null ? var.secrets_manager_secret_group_id : (var.enable_secrets_manager_integration ? module.secret_group[0].secret_group_id : null)
241241
skip_ocp_secrets_manager_iam_auth_policy = var.skip_ocp_secrets_manager_iam_auth_policy
242+
skip_cluster_apikey_creation = var.skip_cluster_apikey_creation
242243
}
243244

244245
module "existing_secrets_manager_instance_parser" {

solutions/fully-configurable/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,3 +601,9 @@ variable "audit_webhook_listener_image_tag_digest" {
601601
description = "The tag or digest for the audit webhook listener image to deploy. If changing the value, ensure it is compatible with `audit_webhook_listener_image`."
602602
default = "deaabcb8225e800385413ba420cf3f819d3b0671@sha256:acf123f4dba63534cbc104c6886abedff9d25a22a34ab7b549ede988ed6e7144"
603603
}
604+
605+
variable "skip_cluster_apikey_creation" {
606+
type = bool
607+
description = "To skip resetting the `containers-kubernetes-key` for the given region and resource group."
608+
default = false
609+
}

solutions/quickstart/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,5 @@ module "ocp_base" {
144144
access_tags = var.access_tags
145145
disable_public_endpoint = !var.allow_public_access_to_cluster_management
146146
cluster_config_endpoint_type = "default"
147+
skip_cluster_apikey_creation = var.skip_cluster_apikey_creation
147148
}

solutions/quickstart/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,9 @@ variable "allow_outbound_traffic" {
102102
description = "Set to true to allow public outbound access from the cluster workers."
103103
default = true
104104
}
105+
106+
variable "skip_cluster_apikey_creation" {
107+
type = bool
108+
description = "Set to true to skip explicit creation of the `containers-kubernetes-key` for the given region and resource group. You can set this to false if you plan to manually create this key, or if you want to allow the cluster creation process to create it. Please be aware that it may take multiple apply attempts when allowing the cluster creation process to create it it before it will be successful."
109+
default = false
110+
}

0 commit comments

Comments
 (0)