- Notifications
You must be signed in to change notification settings - Fork938
chore: modify parameter dynamic immutability behavior#18583
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
b12a492
to7e4ef44
CompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull Request Overview
This PR updates dynamic parameter immutability so that a parameter’s mutability is determined solely by its current state rather than its prior state.
- Adds a Terraform test scenario for dynamic immutability in
testdata
. - Introduces two new integration tests (
PreviouslyImmutable
,PreviouslyMutable
) and a unit test (BecameImmutable
) to capture dynamic behavior. - Refactors
ResolveParameters
to drop the oldoriginalValues
map and usepreviousValuesMap
directly when validating immutability.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
enterprise/coderd/testdata/parameters/dynamicimmutable/main.tf | Adds Terraform snippet for dynamic immutability testing. |
enterprise/coderd/dynamicparameters_test.go | Adds integration tests covering parameters that flip mutability. |
coderd/dynamicparameters/resolver_test.go | Adds a unit test for a parameter transitioning from mutable to immutable. |
coderd/dynamicparameters/resolver.go | Removes theoriginalValues cache and usespreviousValuesMap for immutability checks. |
Uh oh!
There was an error while loading.Please reload this page.
00ba027
intomainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Parameter
mutablity
is determined by the current state. So a previouslyimmutable
parameter can becomemutable
.Terraform:
Trivial Case:
isimmutable = true
&immutable = "bar"
immutable = foo
Immutability source from the past
isimmutable = true
&immutable = "bar"
immutable = foo
&isimmutable = false
mutable = true
Why ignore the previous parameter state?
Ignoring previous state is vastly simplier and more intuitive. If the previous parameter
mutability
affected the current build, then questions such as, "What if the last build failed? Do we take the last successful build?", etc.