Skip to content

Commit 03135f1

Browse files
authored
feat: added ability to set wait_til and wait_till_timeout (#425)
1 parent 30dc58e commit 03135f1

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ You need the following permissions to run this module.
149149
| <a name="input_logs_agent_selected_log_source_paths"></a> [logs\_agent\_selected\_log\_source\_paths](#input\_logs\_agent\_selected\_log\_source\_paths) | The list of specific log sources paths. Logs will only be collected from the specified log source paths. If no paths are specified, it will send logs from `/var/log/containers`. | `list(string)` | `[]` | no |
150150
| <a name="input_logs_agent_tolerations"></a> [logs\_agent\_tolerations](#input\_logs\_agent\_tolerations) | List of tolerations to apply to Logs agent. The default value means a pod will run on every node. | <pre>list(object({<br/> key = optional(string)<br/> operator = optional(string)<br/> value = optional(string)<br/> effect = optional(string)<br/> tolerationSeconds = optional(number)<br/> }))</pre> | <pre>[<br/> {<br/> "operator": "Exists"<br/> }<br/>]</pre> | no |
151151
| <a name="input_logs_agent_trusted_profile"></a> [logs\_agent\_trusted\_profile](#input\_logs\_agent\_trusted\_profile) | The IBM Cloud trusted profile ID. Used only when `logs_agent_iam_mode` is set to `TrustedProfile`. The trusted profile must have an IBM Cloud Logs `Sender` role. | `string` | `null` | no |
152+
| <a name="input_wait_till"></a> [wait\_till](#input\_wait\_till) | To avoid long wait times when you run your Terraform code, you can specify the stage when you want Terraform to mark the cluster resource creation as completed. Depending on what stage you choose, the cluster creation might not be fully completed and continues to run in the background. However, your Terraform code can continue to run without waiting for the cluster to be fully created. Supported args are `MasterNodeReady`, `OneWorkerNodeReady`, `IngressReady` and `Normal` | `string` | `"Normal"` | no |
153+
| <a name="input_wait_till_timeout"></a> [wait\_till\_timeout](#input\_wait\_till\_timeout) | Timeout for wait\_till in minutes. | `number` | `90` | no |
152154

153155
### Outputs
154156

main.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,21 @@ data "ibm_container_vpc_cluster" "cluster" {
77
count = var.is_vpc_cluster ? 1 : 0
88
name = var.cluster_id
99
resource_group_id = var.cluster_resource_group_id
10+
wait_till = var.wait_till
11+
wait_till_timeout = var.wait_till_timeout
1012
}
1113

1214
data "ibm_container_cluster" "cluster" {
1315
count = var.is_vpc_cluster ? 0 : 1
1416
name = var.cluster_id
1517
resource_group_id = var.cluster_resource_group_id
18+
wait_till = var.wait_till
19+
wait_till_timeout = var.wait_till_timeout
1620
}
1721

1822
# Download cluster config which is required to connect to cluster
1923
data "ibm_container_cluster_config" "cluster_config" {
20-
cluster_name_id = var.cluster_id
24+
cluster_name_id = var.is_vpc_cluster ? data.ibm_container_vpc_cluster.cluster[0].name : data.ibm_container_cluster.cluster[0].name
2125
resource_group_id = var.cluster_resource_group_id
2226
config_dir = "${path.module}/kubeconfig"
2327
endpoint_type = var.cluster_config_endpoint_type != "default" ? var.cluster_config_endpoint_type : null # null value represents default

variables.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,28 @@ variable "is_vpc_cluster" {
2929
default = true
3030
}
3131

32+
variable "wait_till" {
33+
description = "To avoid long wait times when you run your Terraform code, you can specify the stage when you want Terraform to mark the cluster resource creation as completed. Depending on what stage you choose, the cluster creation might not be fully completed and continues to run in the background. However, your Terraform code can continue to run without waiting for the cluster to be fully created. Supported args are `MasterNodeReady`, `OneWorkerNodeReady`, `IngressReady` and `Normal`"
34+
type = string
35+
default = "Normal"
36+
37+
validation {
38+
error_message = "`wait_till` value must be one of `MasterNodeReady`, `OneWorkerNodeReady`, `IngressReady` or `Normal`."
39+
condition = contains([
40+
"MasterNodeReady",
41+
"OneWorkerNodeReady",
42+
"IngressReady",
43+
"Normal"
44+
], var.wait_till)
45+
}
46+
}
47+
48+
variable "wait_till_timeout" {
49+
description = "Timeout for wait_till in minutes."
50+
type = number
51+
default = 90
52+
}
53+
3254
##############################################################################
3355
# Cloud Monitoring variables
3456
##############################################################################

0 commit comments

Comments
 (0)