Skip to content

The sentry_issue_alert.name attribute is both read-only and required at the same time. #570

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

Open
iabramov opened this issue Feb 5, 2025 · 4 comments

Comments

@iabramov
Copy link

iabramov commented Feb 5, 2025

0.14.3

There is an issue with the "sentry_issue_alert.name" attribute:
Running terraform plan results in the following errors:

If I set the name attribute:

resource "sentry_issue_alert" "backend-new-issues" {
  name         = "backend-new-issues"
terraform plan
╷
│ Error: Invalid Configuration for Read-Only Attribute
│ 
│   with sentry_issue_alert.backend-new-issues,
│   on alerts.tf line 3, in resource "sentry_issue_alert" "backend-new-issues":
│    3:   name         = "backend-new-issues"
│ 
│ Cannot set value for this attribute as the provider has marked it as read-only. Remove the configuration line setting the value.

However, if I remove the name attribute:

resource "sentry_issue_alert" "backend-new-issues" {
  # name         = "backend-new-issues"
terraform plan
 Error: Missing required argument
│ 
│   on alerts.tf line 1, in resource "sentry_issue_alert" "backend-new-issues":
│    1: resource "sentry_issue_alert" "backend-new-issues" {
│ 
│ The argument "name" is required, but no definition was found.

Shouldn’t this attribute not be read-only?
Relevant code references in the provider:

https://github.com/jianyuan/terraform-provider-sentry/blob/v0.14.3/internal/provider/resource_issue_alert.go#L72

@iabramov iabramov changed the title sentry_issue_alert.name attribute is read-only and required the same time The sentry_issue_alert.name attribute is both read-only and required at the same time. Feb 5, 2025
@jianyuan
Copy link
Owner

jianyuan commented Feb 19, 2025

Hi @iabramov, could you confirm the version of Terraform you were using?

@ThePletch
Copy link

I can confirm that I'm seeing identical behavior on version 1.10.5.
with name specified:

│ Error: Invalid Configuration for Read-Only Attribute
│ 
│   with module.project.sentry_issue_alert.slack,
│   on project/alerts.tf line 153, in resource "sentry_issue_alert" "slack":
│  153:   name         = "${var.name} / Slack notification"
│ 
│ Cannot set value for this attribute as the provider has marked it as read-only. Remove the configuration line setting the value.
│ 
│ Refer to the provider documentation or contact the provider developers for additional information about configurable and read-only attributes that are supported.

without name specified:

│ Error: Missing required argument
│ 
│   on project/alerts.tf line 150, in resource "sentry_issue_alert" "slack":
│  150: resource "sentry_issue_alert" "slack" {
│ 
│ The argument "name" is required, but no definition was found.

@ThePletch
Copy link

It looks like this is happening because it's marked as both computed and required:

https://github.com/jianyuan/terraform-provider-sentry/blob/v0.14.3/internal/provider/resource_issue_alert.go#L70-L76

https://github.com/jianyuan/terraform-provider-sentry/blob/v0.14.3/internal/provider/resource_issue_alert.go#L45-L47

@jianyuan i'm very unfamiliar with go and the terraform provider package, could this be fixed by just deleting the lines marking the attribute as computed? if so i can put up a quick PR for that.

@cysp
Copy link

cysp commented Mar 11, 2025

I also encountered this, and I found that the problem is actually that the diagnostic regarding the read-only name attribute is being mis-reported as applying to the top-level name of the sentry_issue_alert resource, when it actually pertains to the name attributes of sub-objects e.g. each element of conditions_v2, filters_v2 and actions_v2. Those child objects need to be configured without their name attributes, e.g.:

conditions_v2 = [
  { first_seen_event = {} },
  { regression_event = {} },
  { reappeared_event = {} },
  { new_high_priority_issue = {} },
  { existing_high_priority_issue = {} },
]

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

No branches or pull requests

4 participants