core.v1.Secret.metadata.name should not be a secret output #1464
Labels
kind/bug
Some behavior is incorrect or out of spec
last-applied-configuration
Issues related to the last-applied-configuration annotation
resolution/fixed
This issue was fixed
Problem description
When creating a
core.v1.Secret
, you can access its (auto-generated) name viasecret.metadata.name
. Unfortunately though if one of the inputs to the resource is marked as being secret, the wholev1.Secret
is marked as being secret, including its metadata output and thus also its name.While I don't know the reason why the "is-secret" attribute leaks from the
data
orstringData
input to themetadata
output, I can give a very simple example where this is really unpleasant: mounting secrets in a pod's environment. You basically have two choices:secretKeyRef.name
tosecret.metadata.name
which will lead to the wholecontainer
being marked as secret. This prevents you from previewing important diffs, e.g. to the container environment, volume mounts, etc.secret.metadata.name
to a hardcoded value and use that same value forsecretKeyRef.name
. This should eliminate the "is-secret" status from the output, but then (1) you don't have auto-naming from pulumi and (2) the dependency between the secret and the pod is lost, which can potentially cause issues on updates.IMO
secret.metadata.name
should not be treated as a secret output in that case, but as I said, I don't know if there might be a good reason for that choice. My current assumption is that this has something to do with thelast-applied-configuration
annotation (which itself seems to cause some controversy in several currently open issues here), but I'm not sure.I'd be thankful if there is some kind of workaround for this to enable us to diff the container updates correctly again.
Reproducing the issue
This code should illustrate the issue. If you switch the commented lines around
secretValue
you should be able to see how the exportedsecretName
changes between being printed as a regular output and a secret output.Funnily, when switching from non-secret to secret the preview before the prompt in
pulumi up
even shows the actual secret name, but if you selectyes
and let it update the secret, the final output will be[secret]
:The text was updated successfully, but these errors were encountered: