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

Wrong error message during import of the pagerduty_user_notification_rule resource. #966

Open
alexx187 opened this issue Jan 10, 2025 · 0 comments

Comments

@alexx187
Copy link

alexx187 commented Jan 10, 2025

Terraform Version

terraform -v Terraform v1.9.5 on windows_amd64

Affected Resource(s)

Please list the resources as a list, for example:

  • pagerduty_user_notification_rule

Terraform Configuration Files

3 types of pagerduty_user_notification_rule resources of different urgency configured in the code (the name, urgency, delay and the type are different among them):

resource "pagerduty_user_notification_rule" "username_low_urgency_email" {
  user_id                = pagerduty_user.username.id
  start_delay_in_minutes = 1
  urgency                = "low"

  contact_method = {
    type = "email_contact_method"
    id   = pagerduty_user_contact_method.username_email.id
  }
}

import {
  to = pagerduty_user_notification_rule.username_low_urgency_email
  id = "PYZ7XYZ.PWMLIUR"
}

Debug Output

The output of the terraform plan command

Expected Behavior

The error message should have read:
Error importing pagerduty_user_notification_rule. Expecting an ID formed as '<user_id>:<notification_rule_id>'

Note the colon instead of dot between user_id and notification_rule_id.

Actual Behavior

The error message misleadingly read:
Error importing pagerduty_user_notification_rule. Expecting an ID formed as '<user_id>.<notification_rule_id>'

Note the dot instead of dot between user_id and notification_rule_id.

Steps to Reproduce

  1. Create a user, their contact methods and several user notification rules in PagerDuty UI.
  2. Create a code with a pagerduty_user_notification_rule resource, and an import block to import the user_notification_rule resources, created previously in the UI.
  3. terraform plan

Important Factoids

The import section of the pagerduty_user_notification_rule resource doc clearly states that the delimiter should be a colon.

The file and line of the code where the error should be corrected in can be found here

Also, an idea to consider - maybe it would be easier for users if all of the PagerDuty TF provider's resources will have the same delimiter in the import blocks across all of the resources? Currently, some of them expect a colon, some expect a dot as a delimiter.

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

1 participant