diff --git a/README.md b/README.md index e03655d..6d46a43 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,6 @@ See [example](example/) dir | [helm](#requirement\_helm) | >=2.6.0 | | [kubectl](#requirement\_kubectl) | 2.0.4 | | [kubernetes](#requirement\_kubernetes) | >=2.12.1 | -| [template](#requirement\_template) | >=2.2.0 | ## Providers @@ -32,7 +31,6 @@ See [example](example/) dir | [helm](#provider\_helm) | >=2.6.0 | | [kubectl](#provider\_kubectl) | 2.0.4 | | [kubernetes](#provider\_kubernetes) | >=2.12.1 | -| [template](#provider\_template) | >=2.2.0 | ## Modules @@ -50,7 +48,6 @@ No modules. | [kubernetes_config_map.logrotate_config](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/config_map) | resource | | [kubernetes_config_map.modsecurity_nginx_config](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/config_map) | resource | | [kubernetes_namespace.ingress_controllers](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | -| [template_file.nginx_ingress_default_certificate](https://registry.terraform.io/providers/hashicorp/template/latest/docs/data-sources/file) | data source | ## Inputs diff --git a/main.tf b/main.tf index 756e862..006365b 100644 --- a/main.tf +++ b/main.tf @@ -85,26 +85,16 @@ resource "helm_release" "nginx_ingress" { } } - -# Default Lets-Encrypt cert -data "template_file" "nginx_ingress_default_certificate" { - template = file( - "${path.module}/templates/default-certificate.yaml.tpl", - ) - - vars = { +resource "kubectl_manifest" "nginx_ingress_default_certificate" { + count = var.controller_name == "default" ? 1 : 0 + yaml_body = templatefile("${path.module}/templates/default-certificate.yaml.tpl", { apps_cluster_name = "*.apps.${var.cluster_domain_name}" cluster_name = "*.${var.cluster_domain_name}" namespace = "ingress-controllers" alt_name = var.is_live_cluster ? format("- '*.%s'", var.live_domain) : "" apps_alt_name = var.is_live_cluster ? format("- '*.apps.%s'", var.live_domain) : "" live1_dns = var.live1_cert_dns_name - } -} - -resource "kubectl_manifest" "nginx_ingress_default_certificate" { - count = var.controller_name == "default" ? 1 : 0 - yaml_body = data.template_file.nginx_ingress_default_certificate.rendered + }) depends_on = [ kubernetes_namespace.ingress_controllers diff --git a/versions.tf b/versions.tf index e60defc..4f93f12 100644 --- a/versions.tf +++ b/versions.tf @@ -8,10 +8,6 @@ terraform { source = "hashicorp/kubernetes" version = ">=2.12.1" } - template = { - source = "hashicorp/template" - version = ">=2.2.0" - } kubectl = { source = "alekc/kubectl" version = "2.0.4"