Skip to content

Conversation

@g-brizolier
Copy link

@g-brizolier g-brizolier commented Nov 3, 2025

What & Why

Adds Terraform support for Datadog Reference Tables, enabling users to manage Reference Tables as Infrastructure-as-Code.

Includes:

  • datadog_reference_table resource - CRUD operations for Reference Tables
  • datadog_reference_table data source - Query tables by ID or name
  • datadog_reference_table_rows data source - Fetch specific rows by ID
  • Schema validation via ModifyPlan to prevent destructive changes (only additive schema changes allowed)
  • Support for cloud storage sources (AWS S3, GCP GCS, Azure Blob)

Note: Depends on OpenAPI spec fix (DataDog/datadog-api-spec#4532) to resolve OneOf unmarshaling for file_metadata.

QA Instructions

Run Acceptance Tests

dd-auth --domain dd.datad0g.com --api-key-env=DD_TEST_CLIENT_API_KEY --app-key-env=DD_TEST_CLIENT_APP_KEY \
  DD_TEST_ORG=yB5yjZ RECORD=none TESTARGS="-run TestAccDatadogReferenceTable" make testacc

Tests cover:

  • Resource CRUD (create, update, delete)
  • Schema validation (additive vs destructive changes)
  • Cloud storage sources (S3, GCS, Azure)
  • Data source queries (by ID, by name, rows)
  • Import functionality

Manual Testing (Optional)

  1. Build provider: make
  2. Setup ~/.terraformrc with dev_overrides pointing to $GOPATH/bin
  3. Create test HCL in a separate directory
  4. Use dd-auth --domain dd.datad0g.com --api-key-env=TF_VAR_datadog_api_key --app-key-env=TF_VAR_datadog_app_key terraform plan

References

Copy link
Author

g-brizolier commented Nov 3, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@g-brizolier g-brizolier force-pushed the guillaume.brizolier/REDEXP-2126-terraform-support-reftables branch from 54cf6f1 to 18c39ab Compare November 3, 2025 21:59
@g-brizolier g-brizolier changed the title initial commit [reference-tables] Add terraform support Nov 5, 2025
@g-brizolier g-brizolier force-pushed the guillaume.brizolier/REDEXP-2126-terraform-support-reftables branch from ee15a38 to 65c2402 Compare November 7, 2025 20:07
@g-brizolier g-brizolier force-pushed the guillaume.brizolier/REDEXP-2126-terraform-support-reftables branch 3 times, most recently from 81ac940 to c8f9b0b Compare November 7, 2025 21:21
@g-brizolier g-brizolier force-pushed the guillaume.brizolier/REDEXP-2126-terraform-support-reftables branch from c8f9b0b to e3a74a1 Compare November 10, 2025 18:40
The Go client's OneOf unmarshaler for file_metadata fails because both CloudStorage and LocalFile types can match the JSON response (LocalFile has AdditionalProperties that accepts any extra fields). This causes the unmarshaler to set UnparsedObject instead of populating the typed fields.

Workaround:
- Manually parse UnparsedObject when it's set, checking for 'access_details' to distinguish CloudStorage from LocalFile
- Skip utils.CheckForUnparsed() for reference tables since file_metadata will always have UnparsedObject set
- Update data source to handle Values as interface{} (API spec change)
- Remove LocalFile.upload_id field (no longer in API)
@g-brizolier g-brizolier force-pushed the guillaume.brizolier/REDEXP-2126-terraform-support-reftables branch from e3a74a1 to 16f208c Compare November 11, 2025 20:42
…GCS/Azure tests

- Update datadog-api-client-go to commit e7ecad4 which includes the additionalProperties:false fix for OneOf parsing
- Remove GCS and Azure basic tests (only S3 test is sufficient for testing cloud storage)
- Update S3 test cassettes with working OneOf parsing
- Remove replace directive from go.mod, now using proper version from package mirror
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants