fix: prevent deletion of protected logs index (fixes #3470)#3471
Open
AndrewCharlesHay wants to merge 2 commits intoDataDog:masterfrom
Open
fix: prevent deletion of protected logs index (fixes #3470)#3471AndrewCharlesHay wants to merge 2 commits intoDataDog:masterfrom
AndrewCharlesHay wants to merge 2 commits intoDataDog:masterfrom
Conversation
fpighi
requested changes
Feb 4, 2026
Member
fpighi
left a comment
There was a problem hiding this comment.
Thanks for this. Could you write a test and also regenerate docs with make docs please?
| "prevent_deletion": { | ||
| Description: "If true, the logs index cannot be deleted. Defaults to false.", | ||
| Type: schema.TypeBool, | ||
| Optional: true, |
Member
There was a problem hiding this comment.
Having an explicit default here would make it consistent and auto-generated docs would benefit from it too, so the "Defaults to false" description could be removed.
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.
Description
This PR adds a new optional argument
prevent_deletionto thedatadog_logs_indexresource.When set to
true, this flag safeguards the index from being deleted by Terraform. Any attempt to destroy the resource will result in a diagnostic error, preventing accidental loss of critical indexes (such as the defaultmainindex).Fixes #3470
Schema Changes
prevent_deletion(Boolean, Optional): If true, the logs index cannot be deleted. Defaults tofalse.Use Case
To protect the main index:
If a user attempts
terraform destroyor removes this block, the provider will return:Deletion of logs index 'main' is prevented by 'prevent_deletion' flagTo allow deletion, the user must explicitly set
prevent_deletion = falseand apply, before destroying.