Skip to content

Commit cf9e1e5

Browse files
Merge main
2 parents 286ed71 + c26b481 commit cf9e1e5

53 files changed

Lines changed: 4616 additions & 12 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changes/unreleased/Behind the scenes-20260401-092850.yaml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.changes/unreleased/Changes-20260403-094140.yaml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.changes/unreleased/Fixes-20260331-083757.yaml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.changes/v1.10.0.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# [v1.10.0](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v1.9.1...v1.10.0)
2+
### Changes
3+
* Write-only resources
4+
* Added auth provider resource
5+
* Added scim_config and scim_config_token resources
6+
* Added openai_integration resource
7+
* Added resource for azure-ad-application-resource
8+
### Fixes
9+
* Don't validate adapter_type if not provided
10+
### Behind the scenes
11+
* Cleanup dead code
12+
* Security patch

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
.terraform
2+
*.tfstate
3+
*.tfstate.backup
4+
*.tfvars
25
vendor/
36
terraform-provider*
47
.idea

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
66
and is generated by [Changie](https://github.com/miniscruff/changie).
77

88

9+
# [v1.10.0](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v1.9.1...v1.10.0)
10+
### Changes
11+
* Write-only resources
12+
* Added auth provider resource
13+
* Added scim_config and scim_config_token resources
14+
* Added openai_integration resource
15+
* Added resource for azure-ad-application-resource
16+
### Fixes
17+
* Don't validate adapter_type if not provided
18+
### Behind the scenes
19+
* Cleanup dead code
20+
* Security patch
21+
922
# [v1.9.1](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v1.9.0...v1.9.1)
1023
### Changes
1124
* Added execution project to bq sl resource

docs/resources/auth_provider.md

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
---
2+
page_title: "dbtcloud_auth_provider Resource - dbtcloud"
3+
subcategory: ""
4+
description: |-
5+
Manages an SSO auth provider for a dbt Cloud account. Supports SAML/Okta, Azure Active Directory (single-tenant, multi-tenant), and Google Workspace.
6+
Only one auth provider may exist per account. Requires the SSO feature enabled on the account (enterprise plans only).
7+
See the documentation https://docs.getdbt.com/docs/cloud/manage-access/sso-overview for more information.
8+
---
9+
10+
# dbtcloud_auth_provider (Resource)
11+
12+
13+
Manages an SSO auth provider for a dbt Cloud account. Supports SAML/Okta, Azure Active Directory (single-tenant, multi-tenant), and Google Workspace.
14+
15+
Only one auth provider may exist per account. Requires the SSO feature enabled on the account (enterprise plans only).
16+
17+
See the [documentation](https://docs.getdbt.com/docs/cloud/manage-access/sso-overview) for more information.
18+
19+
## Example Usage
20+
21+
```terraform
22+
// SAML — write-only cert (recommended, not stored in state)
23+
//
24+
// Requires Terraform >= 1.11 for write-only attribute support.
25+
// Bump cert_wo_version to rotate the cert without recreating the resource.
26+
27+
variable "saml_cert" {
28+
type = string
29+
ephemeral = true
30+
}
31+
32+
resource "dbtcloud_auth_provider" "saml" {
33+
type = "saml"
34+
entity_id = "https://your-idp.example.com/metadata"
35+
sso_url = "https://your-idp.example.com/sso/saml"
36+
37+
cert_wo = var.saml_cert
38+
cert_wo_version = 1
39+
}
40+
41+
output "login_url" {
42+
description = "SSO login URL to share with users."
43+
value = dbtcloud_auth_provider.saml.login_url
44+
}
45+
46+
47+
// SAML — all optional fields
48+
49+
resource "dbtcloud_auth_provider" "saml_full" {
50+
type = "saml"
51+
entity_id = "https://your-idp.example.com/metadata"
52+
sso_url = "https://your-idp.example.com/sso/saml"
53+
cert = file("idp-cert.pem")
54+
55+
sign_request = true
56+
attribute_map = jsonencode({
57+
email = "nameID"
58+
first_name = "firstName"
59+
last_name = "lastName"
60+
})
61+
62+
allow_password_backdoor = false
63+
}
64+
65+
66+
// Okta (identical to SAML, different type value)
67+
68+
resource "dbtcloud_auth_provider" "okta" {
69+
type = "okta"
70+
entity_id = "http://www.okta.com/<okta_app_id>"
71+
sso_url = "https://<your-org>.okta.com/app/<app_path>/sso/saml"
72+
73+
cert_wo = var.saml_cert
74+
cert_wo_version = 1
75+
}
76+
77+
78+
// Azure AD — single tenant
79+
80+
variable "azure_client_secret" {
81+
type = string
82+
ephemeral = true
83+
}
84+
85+
resource "dbtcloud_auth_provider" "azure_single_tenant" {
86+
type = "azure_single_tenant"
87+
client_id = "00000000-0000-0000-0000-000000000000"
88+
tenant_id = "11111111-1111-1111-1111-111111111111"
89+
90+
client_secret_wo = var.azure_client_secret
91+
client_secret_wo_version = 1
92+
93+
domain = "acme.com"
94+
include_indirect_groups = true
95+
max_groups_to_retrieve = 500
96+
}
97+
98+
99+
// Azure AD — multi tenant (no tenant_id required)
100+
101+
resource "dbtcloud_auth_provider" "azure_multi_tenant" {
102+
type = "azure_multi_tenant"
103+
client_id = "00000000-0000-0000-0000-000000000000"
104+
105+
client_secret_wo = var.azure_client_secret
106+
client_secret_wo_version = 1
107+
}
108+
109+
110+
// Azure Active Directory
111+
112+
resource "dbtcloud_auth_provider" "azure_active_directory" {
113+
type = "azure_active_directory"
114+
client_id = "00000000-0000-0000-0000-000000000000"
115+
tenant_id = "11111111-1111-1111-1111-111111111111"
116+
117+
client_secret_wo = var.azure_client_secret
118+
client_secret_wo_version = 1
119+
120+
domain = "acme.com"
121+
}
122+
123+
124+
// Google Workspace
125+
126+
variable "gsuite_client_secret" {
127+
type = string
128+
ephemeral = true
129+
}
130+
131+
resource "dbtcloud_auth_provider" "gsuite" {
132+
type = "gsuite"
133+
client_id = "000000000000-xxxx.apps.googleusercontent.com"
134+
135+
client_secret_wo = var.gsuite_client_secret
136+
client_secret_wo_version = 1
137+
138+
admin_refresh_token = "<oauth-refresh-token>"
139+
domain = "acme.com"
140+
gsuite_admin_id = "admin@acme.com"
141+
}
142+
```
143+
144+
<!-- schema generated by tfplugindocs -->
145+
## Schema
146+
147+
### Required
148+
149+
- `type` (String) The SSO provider type. One of: `saml`, `okta`, `gsuite`, `azure_single_tenant`, `azure_multi_tenant`, `azure_active_directory`. Changing this value forces a new resource.
150+
151+
### Optional
152+
153+
- `admin_refresh_token` (String, Sensitive) Google Workspace admin OAuth refresh token used to fetch group memberships.
154+
- `allow_password_backdoor` (Boolean) When true (default), users can still log in with email and password as a fallback. Set to false to enforce SSO-only access.
155+
- `attribute_map` (String) JSON map of SAML attribute names to dbt Cloud user fields.
156+
- `authorization_url` (String) OAuth authorization URL for Google Workspace. May be auto-populated server-side.
157+
- `cert` (String, Sensitive) SAML X.509 certificate (PEM format). Sensitive — stored in state. Consider using `cert_wo` instead. Conflicts with `cert_wo`.
158+
- `cert_wo` (String) Write-only alternative to `cert`. Not stored in state. Use `cert_wo_version` to trigger updates. Conflicts with `cert`.
159+
- `cert_wo_version` (Number) Increment to rotate `cert_wo` without changing the value.
160+
- `client_id` (String) OAuth client ID. Required for Azure AD and Google Workspace providers. Not returned by the API after save (encrypted at rest).
161+
- `client_secret` (String, Sensitive) OAuth client secret. Required for Azure AD and Google Workspace providers. Sensitive — stored in state. Consider using `client_secret_wo` instead. Conflicts with `client_secret_wo`.
162+
- `client_secret_wo` (String) Write-only alternative to `client_secret`. Not stored in state. Use `client_secret_wo_version` to trigger updates. Conflicts with `client_secret`.
163+
- `client_secret_wo_version` (Number) Increment to rotate `client_secret_wo` without changing the value.
164+
- `domain` (String) Primary domain for the Azure AD or Google Workspace tenant.
165+
- `entity_id` (String) SAML entity ID (Issuer) from your identity provider. Required for `saml` and `okta`.
166+
- `gsuite_admin_id` (String) Google Workspace admin email used to fetch group memberships.
167+
- `include_indirect_groups` (Boolean) Whether to include transitive (indirect) group memberships from Azure AD. Defaults to true.
168+
- `max_groups_to_retrieve` (Number) Maximum number of Azure AD groups to fetch per user. Defaults to 250.
169+
- `sign_request` (Boolean) Whether to sign SAML authentication requests. Defaults to false.
170+
- `slug` (String) URL-safe identifier used in the SSO login URL. Auto-generated if omitted. Immutable on accounts where auto-slug enforcement is enabled.
171+
- `sso_url` (String) SAML Single Sign-On URL from your identity provider. Required for `saml` and `okta`.
172+
- `tenant_id` (String, Sensitive) Azure AD tenant ID. Required for `azure_single_tenant`.
173+
174+
### Read-Only
175+
176+
- `cert_expiry_date` (String) Expiry date of the SAML X.509 certificate (SAML/Okta only).
177+
- `created_at` (String)
178+
- `id` (Number) The ID of the auth provider.
179+
- `login_url` (String) The SSO login URL for the account, auto-generated from the slug.
180+
- `state` (Number) The state of the auth provider (1 = active).
181+
- `updated_at` (String)
182+
183+
## Import
184+
185+
Import is supported using the following syntax:
186+
187+
```shell
188+
# Import an existing auth provider by its numeric ID.
189+
# The ID can be found via the dbt Cloud API:
190+
# GET /api/v3/accounts/{account_id}/auth-provider/
191+
192+
terraform import dbtcloud_auth_provider.example 12345
193+
```
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
page_title: "dbtcloud_azure_ad_application Resource - dbtcloud"
3+
subcategory: ""
4+
description: |-
5+
Manages an Azure Active Directory (Microsoft Entra ID) application registration for a dbt Cloud account. This enables Azure DevOps integration, allowing dbt Cloud to access Azure DevOps repositories for project setup.
6+
The client_id, client_secret and tenant_id are encrypted at rest and never returned by the API. They are stored as sensitive values in Terraform state so they can be resent on every update — the API requires all three on both create and update.
7+
Destroy behaviour: running terraform destroy calls the dbt Cloud DELETE endpoint, which marks the record as inactive. Due to a known dbt Cloud backend limitation, the underlying database row is retained and re-creating the resource against the same account without a backend cleanup will fail with a unique-constraint error. If you need to recreate the resource after a destroy, contact dbt Cloud support to have the orphaned record removed, or use terraform import to re-adopt the existing record ID.
8+
Requires the Azure DevOps integration feature to be enabled on the account (enterprise plans only).
9+
---
10+
11+
# dbtcloud_azure_ad_application (Resource)
12+
13+
14+
Manages an Azure Active Directory (Microsoft Entra ID) application registration for a dbt Cloud account. This enables Azure DevOps integration, allowing dbt Cloud to access Azure DevOps repositories for project setup.
15+
16+
The `client_id`, `client_secret` and `tenant_id` are encrypted at rest and never returned by the API. They are stored as sensitive values in Terraform state so they can be resent on every update — the API requires all three on both create and update.
17+
18+
**Destroy behaviour:** running `terraform destroy` calls the dbt Cloud DELETE endpoint, which marks the record as inactive. Due to a known dbt Cloud backend limitation, the underlying database row is retained and re-creating the resource against the same account without a backend cleanup will fail with a unique-constraint error. If you need to recreate the resource after a destroy, contact dbt Cloud support to have the orphaned record removed, or use `terraform import` to re-adopt the existing record ID.
19+
20+
Requires the Azure DevOps integration feature to be enabled on the account (enterprise plans only).
21+
22+
## Example Usage
23+
24+
```terraform
25+
resource "dbtcloud_azure_ad_application" "this" {
26+
organization_name = "my-azure-devops-org"
27+
client_id = "00000000-0000-0000-0000-000000000000"
28+
client_secret = var.azure_client_secret
29+
tenant_id = "00000000-0000-0000-0000-000000000001"
30+
31+
# Optional: defaults to "service_user". Set to "service_principal" to use
32+
# service principal authentication instead.
33+
azure_service_authentication_method = "service_user"
34+
}
35+
36+
# NOTE: destroying this resource calls the dbt Cloud DELETE endpoint, which
37+
# marks the record as inactive but does not remove the underlying database row.
38+
# Re-creating the resource against the same account after a destroy will fail
39+
# with a unique-constraint error. To recover, ask dbt Cloud support to remove
40+
# the orphaned record, or use `terraform import` to re-adopt it:
41+
#
42+
# terraform import dbtcloud_azure_ad_application.this <id>
43+
```
44+
45+
<!-- schema generated by tfplugindocs -->
46+
## Schema
47+
48+
### Required
49+
50+
- `client_id` (String, Sensitive) The client ID (application ID) of the Azure AD app registration. Stored as a sensitive value — the API never returns it.
51+
- `client_secret` (String, Sensitive) The client secret of the Azure AD app registration. Stored as a sensitive value — the API never returns it.
52+
- `organization_name` (String) The name of the Azure DevOps organization.
53+
- `tenant_id` (String, Sensitive) The tenant ID of the Azure AD directory. Stored as a sensitive value — the API never returns it.
54+
55+
### Optional
56+
57+
- `azure_service_authentication_method` (String) The method used for service authentication. One of: ~~~service_user~~~, ~~~service_principal~~~. Defaults to ~~~service_user~~~.
58+
59+
### Read-Only
60+
61+
- `account_id` (Number) The ID of the dbt Cloud account.
62+
- `created_at` (String) Timestamp when the application was created.
63+
- `id` (Number) The ID of the Azure AD application.
64+
- `oauth_redirect_uri_domain` (String) The domain used for the OAuth redirect URI. Set automatically by dbt Cloud based on the account's subdomain.
65+
- `updated_at` (String) Timestamp when the application was last updated.
66+
67+
## Import
68+
69+
Import is supported using the following syntax:
70+
71+
```shell
72+
# using import blocks (requires Terraform >= 1.5)
73+
import {
74+
to = dbtcloud_azure_ad_application.this
75+
id = "azure_ad_application_id"
76+
}
77+
78+
import {
79+
to = dbtcloud_azure_ad_application.this
80+
id = "12345"
81+
}
82+
83+
# using the older import command
84+
terraform import dbtcloud_azure_ad_application.this azure_ad_application_id
85+
terraform import dbtcloud_azure_ad_application.this 12345
86+
87+
# NOTE: client_id, client_secret, and tenant_id will be empty after import —
88+
# the API never returns these values. You must set them in your config to
89+
# avoid drift on the next apply.
90+
#
91+
# Import is also the recovery path if destroy left an orphaned record in dbt
92+
# Cloud (the DELETE endpoint soft-deletes the row rather than removing it).
93+
# Find the existing record ID and import it instead of creating a new one.
94+
```

0 commit comments

Comments
 (0)