Skip to content

feat: Validate monotonicity for coder_parameter #90

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

Merged
merged 2 commits into from
Feb 3, 2023

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented Feb 3, 2023

Related: coder/coder#5574
Related: coder/coder#5978

This PR adds a new validation property monotonic to the coder_parameter. Unfortunately, we can only validate the format within the Terraform runner, but a comparison of values, current and new, will be performed on the coderd API level.

@mtojek mtojek self-assigned this Feb 3, 2023
@mtojek mtojek requested a review from kylecarbs February 3, 2023 10:21
@mtojek mtojek marked this pull request as ready for review February 3, 2023 10:21
"monotonic": {
Type: schema.TypeString,
Optional: true,
Description: "Number monotonicity, either increasing or decreasing.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious: Why don't we use a validation func here?

(I do see the check in valueIsType, it's just not obvious why we're doing that instead of validation func.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will pass this question to @kylecarbs who originally implemented this code. I deduce that this is due to the compliance with terraform-plugin-sdk?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure actually...

@mtojek mtojek merged commit 22f160d into coder:main Feb 3, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Feb 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants