Terraform Version
Terraform v0.12.24
NewRelic Proider Version
provider.newrelic v1.18.0
Affected Resource(s)
newrelic_synthetics_monitor
Issue
I have setup newrelic monitoring using terraform and pipeline job configured in Jenkins. Resource creation working fine but when we execute the job second time without changes in the code, refreshing state throwing errors random synthetics URL’s(Ideally it should show “No changes. Infrastructure is up-to-date” message). Jenkins server configured in cloud environment. I am facing this issue both windows based jenkins and linux based jenkins.
Note: Same code working fine in my local jenkins (Windows based) and terraform command line. I already have admin access to the newrelic account. Also I have checked URL access using below command and looks good.
curl -v -H "X-Api-Key:MyApiKey" https://synthetics.newrelic.com/synthetics/api/v4/monitors/2ce45bd5-f98a-4c4a-b703-111114b920a9
Error Logs:
2020/05/21 11:39:04 [ERROR] : eval: *terraform.EvalRefresh, err: GET https://synthetics.newrelic.com/synthetics/api/v4/monitors/2ce45bd5-f98a-4c4a-b703-111114b920a9 giving up after 4 attempts
2020/05/21 11:39:04 [ERROR] : eval: *terraform.EvalSequence, err: GET https://synthetics.newrelic.com/synthetics/api/v4/monitors/2ce45bd5-f98a-4c4a-b703-111114b920a9 giving up after 4 attempts
2020/05/21 11:39:31 [TRACE] vertex “provider.newrelic (close)”: evaluating
2020/05/21 11:39:31 [TRACE] [walkRefresh] Entering eval tree: provider.newrelic (close)
2020/05/21 11:39:31 [TRACE] : eval: *terraform.EvalCloseProvider
2020/05/21 11:39:31 [TRACE] GRPCProvider: Close
2020-05-21T11:39:31.499Z [DEBUG] plugin: plugin process exited: path=/var/jenkins_home/workspace/wdms-amg-newrelic-infra/.terraform/plugins/linux_amd64/terraform-provider-newrelic_v1.18.0_x4 pid=1769
2020-05-21T11:39:31.499Z [DEBUG] plugin: plugin exited
2020/05/21 11:39:31 [TRACE] [walkRefresh] Exiting eval tree: provider.newrelic (close)
2020/05/21 11:39:31 [TRACE] vertex “provider.newrelic (close)”: visit complete
2020/05/21 11:39:31 [TRACE] dag/walk: upstream of “root” errored, so skipping
2020/05/21 11:39:31 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2020/05/21 11:39:31 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock
Error: GET https://synthetics.newrelic.com/synthetics/api/v4/monitors/2ce45bd5-f98a-4c4a-b703-111114b920a9 giving up after 4 attempts
2020-05-21T11:39:31.503Z [DEBUG] plugin: plugin process exited: path=/var/jenkins_home/workspace/wdms-amg-newrelic-infra/.terraform/plugins/linux_amd64/terraform-provider-newrelic_v1.18.0_x4 pid=1761
2020-05-21T11:39:31.503Z [DEBUG] plugin: plugin exited
[Pipeline] }
[Pipeline] // ansiColor
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Terraform Apply)
Stage “Terraform Apply” skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE
Thanks,
Selvan.