Skip to content

Commit

Permalink
add tls and node_port variable
Browse files Browse the repository at this point in the history
  • Loading branch information
jjno91 committed Jun 24, 2020
1 parent 93cf646 commit 870f16b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
16 changes: 11 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ resource "kubernetes_cluster_role_binding" "this" {

resource "kubernetes_service_account" "this" {
automount_service_account_token = true

metadata {
name = "this"
namespace = kubernetes_namespace.this.metadata[0].name
Expand Down Expand Up @@ -151,8 +151,9 @@ resource "kubernetes_service" "this" {
}

port {
name = "http"
port = var.web_port
name = "http"
port = var.web_port
node_port = var.node_port
}

port {
Expand All @@ -175,7 +176,8 @@ resource "kubernetes_ingress" "this" {
namespace = kubernetes_namespace.this.metadata[0].name

annotations = {
"kubernetes.io/ingress.class" = "nginx"
"kubernetes.io/ingress.class" = "nginx"
"nginx.ingress.kubernetes.io/force-ssl-redirect" = true
}
}

Expand All @@ -185,7 +187,7 @@ resource "kubernetes_ingress" "this" {

http {
path {
path = "/*"
path = "/"

backend {
service_name = kubernetes_service.this.metadata[0].name
Expand All @@ -194,6 +196,10 @@ resource "kubernetes_ingress" "this" {
}
}
}

tls {
hosts = [var.host]
}
}

lifecycle {
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ variable "web_port" {
default = "8080"
}

variable "node_port" {
description = "https://www.terraform.io/docs/providers/kubernetes/r/service.html#node_port"
default = ""
}

variable "jnlp_port" {
description = "JNLP port exposed for Jenkins agents"
default = "50000"
Expand Down

0 comments on commit 870f16b

Please sign in to comment.