feat: add datadog_tag_indexing_rule, _exemption, and _order resources#3863
Draft
chuck wants to merge 1 commit into
Draft
feat: add datadog_tag_indexing_rule, _exemption, and _order resources#3863chuck wants to merge 1 commit into
chuck wants to merge 1 commit into
Conversation
… [WIP]
Three new Plugin Framework resources backed by the v2 tag-indexing-rule
API endpoints in the Datadog metrics-governance service:
datadog_tag_indexing_rule
CRUD resource keyed by UUID. rule_order is computed-only (server-
assigns max+1 on create). Use datadog_tag_indexing_rule_order to
control evaluation order atomically.
datadog_tag_indexing_rule_exemption
Singleton per metric_name. Exempts a metric from all tag indexing
rules. Both metric_name and reason are RequiresReplace (no in-place
update; the API has no PATCH). Read returns nil state when the
kind=legacy_tag_configuration — that state is managed separately
via datadog_metric_tag_configuration.
datadog_tag_indexing_rule_order
Singleton list resource mirroring datadog_logs_pipeline_order.
Create and Update both call POST /api/v2/metrics/tag-indexing-
rules/order (atomic re-sequence). Delete is a no-op. Read derives
current order from ListTagIndexingRules sorted by rule_order.
NOTE: This PR is a DRAFT blocked on the datadog-api-client-go PR that
will be auto-generated once datadog-api-spec#5837 merges. The build
currently fails with undefined datadogV2.TagIndexingRule* errors.
Once the client PR lands: update go.mod, remove the NOTE comments,
and run go build ./... to verify.
All three resources use GetMetricsApiV2() which already exists in
api_instances_helper.go.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.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
Adds three new resources for managing Datadog tag indexing rules via Terraform. Tag indexing rules control which tag keys are indexed for custom metrics, reducing cardinality costs while preserving queryability.
New resources
datadog_tag_indexing_ruleFull CRUD resource.
rule_orderis computed-only (server assignsmax+1on create); usedatadog_tag_indexing_rule_orderfor atomic re-sequencing.datadog_tag_indexing_rule_exemptionExempts a specific metric from all tag indexing rules.
metric_nameandreasonare bothRequiresReplace(no in-place update; the API has no PATCH endpoint). Read removes state whenkind=legacy_tag_configurationsince that state is managed viadatadog_metric_tag_configuration, not this resource.datadog_tag_indexing_rule_orderSingleton list resource (modeled on
datadog_logs_pipeline_order) that atomically re-sequences all rules. Create and Update both callPOST /api/v2/metrics/tag-indexing-rules/order. Delete is a no-op (ordering cannot be deleted from the API).Design notes
GetMetricsApiV2(), which already exists inapi_instances_helper.go.datadog_tag_indexing_rule_exemption.Readexplicitly handles thekind=legacy_tag_configurationcase by removing the resource from state — this resource only manages explicit exemptions, not implicit ones from legacy tag configurations.datadog_tag_indexing_rule_order.ReadcallsListTagIndexingRulesand derives order fromrule_orderfield sorted ascending.Blocker
This PR is blocked on two upstream PRs that add
TagIndexingRule*types and methods todatadogV2.MetricsApi:#api-platformmerge)Once the client PR merges:
go get github.com/DataDog/datadog-api-client-go/v2@<new-version>go mod tidyNOTE:comments from the three resource filesgo build ./...to verifyTest plan
terraform planandterraform applywith example configs against staging🤖 Generated with Claude Code