[DRAFT] Terraform support for SaaS generic integration API#3625
Open
[DRAFT] Terraform support for SaaS generic integration API#3625
Conversation
f751719 to
ea694bd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds Terraform support for the Datadog Web Integrations API, allowing users to manage third-party integration accounts (Twilio, Snowflake, Databricks, etc.) as Terraform resources.
What's being introduced
New resource:
datadog_web_integration_accountA Terraform resource that maps to the Web Integrations API (
/api/v2/web-integrations/{integration_name}/accounts).Schema attributes:
idintegration_nametwilio,snowflake-web,databricks). Changing this forces replacementnamesettings_jsonsecrets_jsonImplementation details:
utils.SendRequestwith the provider HTTP client (no generated Web Integrations client yet)integration_namehasRequiresReplace()(it is part of the API path)secrets_jsonhasUseStateForUnknown()and is preserved from prior state on update (API never returns secrets)settings_jsonandsecrets_jsonusejsontypes.NormalizedType{}for JSON handlingFiles changed/added:
datadog/fwprovider/resource_datadog_web_integration_account.go– resource implementationdatadog/fwprovider/framework_provider.go– resource registrationexamples/resources/datadog_web_integration_account/resource.tf– Twilio, Snowflake, Databricks examplesexamples/resources/datadog_web_integration_account/import.sh– import examplesExpected behavior
Create
name,settings, andsecretstoPOST /api/v2/web-integrations/{integration_name}/accountsidin statesettings_jsonorsecrets_jsonare invalid or do not match the integration schemaRead
GET /api/v2/web-integrations/{integration_name}/accounts/{account_id}id,integration_name,name, andsettings_jsonfrom the responsesecrets_jsonfrom state (API does not return secrets)Update
PATCH /api/v2/web-integrations/{integration_name}/accounts/{account_id}withname,settings, andsecretssecrets_jsonwhen the plan does not change it (e.g.UseStateForUnknown)secrets_jsonremains from prior stateDelete
DELETE /api/v2/web-integrations/{integration_name}/accounts/{account_id}Import
integration_name:account_id(e.g.twilio:abc123def456)terraform import datadog_web_integration_account.example "twilio:abc123def456"Supported integrations
Each integration has its own schema for
settingsandsecrets. Users can fetch the schema with:GET /api/v2/web-integrations/{integration_name}/accounts/schemaNotes for users
namemust be unique per integration; the API enforces this.settings_jsonandsecrets_jsonmust be valid JSON and match the integration schema; schema violations surface as API errors (e.g. 422).Testing
integration_namechange shows replacementsecrets_jsondoes not clear secrets