Pulumi kubernetes secret not creating all data keys

1/24/2020

I've declared a kubernetes secret in pulumi like:

const tlsSecret = new k8s.core.v1.Secret('tlsSecret', {
  metadata: {
    name: 'star.builds.qwil.co'
  },
  data: {
    'tls.crt': tlsCert,
    'tls.key': tlsKey
  }
});

However, I'm finding that when the secret is created only tls.key is present in the secret. When I look at the Diff View from the pulumi deployment on app.pulumi.com I see the following:

tlsSecret (kubernetes:core:Secret)
+  kubernetes:core/v1:Secret (create)
    [urn=urn:pulumi:local::ledger::kubernetes:core/v1:Secret::tlsSecret]
    apiVersion: "v1"
    data      : {
        tls.key: "[secret]"
    }
    kind      : "Secret"
    metadata  : {
        labels: {
            app.kubernetes.io/managed-by: "pulumi"
        }
        name  : "star.builds.qwil.co"
    }

Why is only tls.key being picked up even though I've also specified a tls.crt?

-- Paymahn Moghadasian
kubernetes
pulumi

1 Answer

1/24/2020

Turns out the variable tlsCert was false-y (I was loading it from config with the wrong key for Config.get()). Pulumi was smart and didn't create a secret with an empty string.

-- Paymahn Moghadasian
Source: StackOverflow