While creating datadog_monitor resource from terraform, getting below error:
$ terraform apply
╷
│ Error: Invalid or missing credentials provided to the Datadog Provider. Please confirm your API and APP keys are valid and are for the correct region, see https://www.terraform.io/docs/providers/datadog/ for more information on providing credentials for the Datadog Provider
│
│ with provider["registry.terraform.io/datadog/datadog"],
│ on main.tf line 11, in provider "datadog":
│ 11: provider "datadog" {
Followed Terraform doc: Terraform Registry
Also tried to deploy other DataDog resource and also checked terraform DataDog provider version 3.9.0 to 3.18.0 but getting same error.
Verified on Mac and Windows both, but this is not an OS specific issue.
I am using API key & App key, not API id. Here is my code:
terraform {
required_providers {
datadog = {
source = "DataDog/datadog"
version = "3.9.0"
}
}
}
# Configure the Datadog provider
provider "datadog" {
api_key = "xxxxxxxx"
app_key = "xxxxxxxx"
}
resource "datadog_monitor" "cpumonitor" {
name = "cpu monitor"
type = "metric alert"
message = "CPU usage alert"
query = "avg(last_1m):avg:system.cpu.system{*} by {host} > 60"
}
Please help to point me into right direction if I am missing something here.