Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get CustomeResource .metadata field if original input does not specify one #3510

Open
rquitales opened this issue Feb 20, 2025 · 0 comments · May be fixed by #3511
Open

Unable to get CustomeResource .metadata field if original input does not specify one #3510

rquitales opened this issue Feb 20, 2025 · 0 comments · May be fixed by #3511
Labels
kind/bug Some behavior is incorrect or out of spec

Comments

@rquitales
Copy link
Member

What happened?

When create a CustomResource in Typescript, if you don't specify the metadata field as an input arg, you are unable to get the metadata field as an output.

Note: this was only tested in typescript, and not the other language overlays.

Example

This errors:

// Deploy the "random-yaml" program from the github.com/pulumi/examples repository.
const k8sStack = new k8s.apiextensions.CustomResource("random-yaml", {
  apiVersion: 'pulumi.com/v1',
  kind: 'Stack',
  spec: {
      projectRepo: "https://github.com/pulumi/examples",
      repoDir: "random-yaml/",
      branch: "master",
      shallow: true,
      stack: "pulumi-ts",
      refresh: true,
      destroyOnFinalize: true,
      workspaceTemplate: {
          spec: {
              image: "pulumi/pulumi:3.147.0-nonroot",
          },
      },
  },
}, { provider });


export const stackName = k8sStack.metadata.name;

This works:

// Deploy the "random-yaml" program from the github.com/pulumi/examples repository.
const k8sstack = new k8s.apiextensions.CustomResource("random-yaml", {
  apiVersion: 'pulumi.com/v1',
  kind: 'Stack',
  metadata: {}, // <-------------------------------------------------- Added field
  spec: {
      projectRepo: "https://github.com/pulumi/examples",
      repoDir: "random-yaml/",
      branch: "master",
      shallow: true,
      stack: "pulumi-ts",
      refresh: true,
      destroyOnFinalize: true,
      workspaceTemplate: {
          spec: {
              image: "pulumi/pulumi:3.147.0-nonroot",
          },
      },
  },
}, { provider });


export const stackName = k8sstack.metadata.name;

Output of pulumi about

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@rquitales rquitales added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team and removed needs-triage Needs attention from the triage team labels Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant