newrelic / terraform-provider-newrelic

Terraform provider for New Relic
https://registry.terraform.io/providers/newrelic/newrelic/latest/docs
Mozilla Public License 2.0
202 stars 245 forks source link

Resource `newrelic_notification_destination`: Creation fails with type error #2746

Open VenelinMartinov opened 3 weeks ago

VenelinMartinov commented 3 weeks ago

Hi there,

Thank you for opening an issue. In order to better assist you with your issue, we kindly ask to follow the template format and instructions. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests only. General usage questions submitted as issues will be closed and redirected to New Relic's Explorers Hub https://discuss.newrelic.com/c/build-on-new-relic/developer-toolkit.

Please include the following with your bug report

:warning: Important: Failure to include the following, such as omitting the Terraform configuration in question, may delay resolving the issue.

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.

v1.9.5

Affected Resource(s)

Please list the resources as a list, for example:

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration

Please include your provider configuration (sensitive details redacted) as well as the configuration of the resources and/or data sources related to the bug report.


terraform {
required_version = "~> 1.0"
required_providers {
newrelic = {
source = "newrelic/newrelic"
}
}
}

resource "newrelic_notification_destination" "foo" { account_id = 12345678 name = "foo" type = "WEBHOOK"

secure_url { prefix = "https://webhook.mywebhook.com/" secure_suffix = "service_id/123456" }

property { key = "source" value = "terraform" } }


### Actual Behavior
What actually happened?

Creation fails with:

Plan: 1 to add, 0 to change, 0 to destroy. newrelic_notification_destination.foo: Creating... ╷ │ Error: Access restricted │ │ with newrelic_notification_destination.foo, │ on main.tf line 12, in resource "newrelic_notification_destination" "foo": │ 12: resource "newrelic_notification_destination" "foo" { │ │ NOTICE: fields are statically typed. Make sure all fields are of the correct type ╵ Error: exit status 1



### Expected Behavior
What should have happened?
Creation succeeds or prints an actionable error

### Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
1. `terraform apply`

### Debug Output
Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

### Panic Output
If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the `crash.log`.

### Important Factoids
Are there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs?

### References
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:
- GH-1234
pranav-new-relic commented 1 week ago

Hi @VenelinMartinov, I've had a word with my team, and it appears that this is an access issue surfacing from the API (the error thrown by the API is being shown by the Terraform Provider). Can you try creating other resources such as alerts, dashboards, workflows etc. with the same credentials and let us know if you're seeing this issue only with the resource you've reported this with? If this isn't the case and you're seeing similar access restricted errors with other resources too, you might need to use an active, right set of credentials; if not, and you're seeing the issue only with this resource, I'll see what we can do about this issue further. Thanks!

VenelinMartinov commented 2 days ago

Hey @pranav-new-relic, thanks for getting back to me. It seems to be specific to the resource. I could run the following code fine with the same set of credentials:

terraform {
  required_version = "~> 1.0"
  required_providers {
    newrelic = {
      source = "newrelic/newrelic"
    }
  }
}

resource "newrelic_alert_policy" "foo" {
  name = "example"
  incident_preference = "PER_POLICY" # PER_POLICY is default
}