Skip to content

feat: enforce monotonicity in terraform provider #392

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented May 6, 2025

Previous value must come from env var. This change has to be made in coder/coder to take advantage of this.

CODER_PARAMETER_PREVIOUS_<hash>

Unfortunately reading from tfstate requires the block to be a resource block. This is because a data block only has access to the Read context.

https://github.com/hashicorp/terraform-plugin-sdk/blob/main/helper/schema/resource.go#L287-L354
Read

// The *ResourceData parameter contains the state data for this managed
// resource instance or data resource instance.

Update

// The ResourceData parameter contains the plan and state data for this
// managed resource instance. The available data in the Get
methods is the
// the proposed state, which is the merged data of the prior state,
// practitioner configuration, and any CustomizeDiff field logic. The
// available data for the GetChange* and HasChange* methods is the prior
// state and proposed state.

coder/coder PR in progress coder/coder#17696

@Emyrk Emyrk requested a review from spikecurtis May 6, 2025 21:30
Base automatically changed from stevenmasley/value_validate to main May 7, 2025 13:01
Emyrk added 2 commits May 7, 2025 09:30
Previous value must come from env var. To read tfstate requires
changing param from a `data` block to a `resource` block
@Emyrk Emyrk force-pushed the stevenmasley/monotonic branch from e011f73 to 6f94a4b Compare May 7, 2025 14:30
@Emyrk Emyrk requested review from johnstcn and SasSwart and removed request for johnstcn May 7, 2025 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant