26 Sep 2024 03:24 PM - edited 26 Sep 2024 03:28 PM
Hi, this is more of a YSK. It took me sometime to get the grail(swagger) dashboard to be deployed via Terraform. I have listed down a basic code in reply.
Solved! Go to Solution.
26 Sep 2024 03:28 PM - edited 26 Sep 2024 03:34 PM
1. Create a grail dashboard on UI and download the json.
2. Terraform document link: https://registry.terraform.io/providers/dynatrace-oss/dynatrace/latest/docs/resources/document
3. provider.tf
terraform {
required_providers {
dynatrace = {
version = "~> 1.0"
source = "dynatrace-oss/dynatrace"
}
}
}
provider "dynatrace" {
dt_env_url = var.dynatrace_env_url
dt_api_token = var.dynatrace_api_token
automation_client_id = var.automation_client_id
automation_client_secret = var.automation_client_secret
}
4. variables.tf
variable "dynatrace_env_url" {
description = "The ENV URL for your Dynatrace environment"
type = string
}
variable "dynatrace_api_token" {
description = "The API token for your Dynatrace environment"
type = string
sensitive = true
}
variable "automation_client_id" {
description = "The client ID for automation and swagger UI dashboard"
type = string
}
variable "automation_client_secret" {
description = "The client secret for automation and swagger UI dashboard"
type = string
sensitive = true
}
5. swagger_dashboard.tf
resource "dynatrace_document" "alb_example_tf" {
type = "dashboard"
name = "ALB Monitoring TF"
private = false
content = file(format("%s/alb_monitoring.json", path.module))
}
DON'T FORGET TO ADD `private: false`, otherwise only the owner(user who created automation automation secret) can view the dashboard.
You can change owner to yours by setting `owner: UUID` in resource block.