jianyuan/terraform-provider-sentry

"Provider produced inconsistent result after apply" when applying `sentry_issue_alert`

Closed this issue · 6 comments

I am upgrading the provider and moving form sentry_rule to sentry_issue_alert
I imported the resources to sentry_issue_alert and fixed the state file
but now when I try to apply any change to the sentry_issue_alert I got this error


│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to sentry_issue_alert.warning_alert_rule["chat"], provider
│ "provider[\"registry.terraform.io/jianyuan/sentry\"]" produced an unexpected new value: .filters: was
│ cty.StringVal("[{\"attribute\":\"message\",\"id\":\"sentry.rules.filters.event_attribute.EventAttributeFilter\",\"match\":\"nc\",\"name\":\"The
│ event's message value does not contain 404 to https://app.com\",\"value\":\"404  to
│ https://app.com\"},{\"attribute\":\"message\",\"id\":\"sentry.rules.filters.event_attribute.EventAttributeFilter\",\"match\":\"nc\",\"name\":\"The
│ event's message value does not contain 404 Not Found to
│ https://app.com\",\"value\":\"404 Not Found to
│ https://app.com\"}]"), but now
│ cty.StringVal("[{\"attribute\":\"message\",\"id\":\"sentry.rules.filters.event_attribute.EventAttributeFilter\",\"match\":\"nc\",\"name\":\"The
│ event's message value does not contain 404  to https://app.com\",\"value\":\"404  to
│ https://app.com\"},{\"attribute\":\"message\",\"id\":\"sentry.rules.filters.event_attribute.EventAttributeFilter\",\"match\":\"nc\",\"name\":\"The
│ event's message value does not contain 404 Not Found to
│ https://app.com\",\"value\":\"404 Not Found to
│ https://app.com\"}]").
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

I have a similar error with sentry_issue_alert when upgrading from the previous provider version:

In my terraform file I have conditions = jsonencode([]) or conditions = "[]" and it outputs the following error

│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to module.tech.module.backend.module.sentry.sentry_issue_alert.recurring, provider "provider[\"registry.terraform.io/jianyuan/sentry\"]" produced an unexpected new value:
│ .conditions: was cty.StringVal("[]"), but now null.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

Yeah, same here. The failure is on both the filters and conditions field for me (both set to "[]" like in the docs):

│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to
│ module.app_sentry_slack_alert.sentry_issue_alert.app, provider
│ "provider[\"registry.terraform.io/jianyuan/sentry\"]" produced an
│ unexpected new value: .filters: was cty.StringVal("[]"), but now null.
│ 
│ 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
│ module.app_sentry_slack_alert.sentry_issue_alert.app, provider
│ "provider[\"registry.terraform.io/jianyuan/sentry\"]" produced an
│ unexpected new value: .conditions: was cty.StringVal("[]"), but now null.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

We can't set those fields to null either:

│ Error: Missing Configuration for Required Attribute
│ 
│   in resource "sentry_issue_alert" "app":
│   20:   conditions = null
│ 
│ Must set a configuration value for the conditions attribute as the provider
│ has marked it as required.
│ 
│ Refer to the provider documentation or contact the provider developers for
│ additional information about configurable attributes that are required.

Also seeing this, presumably Sentry doesn't return a value for conditions when they're an empty list. We should probably relax conditions being a required resource attribute?

Probably the same as the following issue
#366

Fixed: #398

Fixed in v0.12.3