1

In the Knative documentation for enabling AutoTLS, it says that I need to add this to the data block in config-certmanager configmap:

issuerRef: |
  kind: ClusterIssuer
  name: letsencrypt-issuer

The only solution that I can think of is to use a null_resource resource with a kubectl patch command. However, doing this gives me the following error: Error running command 'kubectl patch configmap config-certmanager -n knative-serving --type merge --patch '{"data":{"issuerRef":"kind:ClusterIssuer"}}'': exit status 1. Output: Error from server: Invalid JSON Patch

I've tried to split the command in 2 parts. I also tried using a single null_resource for both rows (kind: ClusterIssuer and name: letsencrypt-issuer

My code:

resource "null_resource" "patch_config_certmanager_1" {
    provisioner "local-exec" {
        command = "kubectl patch configmap config-certmanager -n knative-serving --type merge --patch '{\"data\":{\"issuerRef\":\"kind:ClusterIssuer\"}}'"
    }
    
}
resource "null_resource" "patch_config_certmanager_2" {
    provisioner "local-exec" {
        command = "kubectl patch configmap config-certmanager -n knative-serving --type merge --patch '{\"data\":{\"issuerRef\":\"name:my-clusterissuer\"}}'"
    }
    
}

What am I doing wrong?

Daniel
  • 509
  • 1
  • 4
  • 17

0 Answers0