Terraform-provider-newrelic: Unable to get New Relic Alert Policy data source

Created on 7 Jul 2020  路  4Comments  路  Source: newrelic/terraform-provider-newrelic

Getting Access Denied., null when trying to import a new relic alert policy in terraform as a data source.

Terraform Version

0.12.24

Debug Output

https://gist.github.com/alivirya/5caf3fa102770036f1589f181ca9d64f

Have submitted a query via postman with the query below that works so it doesn't seem like an api key issue:

  {
    actor {
        account(id: {accountId}) {
            alerts {
                policy(id: {policyId}) {
                    id
                    name
                    incidentPreference
                    accountId
                    }
            }
        }
    }
}

Expected Behavior

I've created a New Relic Alert Policy data source that imports from an existing new relic alert policy. It should be able to import this information.

Actual Behavior

Getting Access Denied., null, when looking at the logs and the Graphql output, I tried running the postman query myself and it seems to work so it doesn't seem to be a problem with the api keys. Seems like this might be a problem with how the provider performs the query

Steps to Reproduce

Create a New Relic data source

# data "newrelic_alert_policy" "name" {
#   name = "{existing_policy_name}"
# }

terraform plan

bug

Most helpful comment

Resolved by #783 .

All 4 comments

Hi @alivirya!

Can you confirm that that account_id configured in your provider block matches the account ID you are using in your test query?

@ctrombley Yes the account id is the same

Resolved by #783 .

Duplicate of #773

Was this page helpful?
0 / 5 - 0 ratings