DataDog / terraform-provider-datadog

Terraform Datadog provider
https://www.terraform.io/docs/providers/datadog/
Mozilla Public License 2.0
399 stars 375 forks source link

[datadog_dashboard] Add `cross_org_uuid support` #2450

Closed cheungringo closed 2 months ago

cheungringo commented 3 months ago

Summary

https://datadoghq.atlassian.net/browse/DBNBK-159 Adds support for cross_org_uuid to terraform so customers can set this field in terraformed dashboards.

This can't be merged until https://github.com/DataDog/datadog-api-spec/pull/2839/files is merged, and the go api client is autogenerated. Then rebase this on top of the new go client version and verify everything still works

Context for how to make terraform changes: https://datadoghq.atlassian.net/wiki/spaces/DB/pages/3218343160/Working+with+Terraform+Dashboards

Test Plan

Set up my dev environment with a test org, then ran:

  1. terraform apply on a test examples/dashboard.tf and verified that a dashboard was created with cross_org_uuid
  2. Make a test org, then fill in these parameters and run:
    DD_TEST_ORG="xx" DD_TEST_CLIENT_API_KEY="xxx" DD_TEST_CLIENT_APP_KEY="xxx" DD_TEST_SITE_URL="https://api.datadoghq.com/" TESTARGS="-run TestAccDatadogDashboardCrossOrg" RECORD=none make testacc
cheungringo commented 3 months ago

Note that one potentially breaking change in this PR is for the ApmResourceStatsQuery widget schema, group_by is marked as optional in terraform but it's required in the widget schema definition on the BE: TF: https://github.com/DataDog/terraform-provider-datadog/blob/master/datadog/resource_datadog_dashboard.go#L7053-L7058 BE: https://github.com/DataDog/dogweb/blob/prod/dogweb/lib/validation/schemas/query.py#L141

Same goes for the operation_name field

Update: left out these two fields: https://dd.slack.com/archives/CFN4XFUBF/p1718916046089099