https://pulumi.com logo
q

quaint-queen-45003

06/05/2019, 8:26 PM
i have a question about the new relic package. I see that this was resolved https://github.com/pulumi/pulumi-newrelic/issues/1. but I dont think it resolved the issue. code sample in thread
Copy code
const nrprovider = new newrelic.Provider("bngo-test", { apiKey: "test" });

const fooAlertPolicy = new newrelic.AlertPolicy("foo", {});
const fooInfraAlertCondition = new newrelic.InfraAlertCondition("foo", {
    comparison: "above",
    critical: {
        duration: 25,
        timeFunction: "all",
        value: 90,
    },
    event: "StorageSample",
    policyId: 100,
    select: "diskUsedPercent",
    type: "infra_metric",
    where: "(`hostname` LIKE '%frontend%')",
}, {provider: nrprovider});
the error:
Copy code
Diagnostics:
  newrelic:index:AlertPolicy (foo):
    error: 1 error occurred:
    	* missing required configuration key "newrelic:apiKey":
    Set a value using the command `pulumi config set newrelic:apiKey <value>`.
b

broad-dog-22463

06/05/2019, 8:27 PM
@stocky-spoon-28903 ☝️
q

quaint-queen-45003

06/05/2019, 8:27 PM
still doesn't look like the key i provide to the provider is being honored
s

stocky-spoon-28903

06/05/2019, 8:33 PM
I’ll take a look again in a few mins
q

quaint-queen-45003

06/05/2019, 8:35 PM
thanks!
i have a long-ish meeting coming up shortly so my responses may be sparse
b

broad-dog-22463

06/06/2019, 3:32 PM
@quaint-queen-45003 are you around per chance?
q

quaint-queen-45003

06/06/2019, 3:34 PM
yup!
b

broad-dog-22463

06/06/2019, 3:34 PM
So just to let you know, we are looking into your error right now!
It's definitely not acting as expected
Could you do me a favour and try and drop this part
Copy code
const nrprovider = new newrelic.Provider("bngo-test", { apiKey: "test" });
q

quaint-queen-45003

06/06/2019, 3:35 PM
great! thanks for the help.
b

broad-dog-22463

06/06/2019, 3:35 PM
and then set
NEWRELIC_API_KEY
as an env var
and see if that works for you?
q

quaint-queen-45003

06/06/2019, 3:39 PM
sure, so just have this?
Copy code
const fooAlertPolicy = new newrelic.AlertPolicy("foo", {});
const fooInfraAlertCondition = new newrelic.InfraAlertCondition("foo", {
    comparison: "above",
    critical: {
        duration: 25,
        timeFunction: "all",
        value: 90,
    },
    event: "StorageSample",
    policyId: 100,
    select: "diskUsedPercent",
    type: "infra_metric",
    where: "(`hostname` LIKE '%frontend%')",
});
b

broad-dog-22463

06/06/2019, 3:41 PM
yessir
I have a feeling that will work...
q

quaint-queen-45003

06/06/2019, 3:55 PM
looks like it's taking a key now
Copy code
Diagnostics:
  newrelic:index:AlertPolicy (foo):
    error: could not validate provider configuration: 1 error occurred:
    	* : invalid or unknown key: key
now im just using the wrong key but that should be an easy fix on my side
hmm i just generated a new New Relic admin API. set the env variable and im still hitting this error though
b

broad-dog-22463

06/06/2019, 4:22 PM
interesting... ok this is helping me a lot! Thank you πŸ™‚
ok @quaint-queen-45003 you will be happy to know I found exactly the same error πŸ™‚
q

quaint-queen-45003

06/06/2019, 4:34 PM
ha! glad im not entirely crazy
b

broad-dog-22463

06/06/2019, 4:39 PM
it definitely works when setting the key via ENV VAR
Copy code
β–Ά pulumi up
Previewing update (newrelic-test):

     Type                           Name                                 Plan
 +   pulumi:pulumi:Stack            alert-policy-newrelic-newrelic-test  create
 +   └─ newrelic:index:AlertPolicy  foo                                  create

Resources:
    + 2 to create

Do you want to perform this update? yes
Updating (newrelic-test):

     Type                           Name                                 Status
 +   pulumi:pulumi:Stack            alert-policy-newrelic-newrelic-test  created
 +   └─ newrelic:index:AlertPolicy  foo                                  created

Outputs:
    id: "460780"

Resources:
    + 2 created

Duration: 5s
q

quaint-queen-45003

06/06/2019, 4:40 PM
interesting. i was hitting the error with a known working key and with the new admin api key that i just generated
b

broad-dog-22463

06/06/2019, 4:46 PM
are you on latest?
q

quaint-queen-45003

06/06/2019, 4:47 PM
Copy code
pulumi version
v0.17.14
b

broad-dog-22463

06/06/2019, 4:59 PM
and the latest provider release?
q

quaint-queen-45003

06/06/2019, 4:59 PM
0.18.1
b

broad-dog-22463

06/06/2019, 5:00 PM
ok, the same as me then
ok @quaint-queen-45003, instead of passing the key to the provider as EnvVar OR via the Provider registration, can you try this as a last step:
Copy code
pulumi config set newrelic:apiKey NOTAREALKEY
with your key of course!
q

quaint-queen-45003

06/06/2019, 5:28 PM
Copy code
Diagnostics:
  newrelic:index:AlertPolicy (foo):
    error: could not validate provider configuration: 1 error occurred:
    	* : invalid or unknown key: key
when i try my known key and new admin key
b

broad-dog-22463

06/06/2019, 5:31 PM
huh!
this is so weird!
we are not getting that error here....
are you able to run pulumi in this mode
Copy code
pulumi preview -v=8 --logtostderr
and redirect stderr to a file
that way we can look more for you
q

quaint-queen-45003

06/06/2019, 6:01 PM
let me know if yall need anything else
b

broad-dog-22463

06/06/2019, 6:24 PM
Thanks!
q

quaint-queen-45003

06/10/2019, 5:06 PM
should i open new bug on this?
b

broad-dog-22463

06/14/2019, 6:55 PM
Hey @quaint-queen-45003 are you around?
Just wanted to give you a heads up that we are going to close your issue as it’s a configuration problem ;) I missed it all of this time and I’m pretty sure it will work for you when you see the solution Let me know if there are any other issues
q

quaint-queen-45003

06/17/2019, 3:55 PM
hey paul - sorry for the late reply. I was out of the office on friday. I just re-attempted with the adjusted config and i think it works (at least got a different error πŸ™‚ )! Thanks for the help! i'm going to spend the day writing these alerts so i'll let you know if something comes up
thanks again!
b

broad-dog-22463

06/17/2019, 4:39 PM
πŸ‘
no worries at all
q

quaint-queen-45003

06/19/2019, 7:56 PM
so far everything works pretty well. I have a question about
alertPolicyChannel
. The example provided in the code throws an error around
fooAlertChannel.id
and
fooAlertPolicy.id
. here's the sample code provided
Copy code
const fooAlertChannel = new newrelic.AlertChannel("foo", {
        configuration: {
            include_json_attachment: "1",
            recipients: "<mailto:foo@example.com|foo@example.com>",
        },
        type: "email",
    });
const fooAlertPolicy = new newrelic.AlertPolicy("foo", {});
const fooAlertPolicyChannel = new newrelic.AlertPolicyChannel("foo", {
    channelId: fooAlertChannel.id,
    policyId: fooAlertPolicy.id,
});
and here's the error
Copy code
Type 'Output<string>' is not assignable to type 'Input<number>'.
  Type 'Output<string>' is not assignable to type 'OutputInstance<number>'.
how should i reference
fooAlertChannel.id
and
fooAlertPolicy.id
?