https://pulumi.com logo
#kubernetes
Title
# kubernetes
e

eager-wall-56838

03/17/2024, 3:21 PM
Hi folks, how can I depend on a spec field of a custom resource?
Copy code
export const cert = new k8s.apiextensions.CustomResource(
  "cert",
  {
    apiVersion: "<http://cert-manager.io/v1|cert-manager.io/v1>",
    kind: "Certificate",
    spec: {
      secretName: "foo-bar",
      dnsNames: ["example.default.svc.cluster.local"],
      issuerRef: { .. },
    },
  }
)
I need to get
secretName
to reference in a subsequent deployment. My workaround is to make
const certSecretName = "foo-bar"
then reference it in both places and add a dependsOn, but that's not great. Thanks!
d

dry-keyboard-94795

03/17/2024, 3:50 PM
You should be able to do
cert.spec.secretName
e

eager-wall-56838

03/17/2024, 4:28 PM
I get
Property 'spec' does not exist on type 'CustomResource'.ts(2339)
d

dry-keyboard-94795

03/17/2024, 4:46 PM
Oh, this is odd. It looks like the sdk isn't generating properly for node, as
spec
is missing
So, I think it's just a type error; at runtime it should still be accessible
e

eager-wall-56838

03/17/2024, 7:35 PM
sounds like a bug then
I'm using typescript, I can't really ignore errors (easily)
d

dry-keyboard-94795

03/17/2024, 7:38 PM
Yeah, you'd need to do
(cert as any).spec
e

eager-wall-56838

03/17/2024, 7:38 PM
ah will try thank you
I'll also file a bug
d

dry-keyboard-94795

03/17/2024, 7:39 PM
Thanks