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

feat: allow validation to be used with options #202

Merged
merged 5 commits into from
Mar 22, 2024

Conversation

dannykopping
Copy link
Contributor

Addresses coder/coder#11579, PR in coder/coder will close

Currently we have a conflict declared between option and validation configs in coder_parameter Terraform resources (@mtojek do you have some historical context as to why that was the case?).

This PR removes that conflict since there is nothing inherent in the codebase disallowing them, and we need to allow both to to accommodate the use-case mentioned in the linked issue.

I expanded the tests and added documentation for testing the provider locally.

Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
@mtojek
Copy link
Member

mtojek commented Mar 22, 2024

Currently we have a conflict declared between option and validation configs in coder_parameter Terraform resources (@mtojek do you have some historical context as to why that was the case?).

Yes, the initial implementation just assumed so. I'm sure the constraint can be relaxed now.

@dannykopping dannykopping marked this pull request as ready for review March 22, 2024 10:03
}
}
```
2. Run `terraform init` and observe a warning like `Warning: Provider development overrides are in effect`
Copy link
Member

Choose a reason for hiding this comment

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

Nice trick!

Config: `
data "coder_parameter" "region" {
name = "Region"
type = "number"
Copy link
Member

Choose a reason for hiding this comment

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

nit: formatting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh weird, my editor is probably handling tabs in a strange way. Thanks 👍

}

validation {
monotonic = "increasing"
Copy link
Member

Choose a reason for hiding this comment

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

nit: indent

@@ -424,6 +440,54 @@ data "coder_parameter" "region" {
require.Equal(t, expected, state.Primary.Attributes[key])
}
},
}, {
Name: "NumberValidation_MonotonicWithOptions",
Copy link
Member

Choose a reason for hiding this comment

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

I used to drop an example here as well.

Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

Great!

@dannykopping dannykopping merged commit ec5b604 into coder:main Mar 22, 2024
11 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 22, 2024
@dannykopping dannykopping deleted the dk/monotonic branch March 22, 2024 13:05
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.

None yet

2 participants