Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

Internal Server Error when building Synthetic Monitors in a terraform conifguration




I have been building Synthetic Monitors in a terraform configuration.

I keep getting errors like this when I do a terraform apply for new monitors (but every time I do it it’s a different channel and when I kept retrying it eventually worked but now it’s no longer working). Here is an example of the errors that are coming up:

`* 1 error(s) occurred:

  • Internal Server Error`

Would be grateful for any input.

Many thanks,


Hi @sarahmoore, could you give more details on the exact command that results in this error? Where is it being sent to? Is this the full error you are receiving back? :slight_smile:


Hi @rdouglas, thank you for responding :slight_smile: !

The commands I used are terraform plan -out=plan.out and then terraform apply plan.out. I am doing this in a terraform config from my newrelic_synthetics folder (i.e. …/infrastructure/terraform/configurations/newrelic_synthetics).

If I comment out the policy channels I have put in, then my terraform apply plan.out is successful. This is the full error I am getting when I include the policy channels in my apply.

`Error: Error applying plan:

2 error(s) occurred:

  • newrelic_alert_policy_channel.foo1: 1 error(s) occurred:

  • newrelic_alert_policy_channel.foo1: Internal Server Error

  • newrelic_alert_policy_channel.foo2: 1 error(s) occurred:

  • newrelic_alert_policy_channel.foo2: Internal Server Error

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure. `

My alert policy channels look like this:

resource "newrelic_alert_policy_channel" "foo1" { policy_id = "${}" channel_id = "${}" }

Please let me know if you need any further information.

Sarah :slight_smile:


Hi @sarahmoore, i’ve been doing some research on this and it looks like there is an open bug with Terraform where it is not actually waiting for the API to be ready before it executes. So it may be worth following up there and reporting your specific issues to see if there is any progress on it


Hi @rdouglas, Thanks for your reply - I will follow up there!


@sarahmoore Are you using the NR account in their US or Europe region? The NewRelic provider currently only supports the US region, and no configuration whatsoever will work if your account has been created in the European zone.

I’ve been able to deploy many alert conditions, channels and linked them successfully. In this file, there is an exemplary condition for a demo-app that I used in a recent presentation:

To my knowledge this should still work with Terraform 0.11.11 that I’m currently using.

Hope this helps to unblock you.


Amazing! Thanks for sharing @frankdornberger :smiley:


Hi @frankdornberger, thanks for your reply!

I believe my account has been created in the European zone, but I have been able to get some alert_policy_channels to work, but only a couple… They are structured similarly to your demo-app. I will investigate further and see if it’s possible to switch over to the US region.

Many thanks,


@sarahmoore Another limitation with the Terraform integration that not all the NRQL statements are supported. I remember running into a similar issue with one of my queries that I wanted to use in a widget (I tried to do some math like SELECT count(*)*20 and the multiplication failed). What I recommend is that you comment all of your widgets and then you add one of them after each apply. It won’t take long to figure out which of your NRQLs is either not supported or faulty.


Great work @frankdornberger thanks for your help :smiley: