Skip to content

Commit bbfa716

Browse files
authored
fix: add wait_til support to cloud logs agent submodule (#431)
1 parent 496e9e3 commit bbfa716

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -148,5 +148,7 @@ module "logs_agent" {
148148
cloud_logs_ingress_endpoint = var.cloud_logs_ingress_endpoint
149149
cloud_logs_ingress_port = var.cloud_logs_ingress_port
150150
is_vpc_cluster = var.is_vpc_cluster
151+
wait_till = var.wait_till
152+
wait_till_timeout = var.wait_till_timeout
151153
}
152154
/** Logs Agent Configuration End **/

modules/logs-agent/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ No modules.
9999
| <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 |
100100
| <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 |
101101
| <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 |
102+
| <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 |
103+
| <a name="input_wait_till_timeout"></a> [wait\_till\_timeout](#input\_wait\_till\_timeout) | Timeout for wait\_till in minutes. | `number` | `90` | no |
102104

103105
### Outputs
104106

modules/logs-agent/main.tf

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,21 @@ data "ibm_container_vpc_cluster" "cluster" {
33
count = var.is_vpc_cluster ? 1 : 0
44
name = var.cluster_id
55
resource_group_id = var.cluster_resource_group_id
6+
wait_till = var.wait_till
7+
wait_till_timeout = var.wait_till_timeout
68
}
79

810
data "ibm_container_cluster" "cluster" {
911
count = var.is_vpc_cluster ? 0 : 1
1012
name = var.cluster_id
1113
resource_group_id = var.cluster_resource_group_id
14+
wait_till = var.wait_till
15+
wait_till_timeout = var.wait_till_timeout
1216
}
1317

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

modules/logs-agent/variables.tf

+22
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
# Logs Agents variables
3456
##############################################################################

0 commit comments

Comments
 (0)