terraform-provider-dynatrace
terraform-provider-dynatrace copied to clipboard
Cannot assign dynatrace_alerting id to the alerting_profile property of a dynatrace_notification resource
Describe the bug
When defining a dynatrace_notification
resource, and setting the alerting_profile
property to the id
of a dynatrace_alerting
resource created in the same configuration, the run errors with the message:
dynatrace_alerting.a: Creating...
dynatrace_alerting.a: Creation complete after 1s [id=vu9U3hXa3q0AAAABABhidWlsdGluOmFsZXJ0aW5nLnByb2ZpbGUABnRlbmFudAAGdGVuYW50ACQ4ZWM3NDAyOS1mMGE4LTM5NjgtODQ0OS01NzIzNTg2ODg0ZjW-71TeFdrerQ]
dynatrace_notification.b: Creating...
╷
│ Error: {
│ "code": 400,
│ "message": "Could not map JSON at 'alertingProfile' near line 1 column 299",
│ "constraintViolations": null
│ }
│
│ with dynatrace_notification.b,
│ on main.tf line 33, in resource "dynatrace_notification" "b":
│ 33: resource "dynatrace_notification" "b" {
│
╵
Releasing state lock. This may take a few moments...
if I set the property to a static string (using the guid id for the alerting profile resource taken from the web ui) .. the plan applies with no problems. Additionally - if I output the id
of the alerting_profile
resource, it appears it is an arbtrarily long string id .. not the guid the alerting_profile property seems to be expecting. I cannot see any other property on the dynatrace_alerting resource that would be usable as a value for the dynatrace_notification.alerting_profile
, and thus it does not currently seem possible to create a dynatrace_notification
with an associated dynatrace_alerting
resource in the same terraform run.
To Reproduce Steps to reproduce the behavior:
- Apply the following terraform
terraform {
required_providers {
dynatrace = {
version = "1.13.1"
source = "dynatrace-oss/dynatrace"
}
}
}
provider "dynatrace" {
}
resource "dynatrace_alerting" "a" {
name = "A"
rules {
rule {
delay_in_minutes = 0
include_mode = "NONE"
severity_level = "AVAILABILITY"
}
}
}
resource "dynatrace_notification" "b" {
web_hook {
name = "b"
accept_any_certificate = false
active = true
alerting_profile = dynatrace_alerting.a.id
notify_event_merges = false
payload = <<-EOT
{
"dedup_key": "{PID}",
}
EOT
url = "https://foo.bar.com/v2/enqueue"
}
}
output "dynatrace_alerting_id" {
value = dynatrace_alerting.a.id
}
Expected behavior a dynatrace_notification and associated dynatrace_alerting resource are created.
Screenshots N/A
Desktop (please complete the following information):
- OS: Linux
- Browser NA
- Version 1.13.1