terraform-provider-newrelic
terraform-provider-newrelic copied to clipboard
Error initializing newrelic-client-go when missing ENV variable
When using the newrelic_insights_event
resource, I am receiving an error when only setting the insights_insert_key
via the environment variable NEW_RELIC_INSIGHTS_INSERT_KEY
. If I set the api_key
via the environment variable NEW_RELIC_API_KEY
then things work as expected, even if that value I use is a junk value.
Terraform Version
0.13.5
Affected Resource(s)
-
newrelic_insights_event
Terraform Configuration
Provider has no configuration block in HCL and is instead configured using the following environment variables:
-
NEW_RELIC_ACCOUNT_ID
-
NEW_RELIC_INSIGHTS_INSERT_KEY
-
NEW_RELIC_INSIGHTS_INSERT_URL
(necessary for my specific use-case but shouldn't be needed to replicate problem)
resource "newrelic_insights_event" "some_event" {
event {
type = "SomeEvenType"
attribute {
key = "some_attribute"
value = "some value"
}
}
}
Actual Behavior
Terraform does not plan or apply and instead returns Error: error initializing newrelic-client-go: must use at least one of: ConfigPersonalAPIKey, ConfigAdminAPIKey, ConfigInsightsInsertKey
.
Expected Behavior
Terraform should successfully plan and apply, as I am only interacting with the Insights API and shouldn't need to set a personal API key or admin API key.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
-
export NEW_RELIC_ACCOUNT_ID=1234
-
export NEW_RELIC_INSIGHTS_INSERT_KEY=5678
-
terraform init
-
terraform plan
Debug Output
N/A
Panic Output
N/A
Important Factoids
N/A
References
N/A
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.
Thanks for reporting James. Per your reproduction steps, I was able to reproduce this.
I'll take this one as part of my onboarding on DTK.
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.
Moving back to TO-DO as I was working with @sanderblue on it.
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.
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.
This issue has been automatically closed due to a lack of activity for an extended period of time.
I'm running into this issue (or a similar one, anyway) as well:
Even if the api_key
variable for the newrelic
provider is set, e.g.:
provider "newrelic" {
region = "US"
account_id = data.aws_s3_bucket_object.newrelic_account_id.body
api_key = data.aws_s3_bucket_object.newrelic_apikey.body
}
...Terraform will ignore it, and if NEW_RELIC_API_KEY
is not declared, the exact same must use at least one of
error message is thrown.
Tested on Terraform v0.13.5 and v.0.13.6; it'll be a bit before we can get our infra up to 14/15, but I imagine this might still apply with those.