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

Resource Validation for undefined inputs #352

Open
damyngz opened this issue Jun 12, 2024 · 1 comment
Open

Resource Validation for undefined inputs #352

damyngz opened this issue Jun 12, 2024 · 1 comment
Labels
kind/enhancement Improvements or new features

Comments

@damyngz
Copy link

damyngz commented Jun 12, 2024

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

I want to be able to detect undefined inputs for a resource like say, a helm Release resource

{
            name: "helm-release-unfixed-version",
            description: "Prevents Helm Release from having unspecified version.",
            enforcementLevel: "mandatory",
            validateResource: validateResourceOfType(k8s.helm.v3.Release, (resource, args, reportViolation) => {
                if (args.props.version == undefined) {
                    reportViolation("You must fix the version of the helm release.");
                }
            }),
}

This can be traditionally achieved via a stackTransformation like so:

pulumi.runtime.registerStackTransformation((resource) => {
        if (resource.type === "kubernetes:helm.sh/v3:Release") {
            if (resource.props.version === undefined) { throw new pulumi.RunError(`helm version if unfixed for release: ${resource.name}`) }
        } return undefined
    })

but I would prefer to do it via policy validation if possible so i dont have to litter the stack with transformations.

Affected area/feature

@damyngz damyngz added kind/enhancement Improvements or new features needs-triage Needs attention from the triage team labels Jun 12, 2024
@tgummerer tgummerer removed the needs-triage Needs attention from the triage team label Jun 17, 2024
@tgummerer
Copy link
Contributor

Thanks for the suggestion! That seems like a reasonable enhancement request to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

2 participants