resource "kubectl_manifest" "issuer" {
  yaml_body  = <<-EOF
    apiVersion: "cert-manager.io/v1"
    kind: "Issuer"
    metadata:
      name: "fission-selfsigned"
      namespace: "${var.namespace}"
      labels: ${jsonencode(local.common-labels)}
    spec:
      selfSigned: {}
  EOF
}
resource "kubectl_manifest" "fission-webhook-certs" {
  yaml_body  = <<-EOF
    apiVersion: cert-manager.io/v1
    kind: Certificate
    metadata:
      name: "fission-webhook-certs"
      labels: ${jsonencode(local.common-labels)}
      namespace: ${var.namespace}
    spec:
      dnsNames:
      - webhook-service
      - webhook-service.${var.namespace}
      - webhook-service.${var.namespace}.svc
      - webhook-service.${var.namespace}.svc.cluster.local
      issuerRef:
        kind: Issuer
        name: fission-selfsigned
      secretName: fission-webhook-certs
      subject:
        organizationalUnits:
        - fission-webhook
  EOF
}
