https://pulumi.com logo
#general
Title
# general
d

damp-room-71337

10/07/2019, 11:09 AM
looks like
getResourceProperty
doesn’t like namespace values that are passed as Pulumi a `Output`:
Copy code
const k8sProvider = new k8s.Provider("k8s-provider", {
  suppressDeprecationWarnings: true,
  namespace: "dev"
});
const port = mysql.getResourceProperty(
  "v1/Service",
  k8sProvider.namespace,
  name,
  "spec"
).ports[0].port;
that raises a
Cannot read property 'spec' of undefined
error, unless I change
k8sProvider.namespace
in
getResourceProperty
to a string literal - `pulumi.interpolate`/`apply()` doesn’t have an effect either
g

gorgeous-egg-16927

10/07/2019, 3:35 PM
It looks like the problem is that the
namespace
property is not exposed on
k8s.Provider
, so you’re actually passing
undefined
into the
getResourceProperty
method. I’d recommend referencing the namespace name in both the
Provider
and
getResourceProperty
from the same variable (e.g., the Namespace object).
d

damp-room-71337

10/07/2019, 3:37 PM
fair enough, that’s what I’ve ended up doing - it’s a shame I have to pass the same bit of info into a resource twice though