fix: assertion plan-time validation, devhelm_secret data source, alert-channel drift detection - #36
Merged
Conversation
…t-channel drift detection - Add validateAssertionConfigJSON: decodes each assertion's `config` JSON against the generated per-type struct at plan time, catching value-type mismatches (e.g. numeric `expected` where the API wants a string), typos, case-mismatched keys, and missing required fields — instead of failing apply with "Provider produced inconsistent result". - Add devhelm_secret data source: look up secrets by key (List + filter), returning id, key, and value_hash (never the plaintext value). - Detect out-of-band alert-channel config drift in Read: when the server's configHash diverges from state, preserve the stored hash and null the write-only config attrs (via clearAlertChannelConfigAttrs) so the next plan shows a diff and Update re-pushes the declared config. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three confirmed bugs fixed:
1. Assertion config plan-time validation
assertions[].configis a JSON string — users writejsonencode({expected = 200})but the API expects"200"(string). Previously this planned cleanly but failed at apply with "Provider produced inconsistent result." NowvalidateAssertionConfigJSONdecodes against the generated per-assertion-type structs at plan time, catching type mismatches, unknown keys, and missing required fields before apply.2.
devhelm_secretdata sourceNew data source for looking up secrets by key name (users previously had to hardcode UUIDs). Returns
id,key,value_hash— never the plaintext value.3. Alert-channel config drift detection
Read()now compares the server'sconfigHashagainst the stored state hash. On divergence, it preserves the old hash and nulls the write-only config attributes so the nextterraform planshows a diff andUpdatere-pushes the HCL-declared config.Test plan
go build ./...— cleango vet ./...— cleango test ./...— all packages passMade with Cursor