fix
This commit is contained in:
@@ -7,7 +7,7 @@ locals {
|
||||
"backend" = {
|
||||
"service" = var.service
|
||||
}
|
||||
"path" = "/"
|
||||
"path" = "/${var.sub-path}"
|
||||
"pathType" = "Prefix"
|
||||
}]
|
||||
}
|
||||
@@ -15,6 +15,7 @@ locals {
|
||||
}
|
||||
|
||||
resource "kubectl_manifest" "prj_certificate" {
|
||||
count = var.create-cert?1:0
|
||||
yaml_body = <<-EOF
|
||||
apiVersion: "cert-manager.io/v1"
|
||||
kind: "Certificate"
|
||||
@@ -33,7 +34,7 @@ resource "kubectl_manifest" "prj_certificate" {
|
||||
}
|
||||
|
||||
resource "kubectl_manifest" "prj_https_redirect" {
|
||||
count = var.component==""?1:0
|
||||
count = var.create-redirect||var.component==""?1:0
|
||||
yaml_body = <<-EOF
|
||||
apiVersion: "traefik.containo.us/v1alpha1"
|
||||
kind: "Middleware"
|
||||
@@ -54,7 +55,7 @@ resource "kubectl_manifest" "prj_ingress" {
|
||||
apiVersion: "networking.k8s.io/v1"
|
||||
kind: "Ingress"
|
||||
metadata:
|
||||
name: "${var.instance}${var.component==""?"":"-"}${var.component}"
|
||||
name: "${var.instance}${var.component==""?"":"-${var.component}"}"
|
||||
namespace: "${var.namespace}"
|
||||
labels: ${jsonencode(var.labels)}
|
||||
annotations:
|
||||
@@ -64,6 +65,6 @@ resource "kubectl_manifest" "prj_ingress" {
|
||||
rules: ${jsonencode(local.rules)}
|
||||
tls:
|
||||
- hosts: ${jsonencode(var.dns-names)}
|
||||
secretName: "${var.instance}${var.component==""?"":"-"}${var.component}-cert"
|
||||
secretName: "${var.instance}${var.secret-component!=""?"-${var.secret-component}":var.component==""?"":"-${var.component}"}-cert"
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -26,3 +26,20 @@ variable "middlewares" {
|
||||
}
|
||||
variable "service" {
|
||||
}
|
||||
|
||||
variable "create-redirect" {
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
variable "create-cert" {
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
variable "sub-path" {
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
variable "secret-component" {
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user