terraform-provider-datadog: error creating synthetics API test from https://api.datadoghq.com/api/v1/synthetics/tests/api: 400 Bad Request: {"errors":["Global variable invalid names: GENERIC_OPS_USER_EMAIL, GENERIC_OPS_USER_PASSWORD, GENERIC_PASSWORD"]}, terraform apply is failing with this error all of a sudden with no changes in the code
Hi there,
Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.
Terraform Version
⇒ terraform -v
Terraform v1.5.0
on darwin_amd64
+ provider registry.terraform.io/datadog/datadog v3.25.0
Affected Resource(s)
Datadog Synthetics tests
If this issue appears to affect multiple resources, it may be an issue with Terraform’s core, so please mention this.
Terraform Configuration Files
terraform {
required_providers {
datadog = {
source = "DataDog/datadog"
version = "~> 3.25.0"
}
}
backend "s3" {
key = "<none set>"
encrypt = true
}
}
# Configure the Datadog provider
provider "datadog" {
api_key = var.datadog_api_key
app_key = var.datadog_app_key
api_url = "https://api.datadoghq.com/"
}
The global variables which are failing to get created /updated
resource "datadog_synthetics_global_variable" "user_test_password" {
name = "USER_TEST_PASSWORD_${upper(replace(var.namespace, "-", "_"))}"
description = "A common password for all the users"
value = var.generic_password
secure = true
}
=====================================*
config_variable {
type = "global"
name = "GENERIC_PASSWORD"
id = datadog_synthetics_global_variable.user_test_password.id
}
resource “datadog_synthetics_global_variable” “generic_ops_user_email” { name = “OPS_USER_TEST_EMAIL_${upper(replace(var.namespace, “-”, “_”))}” description = “An OPS User email” value = var.generic_ops_user_email secure = true }
resource “datadog_synthetics_global_variable” “generic_ops_user_password” { name = “OPS_USER_TEST_PASSWORD_${upper(replace(var.namespace, “-”, “_”))}” description = “An OPS user password” value = var.generic_ops_user_password secure = true }
=============================* config_variable { type = “global” name = “GENERIC_OPS_USER_EMAIL” id = datadog_synthetics_global_variable.generic_ops_user_email.id }
config_variable { type = “global” name = “GENERIC_OPS_USER_PASSWORD” id = datadog_synthetics_global_variable.generic_ops_user_password.id }
### Debug Output
Error: error creating synthetics API test from https://api.datadoghq.com/api/v1/synthetics/tests/api: 400 Bad Request: {“errors”:[“Global variable invalid names: GENERIC_PASSWORD”]} │ │ with datadog_synthetics_test.admin_user_crud_environments, │ on AdminCRUDEnvironments.tf line 8, in resource “datadog_synthetics_test” “admin_user_crud_environments”: │ 8: resource “datadog_synthetics_test” “admin_user_crud_environments” { │ ╵ ╷ │ Error: error creating synthetics API test from https://api.datadoghq.com/api/v1/synthetics/tests/api: 400 Bad Request: {“errors”:[“Global variable invalid names: GENERIC_PASSWORD”]} │ │ with datadog_synthetics_test.admin_user_can_view_audit_logs, │ on AdminCanVerifyAuditLogs.tf line 8, in resource “datadog_synthetics_test” “admin_user_can_view_audit_logs”: │ 8: resource “datadog_synthetics_test” “admin_user_can_view_audit_logs” { │ ╵ ╷ │ Error: error creating synthetics API test from https://api.datadoghq.com/api/v1/synthetics/tests/api: 400 Bad Request: {“errors”:[“Global variable invalid names: GENERIC_PASSWORD”]} │ │ with datadog_synthetics_test.Multi_org_user_login, │ on MultiOrgLogin.tf line 8, in resource “datadog_synthetics_test” “Multi_org_user_login”: │ 8: resource “datadog_synthetics_test” “Multi_org_user_login” { │ ╵ ╷ │ Error: error creating synthetics API test from https://api.datadoghq.com/api/v1/synthetics/tests/api: 400 Bad Request: {“errors”:[“Global variable invalid names: GENERIC_PASSWORD”]} │ │ with datadog_synthetics_test.admin_user_invite_other_user, │ on inviteUserToTheOrg.tf line 8, in resource “datadog_synthetics_test” “admin_user_invite_other_user”: │ 8: resource “datadog_synthetics_test” “admin_user_invite_other_user” { │ ╵ ╷ │ Error: error creating synthetics API test from https://api.datadoghq.com/api/v1/synthetics/tests/api: 400 Bad Request: {“errors”:[“Global variable invalid names: GENERIC_OPS_USER_PASSWORD, GENERIC_OPS_USER_EMAIL”]} │ │ with datadog_synthetics_test.ops_admin_set_limits, │ on opsUserLoginAndSetLimits.tf line 22, in resource “datadog_synthetics_test” “ops_admin_set_limits”: │ 22: resource “datadog_synthetics_test” “ops_admin_set_limits” { │ ╵ ╷ │ Error: error creating synthetics API test from https://api.datadoghq.com/api/v1/synthetics/tests/api: 400 Bad Request: {“errors”:[“Global variable invalid names: GENERIC_OPS_USER_EMAIL, GENERIC_OPS_USER_PASSWORD”]} │ │ with datadog_synthetics_test.ops_admin_login_retry, │ on opsUserLoginRetriesWithWrongCreds.tf line 8, in resource “datadog_synthetics_test” “ops_admin_login_retry”: │ 8: resource “datadog_synthetics_test” “ops_admin_login_retry” { │ ╵ ╷ │ Error: error creating synthetics API test from https://api.datadoghq.com/api/v1/synthetics/tests/api: 400 Bad Request: {“errors”:[“Global variable invalid names: GENERIC_PASSWORD”]} │ │ with datadog_synthetics_test.user_creates_api_token, │ on userCreatesAPIToken.tf line 8, in resource “datadog_synthetics_test” “user_creates_api_token”: │ 8: resource “datadog_synthetics_test” “user_creates_api_token” { │ ╵ ╷ │ Error: error creating synthetics API test from https://api.datadoghq.com/api/v1/synthetics/tests/api: 400 Bad Request: {“errors”:[“Global variable invalid names: GENERIC_PASSWORD”]} │ │ with datadog_synthetics_test.Admin_user_login, │ on userRoles.tf line 15, in resource “datadog_synthetics_test” “Admin_user_login”: │ 15: resource “datadog_synthetics_test” “Admin_user_login” { │ ╵ ╷ │ Error: error creating synthetics API test from https://api.datadoghq.com/api/v1/synthetics/tests/api: 400 Bad Request: {“errors”:[“Global variable invalid names: GENERIC_OPS_USER_EMAIL, GENERIC_OPS_USER_PASSWORD, GENERIC_PASSWORD”]} │ │ with datadog_synthetics_test.user_signup, │ on userSignupWorkflow.tf line 7, in resource “datadog_synthetics_test” “user_signup”: │ 7: resource “datadog_synthetics_test” “user_signup” { │ ╵ ╷ │ Error: error creating synthetics API test from https://api.datadoghq.com/api/v1/synthetics/tests/api: 400 Bad Request: {“errors”:[“Global variable invalid names: GENERIC_PASSWORD”]} │ │ with datadog_synthetics_test.user_is_able_to_update_their_notifications, │ on userUpdateNotificationSettingsTest.tf line 7, in resource “datadog_synthetics_test” “user_is_able_to_update_their_notifications”: │ 7: resource “datadog_synthetics_test” “user_is_able_to_update_their_notifications” { │ ╵ make: *** [apply] Error 1
### Panic Output
NA
### Expected Behavior
terraform apply should work and variables should get created.
### Actual Behavior
The Apply is failing with Global variable invalid names error
### Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
1. `terraform init`
2. `terraform plan`
1. `terraform apply`
NOTE: This error started popping up recently, I have upgraded Terraform to latest and also Datadog to 3.25, not sure what is causing this as I have cleaned up everything (existing global variables and including terraform state file) and tried to deploy it from scratch but its still failing with this error.
### Important Factoids
Are there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs?
### References
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:
- GH-1234
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 17 (7 by maintainers)
Ah I see where the issue might come from. There is some additional validation, now the name inside the the test must match the name of the global variable. You need to replace
GENERIC_PASSWORDbyUSER_TEST_PASSWORD_XXXin the test configuration.I don’t think we’ll revert, we have a fix in place.
OK, we’ll need a new release then. Thanks for your patience.