terraform-provider-newrelic icon indicating copy to clipboard operation
terraform-provider-newrelic copied to clipboard

newrelic_api_access_key throws APIAccessKeyErrorInterface

Open andrea-cuttone opened this issue 3 years ago • 6 comments

Hello

I am trying to create a newrelic_api_access_key this way:

resource "newrelic_api_access_key" "my_key" {
  account_id  = 123456
  key_type    = "INGEST"
  ingest_type = "LICENSE"
  name        = "my_key"
}

but when I terraform apply I get:

Error: json: cannot unmarshal object into Go struct field .data.apiAccessCreateKeys.errors of type apiaccess.APIAccessKeyErrorInterface

My setup:

  • terraform v0.12.31
  • NewRelic provider ~> 2.24.1

andrea-cuttone avatar Aug 16 '21 11:08 andrea-cuttone

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Aug 30 '21 21:08 stale[bot]

This issue has been automatically closed due to a lack of activity for an extended period of time.

stale[bot] avatar Sep 07 '21 03:09 stale[bot]

hi @andrea-cuttone Thanks for your patience on this.

I haven't been able to reproduce this, and since its' been a long time I'll close this issue.

Please reply in this ticket if this is still a problem for you with the latest version.

Thanks a lot

kidk avatar Apr 06 '22 10:04 kidk

Hi,

I've come across this issue. This is the response I believe cannot be unmarshalled:

{
 "data": {
  "apiAccessCreateKeys": {
   "createdKeys": null,
   "errors": [
    {
     "accountId": account-id,
     "id": null,
     "ingestErrorType": "FORBIDDEN",
     "ingestType": "LICENSE",
     "message": "You do not have permission to create this key.",
     "type": "INGEST"
    }
   ]
  }
 }
}

It would be nice if this error could be correctly unmarshalled, instead of getting an exception.

Terraform v1.1.9
on linux_amd64
+ provider registry.terraform.io/newrelic/newrelic v2.46.1

xorxsan avatar Jun 03 '22 09:06 xorxsan

Thanks @xorxsan We'll take a look

kidk avatar Jun 07 '22 07:06 kidk

We also got this error, with Terraform 1.2.3 and New Relic 2.46.0. I don't know how to track down the details of the response like the above commenter did, but with that clue I found an authentication problem in our configuration, and fixing it unblocked us. So our error response probably looked a lot like that one. :)

relsqui avatar Jun 30 '22 20:06 relsqui