Skip to content

[datadog_integration_gcp] Remove default value for HostFilters#3489

Open
katherinekim-51 wants to merge 1 commit intomasterfrom
katherinekim-3282
Open

[datadog_integration_gcp] Remove default value for HostFilters#3489
katherinekim-51 wants to merge 1 commit intomasterfrom
katherinekim-3282

Conversation

@katherinekim-51
Copy link
Contributor

@katherinekim-51 katherinekim-51 commented Feb 3, 2026

Primary reviewer(s):

Description

https://datadoghq.atlassian.net/browse/GCP-3282

Right now, if a user tries to "clear" host filters on update (ie. user omits them because it is deprecated and they moved to using mrcs), the terraform provider returns an inconsistent plan after apply. This fixes that issue

Implementation Details

From a terraform pov, this was happening because we had a default value being set for host filters as "", which defeated the purpose of setting this to computed; so we pass "" in the update, in the server when we merge host_filters with mrcs host_filters becomes computed with "xyz" and to terraform that looks inconsistent. This removes the default value and updates the request body to only be set when the value is known.

Testing Guidelines

Added test and ran cassettes

@katherinekim-51 katherinekim-51 changed the title remove host filters default [datadog_integration_gcp] Remove default value for HostFilters Feb 3, 2026
@katherinekim-51 katherinekim-51 marked this pull request as ready for review February 3, 2026 21:55
@katherinekim-51 katherinekim-51 requested review from a team as code owners February 3, 2026 21:55
@dtru-ddog dtru-ddog requested a review from ash-ddog February 4, 2026 15:13
Copy link
Contributor

@ash-ddog ash-ddog left a comment

Choose a reason for hiding this comment

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

Couple of nits but LGTM, thanks for the fix! 🙏

"github.com/terraform-providers/terraform-provider-datadog/datadog/fwprovider"
)

func TestAccDatadogHostFiltersBug(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you link the GitHub issue here and add to the PR description? (i.e fixes <issue_link>)

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also rename the test to be more explicit about which bug is being fixed?

i.e. TestLegacy_WhenReplacingHostFiltersWithMRC_Succeeds or something like this

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.

3 participants