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. + 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 } 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" }