Repository navigation
fix: clear dispatch_index_earliest and dispatch_index_latest when removed - #257
Merged
rrossetti-splunk merged 1 commit intoOct 28, 2026
Merged
Conversation
Contributor
Author
|
@rrossetti-splunk, could you review this when you have a chance? It lets |
rrossetti-splunk
approved these changes
Oct 28, 2026
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.
Removing
dispatch_index_earliestordispatch_index_latestfrom asplunk_saved_searchesresource, or setting either tonullor"", leaves the old value in Splunk, andterraform planreports no changes. Once an index-time window is set, Terraform can't clear it.Refs #35, #72
Reproduce (v1.6.1)
dispatch_index_earliest = "-10m"anddispatch_index_latest = "-5m".nullor"".terraform planreports no changes, and Splunk still hasdispatch.index_earliest = -10m.Cause
key=.OptionalandComputed. The SDK keeps the prior value when the attribute is missing and treats""as unset, so the plan never shows a change.EncodeObjectdrops every empty value, and both fields are taggedomitempty.Change
Computedfrom both attributes. Splunk's default for both is empty, so configurations that never set them plan no change.UpdateSavedSearchestakes the keys to clear and appends each askey=after the normal encoding. The resource passes a key only when its attribute changed to empty, so no other empty value is posted.Behavior change
A saved search whose index window was set outside Terraform, and not in the configuration, now plans a change that clears it.
Suggested changelog entry:
splunk_saved_searchesclearsdispatch_index_earliestanddispatch_index_latestwhen they are removed from the configuration or set to"". A value set outside Terraform and missing from the configuration is cleared on the next applyTesting
TestSavedSearchesUpdateClearsDispatchIndexWindowplans and applies against a server that keeps omitted keys. It checks that removing the attributes or setting them to""clears them, the next plan is clean, no other empty value is posted, a later unrelated change doesn't resend the clear, and setting the window again posts only the new value.TestAccSplunkSavedSearchesDispatchIndexClearedruns set, remove, set, empty against Splunk.Computed, not passing the keys, clearing on every update, clearing on any change) fails it.go test ./...and golangci-lint v1.61 pass. The repository's test workflow passes against Splunk 10.6.1 (splunk/splunk:latest), including the new acceptance test.