if i make a kubernetes namespace, and then want to...
# general
b
if i make a kubernetes namespace, and then want to use that namespace later on resources, is there a way to make it show up in the diff on the resources? it just appears as
output<string>
, even though the namespace resource shows the actual string
b
it needs to know name upfront, instead of using namespace resource name, use same input for both namespace and resources in that namespace and use ` {dependsOn: []} option for resources to enforce order
so instead of (pseudocode):
Copy code
const name = "x";
const ns = new k8s.Namespace(name)
const cfg = new k8s.Configmap("abc", { namespace: ns.name })
do
Copy code
const name = "x";
const ns = new k8s.Namespace(name)
const cfg = new k8s.Configmap("abc", { namespace: name }, {dependsOn: [ns]})
b
unfortunately, can't do that because of pulumi's name mangling
i.e. the namespace isn't actually
name
, it's e.g.
name-tld6bkwm
b
try
new k8s.Namespace(name, { name: name })
usually it forces name of a resource you want
b
do you mean as the second or third argument?
g
@bitter-dentist-28132 You should be able to reference the ns
.metadata.name
b
@gorgeous-egg-16927 that's what i'm doing, but it appears as
output<string>
in the preview/diff
b
@bitter-dentist-28132, second
g
Would you mind opening an issue about that? We’ve been working on some changes to diff behavior lately, and that could be a regression.
b
@best-xylophone-83824 i guess you mean to use
{metadata: {name: name}}
since that's what's accepted by the type. which, interestingly, does then show the actual output in the diff, even when using
namespaceResource.metadata.name
filed the ticket.
🙏 1