dynatrace-oss / terraform-provider-dynatrace

Apache License 2.0
68 stars 31 forks source link

dynatrace_key_user_action timing issue #348

Closed mattBaumBeneva closed 10 months ago

mattBaumBeneva commented 10 months ago

Describe the bug When creating a KUA through the new dynatrace_key_user_action resource and then using the new resources to configure SLOs, we occasionally obtain the error:

09:22:52  │ Error: User action is not subscribed: APPLICATION_METHOD-2E43715FFF2ED6AC
09:22:52  │ 
09:22:52  │   with module.Application_test-de-base.dynatrace_web_app_key_performance_load.kua_apdex_load["Loading of page /test/transaction2"],
09:22:52  │   on ../../src/modules/blueprints/Application/main.tf line 239, in resource "dynatrace_web_app_key_performance_load" "kua_apdex_load":
09:22:52  │  239: resource "dynatrace_web_app_key_performance_load" "kua_apdex_load" {

This issue was fixed when KUAs were configured directly in the Web Application resource. This seems to be a regression, where the provider is not waiting to verify that the KUA is fully created in Dynatrace.

Code sample from our modules:

resource "dynatrace_key_user_action" "kua_with_apdex" {
  for_each = local.kua_with_apdex

  application_id = dynatrace_web_application.application.id
  domain         = each.value[0].domain
  name           = each.key
  type           = "Load"
}

resource "dynatrace_web_app_key_performance_load" "kua_apdex_load" {
  for_each = dynatrace_key_user_action.kua_with_apdex

  kpm   = "VISUALLY_COMPLETE"
  scope = each.value.id

  thresholds {
    frustrating_threshold_seconds = local.kua_with_apdex[each.value.name][0].apdex.seuil_frustrant
    tolerated_threshold_seconds   = local.kua_with_apdex[each.value.name][0].apdex.seuil_tolerable
  }
  fallback_thresholds {
    frustrating_fallback_threshold_seconds = local.kua_with_apdex[each.value.name][0].apdex.seuil_frustrant
    tolerated_fallback_threshold_seconds   = local.kua_with_apdex[each.value.name][0].apdex.seuil_tolerable
  }
}

Expected behavior Newly created KUAs should be usable in the same Apply run in a deterministic fashion.

Additional context Provider version 1.45.0

Dynatrace-Reinhard-Pilz commented 10 months ago

Hello @mattBaumBeneva, I am pretty sure that this is a side effect of #345. As explained on the other ticket, I am hoping to provide a proper solution early next week.

Dynatrace-Reinhard-Pilz commented 10 months ago

Closing this issue, because I am pretty sure that it's a side effect of #345. Fix already commited.