Skip to content

[datadog_observability_pipeline] Add processor groups instead of standalone processors#3346

Merged
dd-mergequeue[bot] merged 27 commits intomasterfrom
vladimir-dd/op-processor-groups
Dec 18, 2025
Merged

[datadog_observability_pipeline] Add processor groups instead of standalone processors#3346
dd-mergequeue[bot] merged 27 commits intomasterfrom
vladimir-dd/op-processor-groups

Conversation

@vladimir-dd
Copy link
Copy Markdown
Contributor

@vladimir-dd vladimir-dd commented Nov 24, 2025

Replace standalone processors with processor groups.

Before:

resource "datadog_observability_pipeline" "test" {
  name = "test pipeline"
  config {

    sources {
      kafka {
        id       = "source-1"
        group_id = "my-consumer-group"
        topics   = ["my-topic-1", "my-topic-2"]
      }
    }

    processors {
      parse_json {
        id      = "filter-1"
        include = "service:nginx"
        field   = "message2"
        inputs  = ["source-1"]
      }

      filter {
        id      = "filter-2"
        include = "service:nginx"
        inputs  = ["filter-1"]
      }
    }

    destinations {
      datadog_logs {
        id     = "sink-1"
        inputs = ["filter-3"]
      }
      
      amazon_s3 {
        id = "sink-2"
        inputs = ["filter-3]
        bucket = "my-bucket"
        region = "us-east-1"
      }
    }

  }
}

After:

resource "datadog_observability_pipeline" "test" {
  name = "test pipeline"
  config {

    source {
      id       = "source-1"
      kafka = {
        group_id = "my-consumer-group"
        topics   = ["my-topic-1", "my-topic-2"]
      }
    }

    processor_group {
      id = "group-1"
      inputs  = ["source-1"]
      include = "*"
      enabled = true
   
      processor {
        id      = "filter-1"
        include = "service:nginx"
        enabled = true
        parse_json = {
          field   = "message2"
        }
      }
      
      processor {
        id      = "filter-2"
        include = "service:nginx"
        enabled = true
        filter = {
        }
      }
    }

    destination {
       id     = "sink-1"
       inputs = ["filter-3"]
       datadog_logs = {
       }
     }
      
     destination {
       id = "sink-2"
       inputs = ["filter-3]
       amazon_s3 = {
         bucket = "my-bucket"
         region = "us-east-1"
      }
    }
  }
}

Important context:

  • processors is replaced with the list of processor_group's, which have individual processor blocks inside. Both processor_group and processor blocks have id, enabled and include;
  • processor blocks don't have inputs anymore, only processor groups;
  • processor wrappers are required to maintain the order of processors(TF tracks the order only for the blocks of the same type). See TestAccDatadogObservabilityPipeline_multipleProcessorGroups as an example test with reordering.
  • processor blocks(filter, parse_json etc.) must be ListNestedBlock with the size validation(<=1), because of the way TF handles optional blocks. If we use SingleNestedBlock(which makes more sense) for an optional block, which contains any required field, TF considers this block as required. This is a recommended workaround(see Disallow use of SingleNestedBlock in resource schemas hashicorp/terraform-provider-aws#35813 for example).

Replacing sources, destinations with source, destination

As in the example above, we have replaced single sources and destinations blocks with multiple source and destination blocks. This approach follows the TF convention for list blocks and lets us share common fields(id, inputs) at the component level.

Additional breaking changes combined together to avoid further breaking PRs

  • all ListNestedBlock's are renamed from plural forms to singular ones: remaps -> remap, variables -> variable etc. to follow the TF convention for list blocks;
  • all SingleNestedBlocks replaced with ListNestedBlocks to make the TF schema more robust, future-proof and eliminate potential breaking changes related to required/optional blocks and fields. See Disallow use of SingleNestedBlock in resource schemas hashicorp/terraform-provider-aws#35813 as an example of the same approach.

Suggested migration flow for existing resources

If you need to make immediate changes, you can safely downgrade your Datadog Terraform provider to 3.83.0 and make updates as before.

  1. Detach the pipeline from the Terraform state (this does not delete the pipeline!):
terraform state rm datadog_observability_pipeline.test_pipeline
  1. Open the pipeline in the UI and click Edit/Deploy (no actual changes required) - this will make the necessary config transformations on the API side. This step will make the pipeline incompatible with the previous Terraform provider versions.
  2. Import the existing pipeline back into the Terraform state:
terraform import datadog_observability_pipeline.test_pipeline 4bcf83a6-dcdc-11f0-8624-da7ad0900002
  1. Export the imported pipeline state into a HCL configuration:
terraform state show datadog_observability_pipeline.test_pipeline >> config.tf
  1. Review the imported configuration and remove the old one.
  2. Remove id field from the imported configuration.
  3. Verify there is no diff for the pipeline:
terraform plan --target=datadog_observability_pipeline.test_pipeline

@vladimir-dd vladimir-dd changed the title WIP: add processor groups [datadog_observability_pipeline] Add processor groups instead of standalone processors Nov 26, 2025
@vladimir-dd vladimir-dd marked this pull request as ready for review November 26, 2025 15:05
@vladimir-dd vladimir-dd requested a review from a team as a code owner November 26, 2025 15:05
@vladimir-dd vladimir-dd requested a review from a team November 26, 2025 15:06
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread datadog/fwprovider/resource_datadog_observability_pipeline.go
Copy link
Copy Markdown
Contributor

@20agbekodo 20agbekodo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good to me, especially with the updated tests.
Still, this is a lot to review (and I'm sure a lot to generate on your side) so it's hard to ensure no regression was introduced.
It could be really worthwhile to update the contribution process doc to reference the new additions/ enrich the LLM prompt used when adding/updating a single component

Comment thread datadog/fwprovider/resource_datadog_observability_pipeline.go
Comment thread datadog/fwprovider/observability_pipeline/custom_processor.go Outdated
Comment thread datadog/fwprovider/resource_datadog_observability_pipeline.go Outdated
Comment thread datadog/fwprovider/resource_datadog_observability_pipeline.go
Comment thread datadog/fwprovider/observability_pipeline/amazon_s3_destination.go
Comment thread datadog/tests/resource_datadog_observability_pipeline_test.go
Comment thread datadog/fwprovider/observability_pipeline/socket_destination.go
@vladimir-dd vladimir-dd force-pushed the vladimir-dd/op-processor-groups branch from 270f5ad to 1ac6d3e Compare December 17, 2025 14:10
Comment thread datadog/fwprovider/observability_pipeline/compression.go
NestedObject: schema.NestedBlockObject{
Attributes: map[string]schema.Attribute{
"method": schema.StringAttribute{
Required: true,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Comment thread datadog/fwprovider/observability_pipeline/socket_source.go
Comment thread datadog/fwprovider/observability_pipeline/tls.go
Comment thread datadog/fwprovider/resource_datadog_observability_pipeline.go
Comment thread datadog/fwprovider/resource_datadog_observability_pipeline.go
@vladimir-dd vladimir-dd force-pushed the vladimir-dd/op-processor-groups branch from 1ac6d3e to 112f598 Compare December 17, 2025 14:33
@vladimir-dd vladimir-dd requested a review from a team as a code owner December 17, 2025 16:09
Copy link
Copy Markdown

@brett0000FF brett0000FF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just a few tiny nits on the docs.

Comment thread docs/resources/observability_pipeline.md Outdated
Comment thread docs/resources/observability_pipeline.md Outdated
Comment thread docs/resources/observability_pipeline.md Outdated
Copy link
Copy Markdown
Contributor

@20agbekodo 20agbekodo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Indeed it's a lot to review but the tests bring confidence.
I also see you changed the confluence doc on how to contribute.
Is it possible to add a test to expect an error when not filling a newly required nested field?

@vladimir-dd
Copy link
Copy Markdown
Contributor Author

Is it possible to add a test to expect an error when not filling a newly required nested field?

In general yes, but this would require adding quite a few tests to basically double-check whether the field is marked as Required or not... I'm hoping we could find a way to generate different pipeline configs and validating them outside the standard TF testing framework for more thorough testing.

@vladimir-dd
Copy link
Copy Markdown
Contributor Author

/merge

@dd-devflow-routing-codex
Copy link
Copy Markdown

dd-devflow-routing-codex Bot commented Dec 18, 2025

View all feedbacks in Devflow UI.

2025-12-18 13:28:51 UTC ℹ️ Start processing command /merge


2025-12-18 13:28:56 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 29m (p90).


2025-12-18 13:57:28 UTC ℹ️ MergeQueue: This merge request was merged

@dd-mergequeue dd-mergequeue Bot merged commit 0c8a1f7 into master Dec 18, 2025
13 checks passed
@dd-mergequeue dd-mergequeue Bot deleted the vladimir-dd/op-processor-groups branch December 18, 2025 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants