From 80bc067c02c684b57ea32f75ac5fd87a7c67553f Mon Sep 17 00:00:00 2001 From: Francesco Latini Date: Thu, 29 Aug 2024 15:18:03 +0200 Subject: [PATCH 1/2] Condition check for java_version variable --- README.md | 4 ++-- statefulset.tf | 4 ++-- variables.tf | 7 ++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f69dbeb..3ef7210 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,8 @@ module "as_demo" { | [public\_domain](#input\_public\_domain) | The domain that is added to the hostname when returning hostnames to client applications. | `string` | `""` | yes | | [axonserver\_license\_path](#input\_axonserver\_license\_path) | The path to the Axon Server license | `string` | `""` | yes | | [axonserver\_properties](#input\_axonserver\_properties) | The path to the Axon Server properties file | `string` | `""` | no | -| [console\_authentication](#input\_console\_authentication) | Console authentication token | `string` | `""` | no | -| [java\_version](#input\_java\_version) | Java runtime | `number` | `"11"` | no | +| [console\_authentication](#input\_console\_authentication) | Console authentication token | `string` | `""` | no | +| [java\_version](#input\_java\_version) | Java runtime | `number` | `"17"` | no | | [resources\_limits\_cpu](#input\_resources\_limits\_cpu) | spec.container.resources.limits.cpu | `number` | `"1"` | no | | [resources\_limits\_memory](#input\_resources\_limits\_memory) | spec.container.resources.limits.memory | `string` | `"1Gi"` | no | | [resources\_requests\_cpu](#input\_resources\_requests\_cpu) | spec.container.resources.requests.cpu | `number` | `"1"` | no | diff --git a/statefulset.tf b/statefulset.tf index c7ead5c..695f0df 100755 --- a/statefulset.tf +++ b/statefulset.tf @@ -34,7 +34,7 @@ resource "kubernetes_stateful_set" "axonserver" { termination_grace_period_seconds = 120 dynamic "affinity" { - for_each = var.assign_pods_to_different_nodes == true ? [1] : [ ] + for_each = var.assign_pods_to_different_nodes == true ? [1] : [] content { pod_anti_affinity { preferred_during_scheduling_ignored_during_execution { @@ -47,7 +47,7 @@ resource "kubernetes_stateful_set" "axonserver" { match_expressions { key = "cluster" operator = "In" - values = [ var.cluster_name ] + values = [var.cluster_name] } } } diff --git a/variables.tf b/variables.tf index a5f324e..e2c9e65 100755 --- a/variables.tf +++ b/variables.tf @@ -43,7 +43,12 @@ variable "console_authentication" { variable "java_version" { description = "Java runtime" type = number - default = 11 + default = 17 + + validation { + condition = contains(["17", "11"], var.java_version) + error_message = "The Java version is not supported, it must be either '17' or '11'." + } } variable "resources_limits_cpu" { From 396f79662c4bd1f84409941ed08a53801ab03fbb Mon Sep 17 00:00:00 2001 From: Francesco Latini Date: Thu, 29 Aug 2024 15:18:52 +0200 Subject: [PATCH 2/2] Using TF module v1.12 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3ef7210..ae1b7fc 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ ```terraform module "as_demo" { - source = "git@github.com:AxonIQ/terraform-axonserver-k8s.git?ref=v1.11" + source = "git@github.com:AxonIQ/terraform-axonserver-k8s.git?ref=v1.12" axonserver_release = "2024.1.1" java_version = "17"