diff --git a/main.tf b/main.tf index ee82b64b..e8ad3b7d 100644 --- a/main.tf +++ b/main.tf @@ -148,5 +148,7 @@ module "logs_agent" { cloud_logs_ingress_endpoint = var.cloud_logs_ingress_endpoint cloud_logs_ingress_port = var.cloud_logs_ingress_port is_vpc_cluster = var.is_vpc_cluster + wait_till = var.wait_till + wait_till_timeout = var.wait_till_timeout } /** Logs Agent Configuration End **/ diff --git a/modules/logs-agent/README.md b/modules/logs-agent/README.md index 18ae8a3d..ee8849c1 100644 --- a/modules/logs-agent/README.md +++ b/modules/logs-agent/README.md @@ -99,6 +99,8 @@ No modules. | [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 | | [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. |
list(object({
key = optional(string)
operator = optional(string)
value = optional(string)
effect = optional(string)
tolerationSeconds = optional(number)
}))
|
[
{
"operator": "Exists"
}
]
| no | | [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 | +| [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 | +| [wait\_till\_timeout](#input\_wait\_till\_timeout) | Timeout for wait\_till in minutes. | `number` | `90` | no | ### Outputs diff --git a/modules/logs-agent/main.tf b/modules/logs-agent/main.tf index 43599e1a..1e756d8c 100644 --- a/modules/logs-agent/main.tf +++ b/modules/logs-agent/main.tf @@ -3,17 +3,21 @@ data "ibm_container_vpc_cluster" "cluster" { count = var.is_vpc_cluster ? 1 : 0 name = var.cluster_id resource_group_id = var.cluster_resource_group_id + wait_till = var.wait_till + wait_till_timeout = var.wait_till_timeout } data "ibm_container_cluster" "cluster" { count = var.is_vpc_cluster ? 0 : 1 name = var.cluster_id resource_group_id = var.cluster_resource_group_id + wait_till = var.wait_till + wait_till_timeout = var.wait_till_timeout } # Download cluster config which is required to connect to cluster data "ibm_container_cluster_config" "cluster_config" { - cluster_name_id = var.cluster_id + cluster_name_id = var.is_vpc_cluster ? data.ibm_container_vpc_cluster.cluster[0].name : data.ibm_container_cluster.cluster[0].name resource_group_id = var.cluster_resource_group_id config_dir = "${path.module}/kubeconfig" endpoint_type = var.cluster_config_endpoint_type != "default" ? var.cluster_config_endpoint_type : null # null value represents default diff --git a/modules/logs-agent/variables.tf b/modules/logs-agent/variables.tf index 7e30cd14..8e55139f 100644 --- a/modules/logs-agent/variables.tf +++ b/modules/logs-agent/variables.tf @@ -29,6 +29,28 @@ variable "is_vpc_cluster" { default = true } +variable "wait_till" { + 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`" + type = string + default = "Normal" + + validation { + error_message = "`wait_till` value must be one of `MasterNodeReady`, `OneWorkerNodeReady`, `IngressReady` or `Normal`." + condition = contains([ + "MasterNodeReady", + "OneWorkerNodeReady", + "IngressReady", + "Normal" + ], var.wait_till) + } +} + +variable "wait_till_timeout" { + description = "Timeout for wait_till in minutes." + type = number + default = 90 +} + ############################################################################## # Logs Agents variables ##############################################################################