Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Provider produced inconsistent result after apply #2415

Open
Chaitu006 opened this issue May 23, 2024 · 1 comment · May be fixed by #2482
Open

Error: Provider produced inconsistent result after apply #2415

Chaitu006 opened this issue May 23, 2024 · 1 comment · May be fixed by #2482
Assignees
Labels

Comments

@Chaitu006
Copy link

Datadog Terraform Provider Version

3.38.0

Terraform Version

v1.3.7

What resources or data sources are affected?

datadog_apm_retention_filter

I tried upgrading to the latest(v3.39.0) and also downgrading the version to below and I still see the error, please take a look and let us know how to fix it.

provider "registry.terraform.io/datadog/datadog" {
version = "3.38.0"
constraints = "3.38.0"

provider "registry.terraform.io/hashicorp/aws" {
version = "5.42.0"
constraints = "5.42.0"

I tried to create APM retention filters using terraform, but when I try to terraform apply I see below error

Error: Provider produced inconsistent result after apply
│
│ When applying changes to
│ datadog_apm_retention_filter.showmetherent_listing_details_load_time,
│ provider "provider[\"http://registry.terraform.io/datadog/datadog%5C%22%5D%22  produced an
│ unexpected new value: .filter.query: was cty.StringVal("app:showmetherent
│ service:showmetherent-express env:production
│ @http.path_group:'/listing/details/?/?' @http.method:GET
│ @http.status_code:200 @duration:>600ms"), but now
│ cty.StringVal("app:showmetherent AND service:showmetherent\\-express AND
│ env:production AND @http.path_group:'/listing/details/?/?' AND
│ @http.method:GET AND @http.status_code:200 AND @duration:>600000000").
│
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to
│ datadog_apm_retention_filter.showmetherent_listing_page_load_time, provider
│ "provider[\"http://registry.terraform.io/datadog/datadog%5C%22%5D%22  produced an
│ unexpected new value: .filter.query: was
│ cty.StringVal("service:showmetherent-express @http.path_group:'/listings'
│ app:showmetherent @http.method:HEAD env:production @http.status_code:200
│ @duration:>1500ms"), but now cty.StringVal("service:showmetherent\\-express
│ AND @http.path_group:'\\/listings' AND app:showmetherent AND
│ @http.method:HEAD AND env:production AND @http.status_code:200 AND
│ @duration:>1500000000").
│
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to
│ datadog_apm_retention_filter.showmetherent_home_page_load_time, provider
│ "provider[\"http://registry.terraform.io/datadog/datadog%5C%22%5D%22  produced an
│ unexpected new value: .filter.query: was
│ cty.StringVal("service:showmetherent-express env:production
│ @http.path_group:'/' @http.method:GET app:showmetherent
│ @http.status_code:200 @duration:>600ms"), but now
│ cty.StringVal("service:showmetherent\\-express AND env:production AND
│ @http.path_group:'\\/' AND @http.method:GET AND app:showmetherent AND
│ @http.status_code:200 AND @duration:>600000000").
│
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

I'm using the latest provider version v3.39.0 (https://github.com/DataDog/terraform-provider-datadog/releases/tag/v3.39.0)

This is the code that I'm using to create these retention filters

Terraform Configuration Files

resource "datadog_apm_retention_filter" "showmetherent_home_page_load_time" {
  name        = "ShowMeTheRent Home Page Load Time"
  rate        = "1.0"
  filter {
    query     = "service:showmetherent-express env:production @http.path_group:'/' @http.method:GET app:showmetherent @http.status_code:200 @duration:>600ms"
  }
  filter_type = "spans-sampling-processor"
  enabled     = true
}

resource "datadog_apm_retention_filter" "showmetherent_listing_details_load_time" {
  name        = "ShowMeTheRent Listing Details Load Time"
  rate        = "1.0"
  filter {
    query     = "app:showmetherent service:showmetherent-express env:production @http.path_group:'/listing/details/?/?' @http.method:GET @http.status_code:200 @duration:>600ms"
  }
  filter_type = "spans-sampling-processor"
  enabled     = true
}

resource "datadog_apm_retention_filter" "showmetherent_listing_page_load_time" {
  name        = "ShowMeTheRent Listing Page Load Time"
  rate        = "1.0"
  filter {
    query     = "service:showmetherent-express @http.path_group:'/listings' app:showmetherent @http.method:HEAD env:production @http.status_code:200 @duration:>1500ms"
  }
  filter_type = "spans-sampling-processor"
  enabled     = true
}

Relevant debug or panic output

Error: Provider produced inconsistent result after apply

│ When applying changes to
│ datadog_apm_retention_filter.showmetherent_listing_details_load_time,
│ provider "provider["registry.terraform.io/datadog/datadog"]" produced an
│ unexpected new value: .filter.query: was cty.StringVal("app:showmetherent
│ service:showmetherent-express env:production
│ @http.path_group:'/listing/details/?/?' @http.method:GET
@http.status_code:200 @duration:>600ms"), but now
│ cty.StringVal("app:showmetherent AND service:showmetherent\-express AND
│ env:production AND @http.path_group:'/listing/details/?/?' AND
│ @http.method:GET AND @http.status_code:200 AND @duration:>600000000").

│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.


│ Error: Provider produced inconsistent result after apply

│ When applying changes to
│ datadog_apm_retention_filter.showmetherent_home_page_load_time, provider
│ "provider["registry.terraform.io/datadog/datadog"]" produced an
│ unexpected new value: .filter.query: was
│ cty.StringVal("service:showmetherent-express env:production
│ @http.path_group:'/' @http.method:GET app:showmetherent
@http.status_code:200 @duration:>600ms"), but now
│ cty.StringVal("service:showmetherent\-express AND env:production AND
│ @http.path_group:'\/' AND @http.method:GET AND app:showmetherent AND
@http.status_code:200 AND @duration:>600000000").

│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.


│ Error: Provider produced inconsistent result after apply

│ When applying changes to
│ datadog_apm_retention_filter.showmetherent_listing_page_load_time, provider
│ "provider["registry.terraform.io/datadog/datadog"]" produced an
│ unexpected new value: .filter.query: was
│ cty.StringVal("service:showmetherent-express @http.path_group:'/listings'
│ app:showmetherent @http.method:HEAD env:production @http.status_code:200
@duration:>1500ms"), but now cty.StringVal("service:showmetherent\-express
│ AND @http.path_group:'\/listings' AND app:showmetherent AND
│ @http.method:HEAD AND env:production AND @http.status_code:200 AND
@duration:>1500000000").

Expected Behavior

It should have created the retention filters

Actual Behavior

No response

Steps to Reproduce

No response

Important Factoids

No response

References

No response

@Chaitu006 Chaitu006 added the bug label May 23, 2024
@HantingZhang2 HantingZhang2 self-assigned this Jul 8, 2024
@HantingZhang2
Copy link
Contributor

HantingZhang2 commented Jul 8, 2024

Hi @Chaitu006
Currently our backend would rewrite the query into the format mentioned in the error message and terraform expect the returned the query to be the same as the provided one. That's why you are getting this error.
In order to avoid this error, you can reformat your retention filter query into the same format mentioned in the error message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants