From f9dee19de4e454fd999cfe126a89c41bfeb13c2b Mon Sep 17 00:00:00 2001 From: MiguelNdeCarvalho Date: Thu, 10 Oct 2024 18:33:50 +0000 Subject: [PATCH 1/3] variables.tf: Add svc_create --- variables.tf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/variables.tf b/variables.tf index 4c2ce43..87b7b27 100644 --- a/variables.tf +++ b/variables.tf @@ -69,6 +69,12 @@ variable "image_tag" { description = "Tag of the image used to deploy the jumpserver." } +variable "svc_create" { + type = bool + default = true + description = "If set to true it will create the service." +} + variable "svc_annotations" { type = map(any) default = {} @@ -90,5 +96,5 @@ variable "svc_port" { variable "load_balancer_class" { type = string default = null - description = "The class of the load balancer implementation this Service belongs to. If specified, the value of this field must be a label-style identifier, with an optional prefix. This field can only be set when the svc_type is LoadBalancer" + description = "The class of the load balancer implementation this Service belongs to. If specified, the value of this field must be a label-style identifier, with an optional prefix. This field can only be set when the svc_type is LoadBalancer" } From 26c11dd17bd8372cb7a20d38caaf3c789edb9315 Mon Sep 17 00:00:00 2001 From: MiguelNdeCarvalho Date: Thu, 10 Oct 2024 18:36:42 +0000 Subject: [PATCH 2/3] main.tf: Add svc_create condition --- main.tf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 8e86fed..5478d0e 100644 --- a/main.tf +++ b/main.tf @@ -231,6 +231,8 @@ resource "kubernetes_deployment" "main" { } resource "kubernetes_service" "main" { + count = var.svc_create ? 1 : 0 + metadata { name = local.resource_name namespace = var.namespace @@ -247,7 +249,7 @@ resource "kubernetes_service" "main" { target_port = var.ssh_port } - type = var.svc_type + type = var.svc_type load_balancer_class = var.load_balancer_class } From 0293abd33b24f3edd24e9489bba32e6885989472 Mon Sep 17 00:00:00 2001 From: MiguelNdeCarvalho Date: Thu, 10 Oct 2024 18:38:10 +0000 Subject: [PATCH 3/3] README.md: Update docs --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index db490f0..d34464b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ + ## Requirements No requirements. @@ -26,7 +27,7 @@ No modules. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [image\_repository](#input\_image\_repository) | Repository of the image used to deploy the jumpserver. | `string` | `"linuxserver/openssh-server"` | no | -| [image\_tag](#input\_image\_tag) | Tag of the image used to deploy the jumpserver. | `string` | `"9.3_p2-r0-ls133"` | no | +| [image\_tag](#input\_image\_tag) | Tag of the image used to deploy the jumpserver. | `string` | `"9.7_p1-r4-ls163"` | no | | [load\_balancer\_class](#input\_load\_balancer\_class) | The class of the load balancer implementation this Service belongs to. If specified, the value of this field must be a label-style identifier, with an optional prefix. This field can only be set when the svc\_type is LoadBalancer | `string` | `null` | no | | [motd\_name](#input\_motd\_name) | Name of the place where the user joined. Defaults to 'jumpserver', so it shows: 'Welcome to jumpserver' | `string` | `"jumpserver"` | no | | [name](#input\_name) | Name of the resource. Defaults to 'jumpserver' | `string` | `"jumpserver"` | no | @@ -39,9 +40,11 @@ No modules. | [ssh\_user](#input\_ssh\_user) | Specify a username to connect to. If not defined it will use 'user' as default. | `string` | `"user"` | no | | [sshd\_config](#input\_sshd\_config) | Configuration file for SSH. If not defined it will use the default. | `string` | `""` | no | | [svc\_annotations](#input\_svc\_annotations) | Map of annotations for the service. | `map(any)` | `{}` | no | +| [svc\_create](#input\_svc\_create) | If set to true it will create the service. | `bool` | `true` | no | | [svc\_port](#input\_svc\_port) | Port where the OpenSSH will be exposed. If not defined it will use '22' as default | `number` | `22` | no | | [svc\_type](#input\_svc\_type) | Type of the Service | `string` | `"LoadBalancer"` | no | ## Outputs -No outputs. \ No newline at end of file +No outputs. +