diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dc1f813a..9820edf6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,7 +36,7 @@ jobs: cache: true - uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v8 test: - name: Acceptance tests - Terraform ${{ matrix.terraform }} - authentik ${{ matrix.authentik_version }} + name: Acceptance tests - authentik ${{ matrix.authentik_version }} - Terraform ${{ matrix.terraform }} runs-on: ubuntu-latest timeout-minutes: 30 permissions: diff --git a/docs/resources/application.md b/docs/resources/application.md index 29fff48b..aa831e9c 100644 --- a/docs/resources/application.md +++ b/docs/resources/application.md @@ -70,3 +70,5 @@ resource "authentik_application" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_core` Generated. +- `meta_model` (String) Static value of `application` Generated. diff --git a/docs/resources/application_entitlement.md b/docs/resources/application_entitlement.md index 405f3f24..5369decd 100644 --- a/docs/resources/application_entitlement.md +++ b/docs/resources/application_entitlement.md @@ -49,3 +49,5 @@ resource "authentik_policy_binding" "test-ent-access" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_core` Generated. +- `meta_model` (String) Static value of `applicationentitlement` Generated. diff --git a/docs/resources/blueprint.md b/docs/resources/blueprint.md index fb27f95c..2fe8dff2 100644 --- a/docs/resources/blueprint.md +++ b/docs/resources/blueprint.md @@ -40,3 +40,5 @@ resource "authentik_blueprint" "instance" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_blueprints` Generated. +- `meta_model` (String) Static value of `blueprintinstance` Generated. diff --git a/docs/resources/brand.md b/docs/resources/brand.md index 91a8b6ea..9db10e82 100644 --- a/docs/resources/brand.md +++ b/docs/resources/brand.md @@ -50,3 +50,5 @@ resource "authentik_brand" "default" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_brands` Generated. +- `meta_model` (String) Static value of `brand` Generated. diff --git a/docs/resources/certificate_key_pair.md b/docs/resources/certificate_key_pair.md index b3105869..fc7b9cb6 100644 --- a/docs/resources/certificate_key_pair.md +++ b/docs/resources/certificate_key_pair.md @@ -59,3 +59,5 @@ resource "authentik_certificate_key_pair" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_crypto` Generated. +- `meta_model` (String) Static value of `certificatekeypair` Generated. diff --git a/docs/resources/enterprise_license.md b/docs/resources/enterprise_license.md index 2c46765f..49dac94c 100644 --- a/docs/resources/enterprise_license.md +++ b/docs/resources/enterprise_license.md @@ -24,4 +24,6 @@ description: |- - `external_users` (Number) Generated. - `id` (String) The ID of this resource. - `internal_users` (Number) Generated. +- `meta_app` (String) Static value of `authentik_enterprise` Generated. +- `meta_model` (String) Static value of `license` Generated. - `name` (String) Generated. diff --git a/docs/resources/event_rule.md b/docs/resources/event_rule.md index acb5a810..84c9bc09 100644 --- a/docs/resources/event_rule.md +++ b/docs/resources/event_rule.md @@ -32,3 +32,5 @@ description: |- ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_events` Generated. +- `meta_model` (String) Static value of `notificationrule` Generated. diff --git a/docs/resources/event_transport.md b/docs/resources/event_transport.md index a4fc52fb..8fb3e787 100644 --- a/docs/resources/event_transport.md +++ b/docs/resources/event_transport.md @@ -53,3 +53,5 @@ resource "authentik_event_transport" "transport" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_events` Generated. +- `meta_model` (String) Static value of `notificationtransport` Generated. diff --git a/docs/resources/flow.md b/docs/resources/flow.md index df8317df..9a4746ed 100644 --- a/docs/resources/flow.md +++ b/docs/resources/flow.md @@ -77,4 +77,6 @@ resource "authentik_flow_stage_binding" "dummy-flow" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_flows` Generated. +- `meta_model` (String) Static value of `flow` Generated. - `uuid` (String) Generated. diff --git a/docs/resources/flow_stage_binding.md b/docs/resources/flow_stage_binding.md index 125cad3a..7079aa4d 100644 --- a/docs/resources/flow_stage_binding.md +++ b/docs/resources/flow_stage_binding.md @@ -58,3 +58,5 @@ resource "authentik_flow_stage_binding" "dummy-flow" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_flows` Generated. +- `meta_model` (String) Static value of `flowstagebinding` Generated. diff --git a/docs/resources/group.md b/docs/resources/group.md index c63e4627..a2fd4b77 100644 --- a/docs/resources/group.md +++ b/docs/resources/group.md @@ -44,3 +44,5 @@ resource "authentik_group" "group" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_core` Generated. +- `meta_model` (String) Static value of `group` Generated. diff --git a/docs/resources/outpost.md b/docs/resources/outpost.md index 4984c7d6..c9f2f7a4 100644 --- a/docs/resources/outpost.md +++ b/docs/resources/outpost.md @@ -55,3 +55,5 @@ resource "authentik_outpost" "outpost" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_outposts` Generated. +- `meta_model` (String) Static value of `outpost` Generated. diff --git a/docs/resources/policy_binding.md b/docs/resources/policy_binding.md index a55f50c7..61add916 100644 --- a/docs/resources/policy_binding.md +++ b/docs/resources/policy_binding.md @@ -69,3 +69,5 @@ resource "authentik_policy_binding" "app-access" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_policies` Generated. +- `meta_model` (String) Static value of `policybinding` Generated. diff --git a/docs/resources/policy_dummy.md b/docs/resources/policy_dummy.md index 0928c86a..17e66830 100644 --- a/docs/resources/policy_dummy.md +++ b/docs/resources/policy_dummy.md @@ -36,3 +36,5 @@ resource "authentik_policy_dummy" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_policies_dummy` Generated. +- `meta_model` (String) Static value of `dummypolicy` Generated. diff --git a/docs/resources/policy_event_matcher.md b/docs/resources/policy_event_matcher.md index 9626fe28..a7fddeb1 100644 --- a/docs/resources/policy_event_matcher.md +++ b/docs/resources/policy_event_matcher.md @@ -227,3 +227,5 @@ resource "authentik_policy_event_matcher" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_policies_event_matcher` Generated. +- `meta_model` (String) Static value of `eventmatcherpolicy` Generated. diff --git a/docs/resources/policy_expiry.md b/docs/resources/policy_expiry.md index e41933e9..c9b996e7 100644 --- a/docs/resources/policy_expiry.md +++ b/docs/resources/policy_expiry.md @@ -36,3 +36,5 @@ resource "authentik_policy_expiry" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_policies_expiry` Generated. +- `meta_model` (String) Static value of `passwordexpirypolicy` Generated. diff --git a/docs/resources/policy_expression.md b/docs/resources/policy_expression.md index e4f7d735..80a2af70 100644 --- a/docs/resources/policy_expression.md +++ b/docs/resources/policy_expression.md @@ -35,3 +35,5 @@ resource "authentik_policy_expression" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_policies_expression` Generated. +- `meta_model` (String) Static value of `expressionpolicy` Generated. diff --git a/docs/resources/policy_geoip.md b/docs/resources/policy_geoip.md index f814db10..6796eacc 100644 --- a/docs/resources/policy_geoip.md +++ b/docs/resources/policy_geoip.md @@ -282,3 +282,5 @@ description: |- ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_policies_geoip` Generated. +- `meta_model` (String) Static value of `geoippolicy` Generated. diff --git a/docs/resources/policy_password.md b/docs/resources/policy_password.md index c6040580..de93d200 100644 --- a/docs/resources/policy_password.md +++ b/docs/resources/policy_password.md @@ -48,3 +48,5 @@ resource "authentik_policy_password" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_policies_password` Generated. +- `meta_model` (String) Static value of `passwordpolicy` Generated. diff --git a/docs/resources/policy_reputation.md b/docs/resources/policy_reputation.md index 72765119..f7057c71 100644 --- a/docs/resources/policy_reputation.md +++ b/docs/resources/policy_reputation.md @@ -36,3 +36,5 @@ resource "authentik_policy_reputation" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_policies_reputation` Generated. +- `meta_model` (String) Static value of `reputationpolicy` Generated. diff --git a/docs/resources/policy_unique_password.md b/docs/resources/policy_unique_password.md index da6bc1fd..d76aef50 100644 --- a/docs/resources/policy_unique_password.md +++ b/docs/resources/policy_unique_password.md @@ -27,3 +27,5 @@ description: |- ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_policies_unique_password` Generated. +- `meta_model` (String) Static value of `uniquepasswordpolicy` Generated. diff --git a/docs/resources/property_mapping_google_workspace.md b/docs/resources/property_mapping_google_workspace.md index da1d8d73..c9a20da6 100644 --- a/docs/resources/property_mapping_google_workspace.md +++ b/docs/resources/property_mapping_google_workspace.md @@ -25,3 +25,5 @@ Manage Google Workspace Provider Property mappings ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_google_workspace` Generated. +- `meta_model` (String) Static value of `googleworkspaceprovidermapping` Generated. diff --git a/docs/resources/property_mapping_ldap.md b/docs/resources/property_mapping_ldap.md index 1a7edbbd..3dd50582 100644 --- a/docs/resources/property_mapping_ldap.md +++ b/docs/resources/property_mapping_ldap.md @@ -25,3 +25,5 @@ Manage LDAP Source Property mappings ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_sources_ldap` Generated. +- `meta_model` (String) Static value of `ldapsourcepropertymapping` Generated. diff --git a/docs/resources/property_mapping_microsoft_entra.md b/docs/resources/property_mapping_microsoft_entra.md index d0c3b89b..4fd3cf47 100644 --- a/docs/resources/property_mapping_microsoft_entra.md +++ b/docs/resources/property_mapping_microsoft_entra.md @@ -25,3 +25,5 @@ Manage Microsoft Entra Provider Property mappings ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_microsoft_entra` Generated. +- `meta_model` (String) Static value of `microsoftentraprovidermapping` Generated. diff --git a/docs/resources/property_mapping_notification.md b/docs/resources/property_mapping_notification.md index e9870d17..a4985614 100644 --- a/docs/resources/property_mapping_notification.md +++ b/docs/resources/property_mapping_notification.md @@ -31,3 +31,5 @@ resource "authentik_property_mapping_notification" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_events` Generated. +- `meta_model` (String) Static value of `notificationwebhookmapping` Generated. diff --git a/docs/resources/property_mapping_provider_google_workspace.md b/docs/resources/property_mapping_provider_google_workspace.md index 75f24cf5..508d1cba 100644 --- a/docs/resources/property_mapping_provider_google_workspace.md +++ b/docs/resources/property_mapping_provider_google_workspace.md @@ -22,3 +22,5 @@ Manage Google Workspace Provider Property mappings ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_google_workspace` Generated. +- `meta_model` (String) Static value of `googleworkspaceprovidermapping` Generated. diff --git a/docs/resources/property_mapping_provider_microsoft_entra.md b/docs/resources/property_mapping_provider_microsoft_entra.md index 7f030528..60d6c338 100644 --- a/docs/resources/property_mapping_provider_microsoft_entra.md +++ b/docs/resources/property_mapping_provider_microsoft_entra.md @@ -22,3 +22,5 @@ Manage Microsoft Entra Provider Property mappings ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_microsoft_entra` Generated. +- `meta_model` (String) Static value of `microsoftentraprovidermapping` Generated. diff --git a/docs/resources/property_mapping_provider_rac.md b/docs/resources/property_mapping_provider_rac.md index 445e6b57..d4d6ff1a 100644 --- a/docs/resources/property_mapping_provider_rac.md +++ b/docs/resources/property_mapping_provider_rac.md @@ -26,3 +26,5 @@ Manage RAC Provider Property mappings ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_rac` Generated. +- `meta_model` (String) Static value of `racpropertymapping` Generated. diff --git a/docs/resources/property_mapping_provider_radius.md b/docs/resources/property_mapping_provider_radius.md index d0709455..eca44ab8 100644 --- a/docs/resources/property_mapping_provider_radius.md +++ b/docs/resources/property_mapping_provider_radius.md @@ -22,3 +22,5 @@ Manage Radius Provider Property mappings ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_radius` Generated. +- `meta_model` (String) Static value of `radiusproviderpropertymapping` Generated. diff --git a/docs/resources/property_mapping_provider_saml.md b/docs/resources/property_mapping_provider_saml.md index 82f8bfb8..2aa9b190 100644 --- a/docs/resources/property_mapping_provider_saml.md +++ b/docs/resources/property_mapping_provider_saml.md @@ -37,3 +37,5 @@ resource "authentik_property_mapping_provider_saml" "saml-aws-rolessessionname" ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_saml` Generated. +- `meta_model` (String) Static value of `samlpropertymapping` Generated. diff --git a/docs/resources/property_mapping_provider_scim.md b/docs/resources/property_mapping_provider_scim.md index bb0aabef..0c21903d 100644 --- a/docs/resources/property_mapping_provider_scim.md +++ b/docs/resources/property_mapping_provider_scim.md @@ -22,3 +22,5 @@ Manage SCIM Provider Property mappings ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_scim` Generated. +- `meta_model` (String) Static value of `scimmapping` Generated. diff --git a/docs/resources/property_mapping_provider_scope.md b/docs/resources/property_mapping_provider_scope.md index d7a45343..c075ca90 100644 --- a/docs/resources/property_mapping_provider_scope.md +++ b/docs/resources/property_mapping_provider_scope.md @@ -41,3 +41,5 @@ EOF ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_oauth2` Generated. +- `meta_model` (String) Static value of `scopemapping` Generated. diff --git a/docs/resources/property_mapping_rac.md b/docs/resources/property_mapping_rac.md index 6505999d..1c442cab 100644 --- a/docs/resources/property_mapping_rac.md +++ b/docs/resources/property_mapping_rac.md @@ -29,3 +29,5 @@ Manage RAC Provider Property mappings ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_rac` Generated. +- `meta_model` (String) Static value of `racpropertymapping` Generated. diff --git a/docs/resources/property_mapping_radius.md b/docs/resources/property_mapping_radius.md index 318b7005..009992c7 100644 --- a/docs/resources/property_mapping_radius.md +++ b/docs/resources/property_mapping_radius.md @@ -25,3 +25,5 @@ Manage Radius Provider Property mappings ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_radius` Generated. +- `meta_model` (String) Static value of `radiusproviderpropertymapping` Generated. diff --git a/docs/resources/property_mapping_saml.md b/docs/resources/property_mapping_saml.md index d014b983..4c1771c3 100644 --- a/docs/resources/property_mapping_saml.md +++ b/docs/resources/property_mapping_saml.md @@ -30,3 +30,5 @@ Manage SAML Provider Property mappings ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_saml` Generated. +- `meta_model` (String) Static value of `samlpropertymapping` Generated. diff --git a/docs/resources/property_mapping_scim.md b/docs/resources/property_mapping_scim.md index 33512d06..6060816b 100644 --- a/docs/resources/property_mapping_scim.md +++ b/docs/resources/property_mapping_scim.md @@ -25,3 +25,5 @@ Manage SCIM Provider Property mappings ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_scim` Generated. +- `meta_model` (String) Static value of `scimmapping` Generated. diff --git a/docs/resources/property_mapping_source_kerberos.md b/docs/resources/property_mapping_source_kerberos.md index 7906caaa..adc69445 100644 --- a/docs/resources/property_mapping_source_kerberos.md +++ b/docs/resources/property_mapping_source_kerberos.md @@ -22,3 +22,5 @@ Manage Kerberos Source Property mappings ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_sources_kerberos` Generated. +- `meta_model` (String) Static value of `kerberossourcepropertymapping` Generated. diff --git a/docs/resources/property_mapping_source_ldap.md b/docs/resources/property_mapping_source_ldap.md index 06a539dd..766a1576 100644 --- a/docs/resources/property_mapping_source_ldap.md +++ b/docs/resources/property_mapping_source_ldap.md @@ -31,3 +31,5 @@ resource "authentik_property_mapping_source_ldap" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_sources_ldap` Generated. +- `meta_model` (String) Static value of `ldapsourcepropertymapping` Generated. diff --git a/docs/resources/property_mapping_source_oauth.md b/docs/resources/property_mapping_source_oauth.md index e88bfafe..77dfb9e4 100644 --- a/docs/resources/property_mapping_source_oauth.md +++ b/docs/resources/property_mapping_source_oauth.md @@ -22,3 +22,5 @@ Manage OAuth Source Property mappings ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_sources_oauth` Generated. +- `meta_model` (String) Static value of `oauthsourcepropertymapping` Generated. diff --git a/docs/resources/property_mapping_source_plex.md b/docs/resources/property_mapping_source_plex.md index 1ba816ea..55639740 100644 --- a/docs/resources/property_mapping_source_plex.md +++ b/docs/resources/property_mapping_source_plex.md @@ -22,3 +22,5 @@ Manage Plex Source Property mappings ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_sources_plex` Generated. +- `meta_model` (String) Static value of `plexsourcepropertymapping` Generated. diff --git a/docs/resources/property_mapping_source_saml.md b/docs/resources/property_mapping_source_saml.md index 62a22f8a..a0645c6c 100644 --- a/docs/resources/property_mapping_source_saml.md +++ b/docs/resources/property_mapping_source_saml.md @@ -22,3 +22,5 @@ Manage SAML Source Property mappings ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_sources_saml` Generated. +- `meta_model` (String) Static value of `samlsourcepropertymapping` Generated. diff --git a/docs/resources/property_mapping_source_scim.md b/docs/resources/property_mapping_source_scim.md index 1bbae7f0..e6d31886 100644 --- a/docs/resources/property_mapping_source_scim.md +++ b/docs/resources/property_mapping_source_scim.md @@ -22,3 +22,5 @@ Manage SCIM Source Property mappings ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_sources_scim` Generated. +- `meta_model` (String) Static value of `scimsourcepropertymapping` Generated. diff --git a/docs/resources/provider_google_workspace.md b/docs/resources/provider_google_workspace.md index 0526c5f7..c04c6f70 100644 --- a/docs/resources/provider_google_workspace.md +++ b/docs/resources/provider_google_workspace.md @@ -41,3 +41,5 @@ description: |- ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_google_workspace` Generated. +- `meta_model` (String) Static value of `googleworkspaceprovider` Generated. diff --git a/docs/resources/provider_ldap.md b/docs/resources/provider_ldap.md index 832b3f9a..3b761f92 100644 --- a/docs/resources/provider_ldap.md +++ b/docs/resources/provider_ldap.md @@ -54,3 +54,5 @@ resource "authentik_application" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_ldap` Generated. +- `meta_model` (String) Static value of `ldapprovider` Generated. diff --git a/docs/resources/provider_microsoft_entra.md b/docs/resources/provider_microsoft_entra.md index 1512abef..d581d642 100644 --- a/docs/resources/provider_microsoft_entra.md +++ b/docs/resources/provider_microsoft_entra.md @@ -40,3 +40,5 @@ description: |- ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_microsoft_entra` Generated. +- `meta_model` (String) Static value of `microsoftentraprovider` Generated. diff --git a/docs/resources/provider_oauth2.md b/docs/resources/provider_oauth2.md index c827a773..e1299d9d 100644 --- a/docs/resources/provider_oauth2.md +++ b/docs/resources/provider_oauth2.md @@ -83,3 +83,5 @@ resource "authentik_application" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_oauth2` Generated. +- `meta_model` (String) Static value of `oauth2provider` Generated. diff --git a/docs/resources/provider_proxy.md b/docs/resources/provider_proxy.md index 4a8c9d6a..ed7e9c5f 100644 --- a/docs/resources/provider_proxy.md +++ b/docs/resources/provider_proxy.md @@ -69,3 +69,5 @@ resource "authentik_application" "name" { - `client_id` (String) Generated. - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_proxy` Generated. +- `meta_model` (String) Static value of `proxyprovider` Generated. diff --git a/docs/resources/provider_rac.md b/docs/resources/provider_rac.md index 285f4270..2ffede94 100644 --- a/docs/resources/provider_rac.md +++ b/docs/resources/provider_rac.md @@ -29,3 +29,5 @@ description: |- ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_rac` Generated. +- `meta_model` (String) Static value of `racprovider` Generated. diff --git a/docs/resources/provider_radius.md b/docs/resources/provider_radius.md index 04d4df2c..23aff122 100644 --- a/docs/resources/provider_radius.md +++ b/docs/resources/provider_radius.md @@ -52,3 +52,5 @@ resource "authentik_application" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_radius` Generated. +- `meta_model` (String) Static value of `radiusprovider` Generated. diff --git a/docs/resources/provider_saml.md b/docs/resources/provider_saml.md index 6412d36b..e563e6a4 100644 --- a/docs/resources/provider_saml.md +++ b/docs/resources/provider_saml.md @@ -99,3 +99,5 @@ resource "authentik_application" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_saml` Generated. +- `meta_model` (String) Static value of `samlprovider` Generated. diff --git a/docs/resources/provider_scim.md b/docs/resources/provider_scim.md index 75533d8e..04006f18 100644 --- a/docs/resources/provider_scim.md +++ b/docs/resources/provider_scim.md @@ -63,3 +63,5 @@ resource "authentik_provider_scim" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_scim` Generated. +- `meta_model` (String) Static value of `scimprovider` Generated. diff --git a/docs/resources/provider_ssf.md b/docs/resources/provider_ssf.md index b9d88b83..94f8f094 100644 --- a/docs/resources/provider_ssf.md +++ b/docs/resources/provider_ssf.md @@ -27,3 +27,5 @@ description: |- ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_ssf` Generated. +- `meta_model` (String) Static value of `ssfprovider` Generated. diff --git a/docs/resources/rac_endpoint.md b/docs/resources/rac_endpoint.md index d798faae..c24bc253 100644 --- a/docs/resources/rac_endpoint.md +++ b/docs/resources/rac_endpoint.md @@ -33,3 +33,5 @@ description: |- ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_rac` Generated. +- `meta_model` (String) Static value of `endpoint` Generated. diff --git a/docs/resources/rbac_initial_permissions.md b/docs/resources/rbac_initial_permissions.md index 6055efa8..aadd1b31 100644 --- a/docs/resources/rbac_initial_permissions.md +++ b/docs/resources/rbac_initial_permissions.md @@ -26,3 +26,5 @@ description: |- ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_rbac` Generated. +- `meta_model` (String) Static value of `initialpermissions` Generated. diff --git a/docs/resources/rbac_role.md b/docs/resources/rbac_role.md index 732e3e85..231cff7c 100644 --- a/docs/resources/rbac_role.md +++ b/docs/resources/rbac_role.md @@ -21,3 +21,5 @@ description: |- ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_rbac` Generated. +- `meta_model` (String) Static value of `role` Generated. diff --git a/docs/resources/scope_mapping.md b/docs/resources/scope_mapping.md index 98bec10b..0073072d 100644 --- a/docs/resources/scope_mapping.md +++ b/docs/resources/scope_mapping.md @@ -30,3 +30,5 @@ Manage Scope Provider Property mappings ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_providers_oauth2` Generated. +- `meta_model` (String) Static value of `scopemapping` Generated. diff --git a/docs/resources/service_connection_docker.md b/docs/resources/service_connection_docker.md index e233956e..0affbf99 100644 --- a/docs/resources/service_connection_docker.md +++ b/docs/resources/service_connection_docker.md @@ -57,3 +57,5 @@ resource "authentik_service_connection_docker" "remote-host" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_outposts` Generated. +- `meta_model` (String) Static value of `dockerserviceconnection` Generated. diff --git a/docs/resources/service_connection_kubernetes.md b/docs/resources/service_connection_kubernetes.md index 1c460c1c..d648d278 100644 --- a/docs/resources/service_connection_kubernetes.md +++ b/docs/resources/service_connection_kubernetes.md @@ -46,3 +46,5 @@ EOF ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_outposts` Generated. +- `meta_model` (String) Static value of `kubernetesserviceconnection` Generated. diff --git a/docs/resources/source_kerberos.md b/docs/resources/source_kerberos.md index 039b0c28..01c16ee4 100644 --- a/docs/resources/source_kerberos.md +++ b/docs/resources/source_kerberos.md @@ -58,3 +58,5 @@ description: |- ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_sources_kerberos` Generated. +- `meta_model` (String) Static value of `kerberossource` Generated. diff --git a/docs/resources/source_ldap.md b/docs/resources/source_ldap.md index 9d1924ed..93ff31bd 100644 --- a/docs/resources/source_ldap.md +++ b/docs/resources/source_ldap.md @@ -64,3 +64,5 @@ resource "authentik_source_ldap" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_sources_ldap` Generated. +- `meta_model` (String) Static value of `ldapsource` Generated. diff --git a/docs/resources/source_oauth.md b/docs/resources/source_oauth.md index aacb8049..83ef75a7 100644 --- a/docs/resources/source_oauth.md +++ b/docs/resources/source_oauth.md @@ -106,3 +106,5 @@ resource "authentik_source_oauth" "name" { - `callback_uri` (String) Generated. - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_sources_oauth` Generated. +- `meta_model` (String) Static value of `oauthsource` Generated. diff --git a/docs/resources/source_plex.md b/docs/resources/source_plex.md index 8660a0fb..c262b65a 100644 --- a/docs/resources/source_plex.md +++ b/docs/resources/source_plex.md @@ -67,3 +67,5 @@ resource "authentik_source_plex" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_sources_plex` Generated. +- `meta_model` (String) Static value of `plexsource` Generated. diff --git a/docs/resources/source_saml.md b/docs/resources/source_saml.md index 51336e26..f80f8521 100644 --- a/docs/resources/source_saml.md +++ b/docs/resources/source_saml.md @@ -114,4 +114,6 @@ resource "authentik_source_saml" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_sources_saml` Generated. +- `meta_model` (String) Static value of `samlsource` Generated. - `metadata` (String) SAML Metadata Generated. diff --git a/docs/resources/source_scim.md b/docs/resources/source_scim.md index dcbd9e24..34262e26 100644 --- a/docs/resources/source_scim.md +++ b/docs/resources/source_scim.md @@ -39,5 +39,7 @@ resource "authentik_source_scim" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_sources_scim` Generated. +- `meta_model` (String) Static value of `scimsource` Generated. - `scim_url` (String) SCIM URL Generated. - `token` (String) SCIM URL Generated. diff --git a/docs/resources/source_telegram.md b/docs/resources/source_telegram.md index 1a5a6205..e6136a94 100644 --- a/docs/resources/source_telegram.md +++ b/docs/resources/source_telegram.md @@ -47,3 +47,5 @@ description: |- ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_sources_telegram` Generated. +- `meta_model` (String) Static value of `telegramsource` Generated. diff --git a/docs/resources/stage_authenticator_duo.md b/docs/resources/stage_authenticator_duo.md index 359a4752..f62ab018 100644 --- a/docs/resources/stage_authenticator_duo.md +++ b/docs/resources/stage_authenticator_duo.md @@ -42,3 +42,5 @@ resource "authentik_stage_authenticator_duo" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_authenticator_duo` Generated. +- `meta_model` (String) Static value of `authenticatorduostage` Generated. diff --git a/docs/resources/stage_authenticator_email.md b/docs/resources/stage_authenticator_email.md index 57415a41..53761b4a 100644 --- a/docs/resources/stage_authenticator_email.md +++ b/docs/resources/stage_authenticator_email.md @@ -38,3 +38,5 @@ description: |- ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_authenticator_email` Generated. +- `meta_model` (String) Static value of `authenticatoremailstage` Generated. diff --git a/docs/resources/stage_authenticator_endpoint_gdtc.md b/docs/resources/stage_authenticator_endpoint_gdtc.md index e2812897..f3265b81 100644 --- a/docs/resources/stage_authenticator_endpoint_gdtc.md +++ b/docs/resources/stage_authenticator_endpoint_gdtc.md @@ -27,3 +27,5 @@ description: |- ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_authenticator_endpoint_gdtc` Generated. +- `meta_model` (String) Static value of `authenticatorendpointgdtcstage` Generated. diff --git a/docs/resources/stage_authenticator_sms.md b/docs/resources/stage_authenticator_sms.md index 493b63e2..6185f71b 100644 --- a/docs/resources/stage_authenticator_sms.md +++ b/docs/resources/stage_authenticator_sms.md @@ -40,3 +40,5 @@ description: |- ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_authenticator_sms` Generated. +- `meta_model` (String) Static value of `authenticatorsmsstage` Generated. diff --git a/docs/resources/stage_authenticator_static.md b/docs/resources/stage_authenticator_static.md index 2fd6d414..3febf800 100644 --- a/docs/resources/stage_authenticator_static.md +++ b/docs/resources/stage_authenticator_static.md @@ -36,3 +36,5 @@ resource "authentik_stage_authenticator_static" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_authenticator_static` Generated. +- `meta_model` (String) Static value of `authenticatorstaticstage` Generated. diff --git a/docs/resources/stage_authenticator_totp.md b/docs/resources/stage_authenticator_totp.md index dec29929..fa863f59 100644 --- a/docs/resources/stage_authenticator_totp.md +++ b/docs/resources/stage_authenticator_totp.md @@ -38,3 +38,5 @@ resource "authentik_stage_authenticator_totp" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_authenticator_totp` Generated. +- `meta_model` (String) Static value of `authenticatortotpstage` Generated. diff --git a/docs/resources/stage_authenticator_validate.md b/docs/resources/stage_authenticator_validate.md index 52149fde..ea8911a5 100644 --- a/docs/resources/stage_authenticator_validate.md +++ b/docs/resources/stage_authenticator_validate.md @@ -47,3 +47,5 @@ resource "authentik_stage_authenticator_validate" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_authenticator_validate` Generated. +- `meta_model` (String) Static value of `authenticatorvalidatestage` Generated. diff --git a/docs/resources/stage_authenticator_webauthn.md b/docs/resources/stage_authenticator_webauthn.md index 617a0df2..200e2b8e 100644 --- a/docs/resources/stage_authenticator_webauthn.md +++ b/docs/resources/stage_authenticator_webauthn.md @@ -62,3 +62,5 @@ resource "authentik_stage_authenticator_webauthn" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_authenticator_webauthn` Generated. +- `meta_model` (String) Static value of `authenticatorwebauthnstage` Generated. diff --git a/docs/resources/stage_captcha.md b/docs/resources/stage_captcha.md index 61368f08..de423145 100644 --- a/docs/resources/stage_captcha.md +++ b/docs/resources/stage_captcha.md @@ -42,3 +42,5 @@ resource "authentik_stage_captcha" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_captcha` Generated. +- `meta_model` (String) Static value of `captchastage` Generated. diff --git a/docs/resources/stage_consent.md b/docs/resources/stage_consent.md index df9d8f5c..d36b91d8 100644 --- a/docs/resources/stage_consent.md +++ b/docs/resources/stage_consent.md @@ -38,3 +38,5 @@ resource "authentik_stage_consent" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_consent` Generated. +- `meta_model` (String) Static value of `consentstage` Generated. diff --git a/docs/resources/stage_deny.md b/docs/resources/stage_deny.md index 105ba2b2..7260e36b 100644 --- a/docs/resources/stage_deny.md +++ b/docs/resources/stage_deny.md @@ -33,3 +33,5 @@ resource "authentik_stage_deny" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_deny` Generated. +- `meta_model` (String) Static value of `denystage` Generated. diff --git a/docs/resources/stage_dummy.md b/docs/resources/stage_dummy.md index b3ed044e..cd5c9682 100644 --- a/docs/resources/stage_dummy.md +++ b/docs/resources/stage_dummy.md @@ -29,3 +29,5 @@ resource "authentik_stage_dummy" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_dummy` Generated. +- `meta_model` (String) Static value of `dummystage` Generated. diff --git a/docs/resources/stage_email.md b/docs/resources/stage_email.md index c7dd5627..dc8d4e15 100644 --- a/docs/resources/stage_email.md +++ b/docs/resources/stage_email.md @@ -47,3 +47,5 @@ resource "authentik_stage_email" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_email` Generated. +- `meta_model` (String) Static value of `emailstage` Generated. diff --git a/docs/resources/stage_identification.md b/docs/resources/stage_identification.md index 4de9a573..80e961ff 100644 --- a/docs/resources/stage_identification.md +++ b/docs/resources/stage_identification.md @@ -67,3 +67,5 @@ resource "authentik_stage_identification" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_identification` Generated. +- `meta_model` (String) Static value of `identificationstage` Generated. diff --git a/docs/resources/stage_invitation.md b/docs/resources/stage_invitation.md index 674ea8f2..833e6a99 100644 --- a/docs/resources/stage_invitation.md +++ b/docs/resources/stage_invitation.md @@ -33,3 +33,5 @@ resource "authentik_stage_invitation" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_invitation` Generated. +- `meta_model` (String) Static value of `invitationstage` Generated. diff --git a/docs/resources/stage_mutual_tls.md b/docs/resources/stage_mutual_tls.md index 55796bff..ff96b41f 100644 --- a/docs/resources/stage_mutual_tls.md +++ b/docs/resources/stage_mutual_tls.md @@ -46,3 +46,5 @@ resource "authentik_stage_mutual_tls" "mtls" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_mtls` Generated. +- `meta_model` (String) Static value of `mutualtlsstage` Generated. diff --git a/docs/resources/stage_password.md b/docs/resources/stage_password.md index 41cf9558..5d8a6c23 100644 --- a/docs/resources/stage_password.md +++ b/docs/resources/stage_password.md @@ -37,3 +37,5 @@ resource "authentik_stage_password" "test" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_password` Generated. +- `meta_model` (String) Static value of `passwordstage` Generated. diff --git a/docs/resources/stage_prompt.md b/docs/resources/stage_prompt.md index 54516c00..357f0cc4 100644 --- a/docs/resources/stage_prompt.md +++ b/docs/resources/stage_prompt.md @@ -43,3 +43,5 @@ resource "authentik_stage_prompt" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_prompt` Generated. +- `meta_model` (String) Static value of `promptstage` Generated. diff --git a/docs/resources/stage_prompt_field.md b/docs/resources/stage_prompt_field.md index e31fbbbf..69d4ebe8 100644 --- a/docs/resources/stage_prompt_field.md +++ b/docs/resources/stage_prompt_field.md @@ -63,3 +63,5 @@ resource "authentik_stage_prompt_field" "field" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_prompt` Generated. +- `meta_model` (String) Static value of `prompt` Generated. diff --git a/docs/resources/stage_redirect.md b/docs/resources/stage_redirect.md index 37bfdbc0..2bd418cd 100644 --- a/docs/resources/stage_redirect.md +++ b/docs/resources/stage_redirect.md @@ -53,3 +53,5 @@ resource "authentik_stage_redirect" "flow" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_redirect` Generated. +- `meta_model` (String) Static value of `redirectstage` Generated. diff --git a/docs/resources/stage_source.md b/docs/resources/stage_source.md index d5d2d746..0d83d8af 100644 --- a/docs/resources/stage_source.md +++ b/docs/resources/stage_source.md @@ -51,3 +51,5 @@ resource "authentik_stage_source" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_source` Generated. +- `meta_model` (String) Static value of `sourcestage` Generated. diff --git a/docs/resources/stage_user_delete.md b/docs/resources/stage_user_delete.md index 92a0bead..c44b71b8 100644 --- a/docs/resources/stage_user_delete.md +++ b/docs/resources/stage_user_delete.md @@ -29,3 +29,5 @@ resource "authentik_stage_user_delete" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_user_delete` Generated. +- `meta_model` (String) Static value of `userdeletestage` Generated. diff --git a/docs/resources/stage_user_login.md b/docs/resources/stage_user_login.md index ee986042..55ac59e3 100644 --- a/docs/resources/stage_user_login.md +++ b/docs/resources/stage_user_login.md @@ -48,3 +48,5 @@ resource "authentik_stage_user_login" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_user_login` Generated. +- `meta_model` (String) Static value of `userloginstage` Generated. diff --git a/docs/resources/stage_user_logout.md b/docs/resources/stage_user_logout.md index 656235c6..cdcce40a 100644 --- a/docs/resources/stage_user_logout.md +++ b/docs/resources/stage_user_logout.md @@ -29,3 +29,5 @@ resource "authentik_stage_user_logout" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_user_logout` Generated. +- `meta_model` (String) Static value of `userlogoutstage` Generated. diff --git a/docs/resources/stage_user_write.md b/docs/resources/stage_user_write.md index 8db8f372..10947812 100644 --- a/docs/resources/stage_user_write.md +++ b/docs/resources/stage_user_write.md @@ -46,3 +46,5 @@ resource "authentik_stage_user_write" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_stages_user_write` Generated. +- `meta_model` (String) Static value of `userwritestage` Generated. diff --git a/docs/resources/system_settings.md b/docs/resources/system_settings.md index dd0fbf73..c14e39c7 100644 --- a/docs/resources/system_settings.md +++ b/docs/resources/system_settings.md @@ -46,4 +46,4 @@ resource "authentik_system_settings" "settings" { Import is supported using the following syntax: -{{codefile "shell" "examples/resources/authentik_system_settings/import.sh"}} +{{codefile "shell" "/Users/jens/dev/terraform-provider-authentik/examples/resources/authentik_system_settings/import.sh"}} diff --git a/docs/resources/token.md b/docs/resources/token.md index 82dc8be2..09345239 100644 --- a/docs/resources/token.md +++ b/docs/resources/token.md @@ -53,3 +53,5 @@ resource "authentik_token" "default" { - `expires_in` (Number) Generated. - `id` (String) The ID of this resource. - `key` (String, Sensitive) Generated. +- `meta_app` (String) Static value of `authentik_core` Generated. +- `meta_model` (String) Static value of `token` Generated. diff --git a/docs/resources/user.md b/docs/resources/user.md index 5e4731a0..3b12a446 100644 --- a/docs/resources/user.md +++ b/docs/resources/user.md @@ -58,3 +58,5 @@ resource "authentik_user" "name" { ### Read-Only - `id` (String) The ID of this resource. +- `meta_app` (String) Static value of `authentik_core` Generated. +- `meta_model` (String) Static value of `user` Generated. diff --git a/pkg/helpers/meta.go b/pkg/helpers/meta.go new file mode 100644 index 00000000..2f562c00 --- /dev/null +++ b/pkg/helpers/meta.go @@ -0,0 +1,30 @@ +package helpers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "goauthentik.io/api/v3" +) + +func ModelSchema(m api.ModelEnum, os map[string]*schema.Schema) map[string]*schema.Schema { + parts := strings.Split(string(m), ".") + os["meta_app"] = &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: fmt.Sprintf("Static value of `%s`", parts[0]), + DefaultFunc: func() (interface{}, error) { + return parts[0], nil + }, + } + os["meta_model"] = &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: fmt.Sprintf("Static value of `%s`", parts[1]), + DefaultFunc: func() (interface{}, error) { + return parts[1], nil + }, + } + return os +} diff --git a/pkg/provider/resource_application.go b/pkg/provider/resource_application.go index 02baa0ad..d8b5a3d1 100644 --- a/pkg/provider/resource_application.go +++ b/pkg/provider/resource_application.go @@ -19,64 +19,67 @@ func resourceApplication() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "group": { - Type: schema.TypeString, - Optional: true, - }, - "uuid": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "slug": { - Type: schema.TypeString, - Required: true, - }, - "protocol_provider": { - Type: schema.TypeInt, - Optional: true, - }, - "backchannel_providers": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeInt, + Schema: helpers.ModelSchema( + api.MODELENUM_CORE_APPLICATION, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "group": { + Type: schema.TypeString, + Optional: true, + }, + "uuid": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "slug": { + Type: schema.TypeString, + Required: true, + }, + "protocol_provider": { + Type: schema.TypeInt, + Optional: true, + }, + "backchannel_providers": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + }, + "meta_launch_url": { + Type: schema.TypeString, + Optional: true, + }, + "meta_icon": { + Type: schema.TypeString, + Optional: true, + }, + "meta_description": { + Type: schema.TypeString, + Optional: true, + }, + "meta_publisher": { + Type: schema.TypeString, + Optional: true, + }, + "policy_engine_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.POLICYENGINEMODE_ANY, + Description: helpers.EnumToDescription(api.AllowedPolicyEngineModeEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedPolicyEngineModeEnumValues), + }, + "open_in_new_tab": { + Type: schema.TypeBool, + Optional: true, + Default: false, }, }, - "meta_launch_url": { - Type: schema.TypeString, - Optional: true, - }, - "meta_icon": { - Type: schema.TypeString, - Optional: true, - }, - "meta_description": { - Type: schema.TypeString, - Optional: true, - }, - "meta_publisher": { - Type: schema.TypeString, - Optional: true, - }, - "policy_engine_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.POLICYENGINEMODE_ANY, - Description: helpers.EnumToDescription(api.AllowedPolicyEngineModeEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedPolicyEngineModeEnumValues), - }, - "open_in_new_tab": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - }, + ), } } diff --git a/pkg/provider/resource_application_entitlement.go b/pkg/provider/resource_application_entitlement.go index 0a14331e..421e82b1 100644 --- a/pkg/provider/resource_application_entitlement.go +++ b/pkg/provider/resource_application_entitlement.go @@ -19,24 +19,27 @@ func resourceApplicationEntitlement() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_CORE_APPLICATIONENTITLEMENT, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "application": { + Type: schema.TypeString, + Required: true, + }, + "attributes": { + Type: schema.TypeString, + Optional: true, + Default: "{}", + Description: helpers.JSONDescription, + DiffSuppressFunc: helpers.DiffSuppressJSON, + ValidateDiagFunc: helpers.ValidateJSON, + }, }, - "application": { - Type: schema.TypeString, - Required: true, - }, - "attributes": { - Type: schema.TypeString, - Optional: true, - Default: "{}", - Description: helpers.JSONDescription, - DiffSuppressFunc: helpers.DiffSuppressJSON, - ValidateDiagFunc: helpers.ValidateJSON, - }, - }, + ), } } diff --git a/pkg/provider/resource_blueprint_instance.go b/pkg/provider/resource_blueprint_instance.go index 0d5de1db..68ea6d41 100644 --- a/pkg/provider/resource_blueprint_instance.go +++ b/pkg/provider/resource_blueprint_instance.go @@ -19,33 +19,36 @@ func resourceBlueprintInstance() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_BLUEPRINTS_BLUEPRINTINSTANCE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "path": { + Type: schema.TypeString, + Optional: true, + }, + "content": { + Type: schema.TypeString, + Optional: true, + }, + "enabled": { + Type: schema.TypeBool, + Default: true, + Optional: true, + }, + "context": { + Type: schema.TypeString, + Optional: true, + Default: "{}", + Description: helpers.JSONDescription, + DiffSuppressFunc: helpers.DiffSuppressJSON, + ValidateDiagFunc: helpers.ValidateJSON, + }, }, - "path": { - Type: schema.TypeString, - Optional: true, - }, - "content": { - Type: schema.TypeString, - Optional: true, - }, - "enabled": { - Type: schema.TypeBool, - Default: true, - Optional: true, - }, - "context": { - Type: schema.TypeString, - Optional: true, - Default: "{}", - Description: helpers.JSONDescription, - DiffSuppressFunc: helpers.DiffSuppressJSON, - ValidateDiagFunc: helpers.ValidateJSON, - }, - }, + ), } } diff --git a/pkg/provider/resource_brand.go b/pkg/provider/resource_brand.go index f2b7341d..cca230fa 100644 --- a/pkg/provider/resource_brand.go +++ b/pkg/provider/resource_brand.go @@ -19,86 +19,89 @@ func resourceBrand() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "domain": { - Type: schema.TypeString, - Required: true, - }, - "default": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "branding_title": { - Type: schema.TypeString, - Optional: true, - Default: "authentik", - }, - "branding_logo": { - Type: schema.TypeString, - Optional: true, - }, - "branding_default_flow_background": { - Type: schema.TypeString, - Optional: true, - Default: "/static/dist/assets/images/flow_background.jpg", - }, - "branding_custom_css": { - Type: schema.TypeString, - Optional: true, - }, - "branding_favicon": { - Type: schema.TypeString, - Optional: true, - }, - "flow_authentication": { - Type: schema.TypeString, - Optional: true, - }, - "flow_invalidation": { - Type: schema.TypeString, - Optional: true, - }, - "flow_recovery": { - Type: schema.TypeString, - Optional: true, - }, - "flow_unenrollment": { - Type: schema.TypeString, - Optional: true, - }, - "flow_user_settings": { - Type: schema.TypeString, - Optional: true, - }, - "flow_device_code": { - Type: schema.TypeString, - Optional: true, - }, - "web_certificate": { - Type: schema.TypeString, - Optional: true, - }, - "client_certificates": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + Schema: helpers.ModelSchema( + api.MODELENUM_BRANDS_BRAND, + map[string]*schema.Schema{ + "domain": { + Type: schema.TypeString, + Required: true, + }, + "default": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "branding_title": { + Type: schema.TypeString, + Optional: true, + Default: "authentik", + }, + "branding_logo": { + Type: schema.TypeString, + Optional: true, + }, + "branding_default_flow_background": { + Type: schema.TypeString, + Optional: true, + Default: "/static/dist/assets/images/flow_background.jpg", + }, + "branding_custom_css": { + Type: schema.TypeString, + Optional: true, + }, + "branding_favicon": { + Type: schema.TypeString, + Optional: true, + }, + "flow_authentication": { + Type: schema.TypeString, + Optional: true, + }, + "flow_invalidation": { + Type: schema.TypeString, + Optional: true, + }, + "flow_recovery": { + Type: schema.TypeString, + Optional: true, + }, + "flow_unenrollment": { + Type: schema.TypeString, + Optional: true, + }, + "flow_user_settings": { + Type: schema.TypeString, + Optional: true, + }, + "flow_device_code": { + Type: schema.TypeString, + Optional: true, + }, + "web_certificate": { + Type: schema.TypeString, + Optional: true, + }, + "client_certificates": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "default_application": { + Type: schema.TypeString, + Optional: true, + }, + "attributes": { + Type: schema.TypeString, + Optional: true, + Default: "{}", + Description: helpers.JSONDescription, + DiffSuppressFunc: helpers.DiffSuppressJSON, + ValidateDiagFunc: helpers.ValidateJSON, }, }, - "default_application": { - Type: schema.TypeString, - Optional: true, - }, - "attributes": { - Type: schema.TypeString, - Optional: true, - Default: "{}", - Description: helpers.JSONDescription, - DiffSuppressFunc: helpers.DiffSuppressJSON, - ValidateDiagFunc: helpers.ValidateJSON, - }, - }, + ), } } diff --git a/pkg/provider/resource_certificate_key_pair.go b/pkg/provider/resource_certificate_key_pair.go index b46fe9b5..5d1940e5 100644 --- a/pkg/provider/resource_certificate_key_pair.go +++ b/pkg/provider/resource_certificate_key_pair.go @@ -19,21 +19,24 @@ func resourceCertificateKeyPair() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_CRYPTO_CERTIFICATEKEYPAIR, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "certificate_data": { + Type: schema.TypeString, + Required: true, + }, + "key_data": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + }, }, - "certificate_data": { - Type: schema.TypeString, - Required: true, - }, - "key_data": { - Type: schema.TypeString, - Optional: true, - Sensitive: true, - }, - }, + ), } } diff --git a/pkg/provider/resource_enterprise_license.go b/pkg/provider/resource_enterprise_license.go index 88e2757d..ad7f6e0a 100644 --- a/pkg/provider/resource_enterprise_license.go +++ b/pkg/provider/resource_enterprise_license.go @@ -19,29 +19,32 @@ func resourceEnterpriseLicense() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "key": { - Type: schema.TypeString, - Sensitive: true, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_ENTERPRISE_LICENSE, + map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Sensitive: true, + Required: true, + }, + "name": { + Type: schema.TypeString, + Computed: true, + }, + "expiry": { + Type: schema.TypeInt, + Computed: true, + }, + "internal_users": { + Type: schema.TypeInt, + Computed: true, + }, + "external_users": { + Type: schema.TypeInt, + Computed: true, + }, }, - "name": { - Type: schema.TypeString, - Computed: true, - }, - "expiry": { - Type: schema.TypeInt, - Computed: true, - }, - "internal_users": { - Type: schema.TypeInt, - Computed: true, - }, - "external_users": { - Type: schema.TypeInt, - Computed: true, - }, - }, + ), } } diff --git a/pkg/provider/resource_event_rule.go b/pkg/provider/resource_event_rule.go index 88ced5d0..9281b2ac 100644 --- a/pkg/provider/resource_event_rule.go +++ b/pkg/provider/resource_event_rule.go @@ -19,37 +19,40 @@ func resourceEventRule() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "transports": { - Type: schema.TypeList, - Required: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + Schema: helpers.ModelSchema( + api.MODELENUM_EVENTS_NOTIFICATIONRULE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "transports": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "severity": { + Type: schema.TypeString, + Optional: true, + Default: api.SEVERITYENUM_WARNING, + Description: helpers.EnumToDescription(api.AllowedSeverityEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedSeverityEnumEnumValues), + }, + "destination_group": { + Type: schema.TypeString, + Optional: true, + Description: "Group to send notification to", + }, + "destination_event_user": { + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Send notification to event user", }, }, - "severity": { - Type: schema.TypeString, - Optional: true, - Default: api.SEVERITYENUM_WARNING, - Description: helpers.EnumToDescription(api.AllowedSeverityEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedSeverityEnumEnumValues), - }, - "destination_group": { - Type: schema.TypeString, - Optional: true, - Description: "Group to send notification to", - }, - "destination_event_user": { - Type: schema.TypeBool, - Optional: true, - Default: false, - Description: "Send notification to event user", - }, - }, + ), } } diff --git a/pkg/provider/resource_event_transport.go b/pkg/provider/resource_event_transport.go index 166f99ba..9df90d14 100644 --- a/pkg/provider/resource_event_transport.go +++ b/pkg/provider/resource_event_transport.go @@ -19,45 +19,48 @@ func resourceEventTransport() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_EVENTS_NOTIFICATIONTRANSPORT, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "mode": { + Type: schema.TypeString, + Required: true, + Description: helpers.EnumToDescription(api.AllowedNotificationTransportModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedNotificationTransportModeEnumEnumValues), + }, + "webhook_url": { + Type: schema.TypeString, + Optional: true, + }, + "webhook_mapping_body": { + Type: schema.TypeString, + Optional: true, + }, + "webhook_mapping_headers": { + Type: schema.TypeString, + Optional: true, + }, + "email_template": { + Type: schema.TypeString, + Optional: true, + Default: "email/event_notification.html", + }, + "email_subject_prefix": { + Type: schema.TypeString, + Optional: true, + Default: "authentik Notification:", + }, + "send_once": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, }, - "mode": { - Type: schema.TypeString, - Required: true, - Description: helpers.EnumToDescription(api.AllowedNotificationTransportModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedNotificationTransportModeEnumEnumValues), - }, - "webhook_url": { - Type: schema.TypeString, - Optional: true, - }, - "webhook_mapping_body": { - Type: schema.TypeString, - Optional: true, - }, - "webhook_mapping_headers": { - Type: schema.TypeString, - Optional: true, - }, - "email_template": { - Type: schema.TypeString, - Optional: true, - Default: "email/event_notification.html", - }, - "email_subject_prefix": { - Type: schema.TypeString, - Optional: true, - Default: "authentik Notification:", - }, - "send_once": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - }, + ), } } diff --git a/pkg/provider/resource_flow.go b/pkg/provider/resource_flow.go index fe0b913a..75e07ae9 100644 --- a/pkg/provider/resource_flow.go +++ b/pkg/provider/resource_flow.go @@ -19,66 +19,69 @@ func resourceFlow() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_FLOWS_FLOW, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "uuid": { + Type: schema.TypeString, + Computed: true, + }, + "slug": { + Type: schema.TypeString, + Required: true, + }, + "title": { + Type: schema.TypeString, + Required: true, + }, + "designation": { + Type: schema.TypeString, + Required: true, + Description: helpers.EnumToDescription(api.AllowedFlowDesignationEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedFlowDesignationEnumEnumValues), + }, + "authentication": { + Type: schema.TypeString, + Optional: true, + Default: api.AUTHENTICATIONENUM_NONE, + Description: helpers.EnumToDescription(api.AllowedAuthenticationEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedAuthenticationEnumEnumValues), + }, + "layout": { + Type: schema.TypeString, + Optional: true, + Default: api.FLOWLAYOUTENUM_STACKED, + Description: helpers.EnumToDescription(api.AllowedFlowLayoutEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedFlowLayoutEnumEnumValues), + }, + "background": { + Type: schema.TypeString, + Optional: true, + Description: "Optional URL to an image which will be used as the background during the flow.", + }, + "policy_engine_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.POLICYENGINEMODE_ANY, + Description: helpers.EnumToDescription(api.AllowedPolicyEngineModeEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedPolicyEngineModeEnumValues), + }, + "denied_action": { + Type: schema.TypeString, + Optional: true, + Default: api.DENIEDACTIONENUM_MESSAGE_CONTINUE, + }, + "compatibility_mode": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, }, - "uuid": { - Type: schema.TypeString, - Computed: true, - }, - "slug": { - Type: schema.TypeString, - Required: true, - }, - "title": { - Type: schema.TypeString, - Required: true, - }, - "designation": { - Type: schema.TypeString, - Required: true, - Description: helpers.EnumToDescription(api.AllowedFlowDesignationEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedFlowDesignationEnumEnumValues), - }, - "authentication": { - Type: schema.TypeString, - Optional: true, - Default: api.AUTHENTICATIONENUM_NONE, - Description: helpers.EnumToDescription(api.AllowedAuthenticationEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedAuthenticationEnumEnumValues), - }, - "layout": { - Type: schema.TypeString, - Optional: true, - Default: api.FLOWLAYOUTENUM_STACKED, - Description: helpers.EnumToDescription(api.AllowedFlowLayoutEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedFlowLayoutEnumEnumValues), - }, - "background": { - Type: schema.TypeString, - Optional: true, - Description: "Optional URL to an image which will be used as the background during the flow.", - }, - "policy_engine_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.POLICYENGINEMODE_ANY, - Description: helpers.EnumToDescription(api.AllowedPolicyEngineModeEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedPolicyEngineModeEnumValues), - }, - "denied_action": { - Type: schema.TypeString, - Optional: true, - Default: api.DENIEDACTIONENUM_MESSAGE_CONTINUE, - }, - "compatibility_mode": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - }, + ), } } diff --git a/pkg/provider/resource_flow_stage_binding.go b/pkg/provider/resource_flow_stage_binding.go index 5b76e583..c61ac960 100644 --- a/pkg/provider/resource_flow_stage_binding.go +++ b/pkg/provider/resource_flow_stage_binding.go @@ -19,46 +19,49 @@ func resourceFlowStageBinding() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "target": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_FLOWS_FLOWSTAGEBINDING, + map[string]*schema.Schema{ + "target": { + Type: schema.TypeString, + Required: true, + }, + "stage": { + Type: schema.TypeString, + Required: true, + }, + "evaluate_on_plan": { + Type: schema.TypeBool, + Optional: true, + Default: true, + Description: "Evaluate policies during the Flow planning process.", + }, + "re_evaluate_policies": { + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Evaluate policies when the Stage is present to the user.", + }, + "order": { + Type: schema.TypeInt, + Required: true, + }, + "policy_engine_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.POLICYENGINEMODE_ANY, + Description: helpers.EnumToDescription(api.AllowedPolicyEngineModeEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedPolicyEngineModeEnumValues), + }, + "invalid_response_action": { + Type: schema.TypeString, + Optional: true, + Default: api.INVALIDRESPONSEACTIONENUM_RETRY, + Description: helpers.EnumToDescription(api.AllowedInvalidResponseActionEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedInvalidResponseActionEnumEnumValues), + }, }, - "stage": { - Type: schema.TypeString, - Required: true, - }, - "evaluate_on_plan": { - Type: schema.TypeBool, - Optional: true, - Default: true, - Description: "Evaluate policies during the Flow planning process.", - }, - "re_evaluate_policies": { - Type: schema.TypeBool, - Optional: true, - Default: false, - Description: "Evaluate policies when the Stage is present to the user.", - }, - "order": { - Type: schema.TypeInt, - Required: true, - }, - "policy_engine_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.POLICYENGINEMODE_ANY, - Description: helpers.EnumToDescription(api.AllowedPolicyEngineModeEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedPolicyEngineModeEnumValues), - }, - "invalid_response_action": { - Type: schema.TypeString, - Optional: true, - Default: api.INVALIDRESPONSEACTIONENUM_RETRY, - Description: helpers.EnumToDescription(api.AllowedInvalidResponseActionEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedInvalidResponseActionEnumEnumValues), - }, - }, + ), } } diff --git a/pkg/provider/resource_group.go b/pkg/provider/resource_group.go index 22bfd6c4..5bfe72b5 100644 --- a/pkg/provider/resource_group.go +++ b/pkg/provider/resource_group.go @@ -19,44 +19,47 @@ func resourceGroup() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "is_superuser": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "parent": { - Type: schema.TypeString, - Optional: true, - }, - "users": { - Type: schema.TypeList, - Optional: true, - Computed: true, - Elem: &schema.Schema{ - Type: schema.TypeInt, + Schema: helpers.ModelSchema( + api.MODELENUM_CORE_GROUP, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, }, - }, - "attributes": { - Type: schema.TypeString, - Optional: true, - Default: "{}", - Description: helpers.JSONDescription, - DiffSuppressFunc: helpers.DiffSuppressJSON, - ValidateDiagFunc: helpers.ValidateJSON, - }, - "roles": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "is_superuser": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "parent": { + Type: schema.TypeString, + Optional: true, + }, + "users": { + Type: schema.TypeList, + Optional: true, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + }, + "attributes": { + Type: schema.TypeString, + Optional: true, + Default: "{}", + Description: helpers.JSONDescription, + DiffSuppressFunc: helpers.DiffSuppressJSON, + ValidateDiagFunc: helpers.ValidateJSON, + }, + "roles": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, }, - }, + ), } } diff --git a/pkg/provider/resource_outpost.go b/pkg/provider/resource_outpost.go index 9d0aa6d3..adc6865e 100644 --- a/pkg/provider/resource_outpost.go +++ b/pkg/provider/resource_outpost.go @@ -19,38 +19,41 @@ func resourceOutpost() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "type": { - Type: schema.TypeString, - Optional: true, - Default: api.OUTPOSTTYPEENUM_PROXY, - Description: helpers.EnumToDescription(api.AllowedOutpostTypeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedOutpostTypeEnumEnumValues), - }, - "protocol_providers": { - Type: schema.TypeList, - Required: true, - Elem: &schema.Schema{ - Type: schema.TypeInt, + Schema: helpers.ModelSchema( + api.MODELENUM_OUTPOSTS_OUTPOST, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "type": { + Type: schema.TypeString, + Optional: true, + Default: api.OUTPOSTTYPEENUM_PROXY, + Description: helpers.EnumToDescription(api.AllowedOutpostTypeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedOutpostTypeEnumEnumValues), + }, + "protocol_providers": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + }, + "service_connection": { + Type: schema.TypeString, + Optional: true, + }, + "config": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: helpers.JSONDescription, + DiffSuppressFunc: helpers.DiffSuppressJSON, + ValidateDiagFunc: helpers.ValidateJSON, }, }, - "service_connection": { - Type: schema.TypeString, - Optional: true, - }, - "config": { - Type: schema.TypeString, - Optional: true, - Computed: true, - Description: helpers.JSONDescription, - DiffSuppressFunc: helpers.DiffSuppressJSON, - ValidateDiagFunc: helpers.ValidateJSON, - }, - }, + ), } } diff --git a/pkg/provider/resource_outpost_sc_docker.go b/pkg/provider/resource_outpost_sc_docker.go index 1ac21aa0..7d7eecb7 100644 --- a/pkg/provider/resource_outpost_sc_docker.go +++ b/pkg/provider/resource_outpost_sc_docker.go @@ -19,30 +19,33 @@ func resourceServiceConnectionDocker() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_OUTPOSTS_DOCKERSERVICECONNECTION, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "local": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "url": { + Type: schema.TypeString, + Optional: true, + Default: "http+unix:///var/run/docker.sock", + }, + "tls_verification": { + Type: schema.TypeString, + Optional: true, + }, + "tls_authentication": { + Type: schema.TypeString, + Optional: true, + }, }, - "local": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "url": { - Type: schema.TypeString, - Optional: true, - Default: "http+unix:///var/run/docker.sock", - }, - "tls_verification": { - Type: schema.TypeString, - Optional: true, - }, - "tls_authentication": { - Type: schema.TypeString, - Optional: true, - }, - }, + ), } } diff --git a/pkg/provider/resource_outpost_sc_kubernetes.go b/pkg/provider/resource_outpost_sc_kubernetes.go index 313ffc1a..6c7b8582 100644 --- a/pkg/provider/resource_outpost_sc_kubernetes.go +++ b/pkg/provider/resource_outpost_sc_kubernetes.go @@ -19,31 +19,34 @@ func resourceServiceConnectionKubernetes() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_OUTPOSTS_KUBERNETESSERVICECONNECTION, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "local": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "kubeconfig": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + Default: "{}", + Description: helpers.JSONDescription, + DiffSuppressFunc: helpers.DiffSuppressJSON, + ValidateDiagFunc: helpers.ValidateJSON, + }, + "verify_ssl": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, }, - "local": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "kubeconfig": { - Type: schema.TypeString, - Optional: true, - Sensitive: true, - Default: "{}", - Description: helpers.JSONDescription, - DiffSuppressFunc: helpers.DiffSuppressJSON, - ValidateDiagFunc: helpers.ValidateJSON, - }, - "verify_ssl": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - }, + ), } } diff --git a/pkg/provider/resource_policy_binding.go b/pkg/provider/resource_policy_binding.go index e3ec3033..93333f21 100644 --- a/pkg/provider/resource_policy_binding.go +++ b/pkg/provider/resource_policy_binding.go @@ -19,54 +19,57 @@ func resourcePolicyBinding() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "target": { - Type: schema.TypeString, - Required: true, - Description: "ID of the object this binding should apply to", + Schema: helpers.ModelSchema( + api.MODELENUM_POLICIES_POLICYBINDING, + map[string]*schema.Schema{ + "target": { + Type: schema.TypeString, + Required: true, + Description: "ID of the object this binding should apply to", + }, + "policy": { + Type: schema.TypeString, + Description: "UUID of the policy", + Optional: true, + }, + "user": { + Type: schema.TypeInt, + Description: "PK of the user", + Optional: true, + }, + "group": { + Type: schema.TypeString, + Description: "UUID of the group", + Optional: true, + }, + + // General attributes + "order": { + Type: schema.TypeInt, + Required: true, + }, + "negate": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "enabled": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "timeout": { + Type: schema.TypeInt, + Optional: true, + Default: 30, + }, + "failure_result": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, }, - "policy": { - Type: schema.TypeString, - Description: "UUID of the policy", - Optional: true, - }, - "user": { - Type: schema.TypeInt, - Description: "PK of the user", - Optional: true, - }, - "group": { - Type: schema.TypeString, - Description: "UUID of the group", - Optional: true, - }, - - // General attributes - "order": { - Type: schema.TypeInt, - Required: true, - }, - "negate": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "enabled": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "timeout": { - Type: schema.TypeInt, - Optional: true, - Default: 30, - }, - "failure_result": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - }, + ), } } diff --git a/pkg/provider/resource_policy_dummy.go b/pkg/provider/resource_policy_dummy.go index 1167fd11..b82f0941 100644 --- a/pkg/provider/resource_policy_dummy.go +++ b/pkg/provider/resource_policy_dummy.go @@ -19,32 +19,35 @@ func resourcePolicyDummy() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_POLICIES_DUMMY_DUMMYPOLICY, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "execution_logging": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "result": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "wait_min": { + Type: schema.TypeInt, + Optional: true, + Default: 5, + }, + "wait_max": { + Type: schema.TypeInt, + Optional: true, + Default: 30, + }, }, - "execution_logging": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "result": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "wait_min": { - Type: schema.TypeInt, - Optional: true, - Default: 5, - }, - "wait_max": { - Type: schema.TypeInt, - Optional: true, - Default: 30, - }, - }, + ), } } diff --git a/pkg/provider/resource_policy_event_matcher.go b/pkg/provider/resource_policy_event_matcher.go index 330b9cba..a51518b9 100644 --- a/pkg/provider/resource_policy_event_matcher.go +++ b/pkg/provider/resource_policy_event_matcher.go @@ -19,37 +19,40 @@ func resourcePolicyEventMatcher() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_POLICIES_EVENT_MATCHER_EVENTMATCHERPOLICY, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "execution_logging": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "action": { + Type: schema.TypeString, + Optional: true, + }, + "client_ip": { + Type: schema.TypeString, + Optional: true, + }, + "app": { + Type: schema.TypeString, + Optional: true, + Description: helpers.EnumToDescription(api.AllowedAppEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedAppEnumEnumValues), + }, + "model": { + Type: schema.TypeString, + Optional: true, + Description: helpers.EnumToDescription(api.AllowedModelEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedModelEnumEnumValues), + }, }, - "execution_logging": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "action": { - Type: schema.TypeString, - Optional: true, - }, - "client_ip": { - Type: schema.TypeString, - Optional: true, - }, - "app": { - Type: schema.TypeString, - Optional: true, - Description: helpers.EnumToDescription(api.AllowedAppEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedAppEnumEnumValues), - }, - "model": { - Type: schema.TypeString, - Optional: true, - Description: helpers.EnumToDescription(api.AllowedModelEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedModelEnumEnumValues), - }, - }, + ), } } diff --git a/pkg/provider/resource_policy_expiry.go b/pkg/provider/resource_policy_expiry.go index 080a1a35..fdae0e1f 100644 --- a/pkg/provider/resource_policy_expiry.go +++ b/pkg/provider/resource_policy_expiry.go @@ -19,26 +19,29 @@ func resourcePolicyExpiry() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_POLICIES_EXPIRY_PASSWORDEXPIRYPOLICY, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "execution_logging": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "days": { + Type: schema.TypeInt, + Required: true, + }, + "deny_only": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, }, - "execution_logging": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "days": { - Type: schema.TypeInt, - Required: true, - }, - "deny_only": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - }, + ), } } diff --git a/pkg/provider/resource_policy_expression.go b/pkg/provider/resource_policy_expression.go index da578e8a..0e0f87e3 100644 --- a/pkg/provider/resource_policy_expression.go +++ b/pkg/provider/resource_policy_expression.go @@ -19,22 +19,25 @@ func resourcePolicyExpression() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_POLICIES_EXPRESSION_EXPRESSIONPOLICY, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "execution_logging": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "expression": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: helpers.DiffSuppressExpression, + }, }, - "execution_logging": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "expression": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: helpers.DiffSuppressExpression, - }, - }, + ), } } diff --git a/pkg/provider/resource_policy_geoip.go b/pkg/provider/resource_policy_geoip.go index ed2eda1a..5b901198 100644 --- a/pkg/provider/resource_policy_geoip.go +++ b/pkg/provider/resource_policy_geoip.go @@ -19,61 +19,64 @@ func resourcePolicyGeoIP() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "execution_logging": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "asns": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeInt, + Schema: helpers.ModelSchema( + api.MODELENUM_POLICIES_GEOIP_GEOIPPOLICY, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, }, - }, - "check_history_distance": { - Type: schema.TypeBool, - Optional: true, - }, - "history_max_distance_km": { - Type: schema.TypeInt, - Optional: true, - Default: 100, - }, - "distance_tolerance_km": { - Type: schema.TypeInt, - Optional: true, - Default: 50, - }, - "history_login_count": { - Type: schema.TypeInt, - Optional: true, - Default: 5, - }, - "check_impossible_travel": { - Type: schema.TypeBool, - Optional: true, - }, - "impossible_tolerance_km": { - Type: schema.TypeInt, - Optional: true, - Default: 100, - }, - "countries": { - Type: schema.TypeList, - Optional: true, - Description: helpers.EnumToDescription(api.AllowedCountryCodeEnumEnumValues), - Elem: &schema.Schema{ - Type: schema.TypeString, - ValidateDiagFunc: helpers.StringInEnum(api.AllowedCountryCodeEnumEnumValues), + "execution_logging": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "asns": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + }, + "check_history_distance": { + Type: schema.TypeBool, + Optional: true, + }, + "history_max_distance_km": { + Type: schema.TypeInt, + Optional: true, + Default: 100, + }, + "distance_tolerance_km": { + Type: schema.TypeInt, + Optional: true, + Default: 50, + }, + "history_login_count": { + Type: schema.TypeInt, + Optional: true, + Default: 5, + }, + "check_impossible_travel": { + Type: schema.TypeBool, + Optional: true, + }, + "impossible_tolerance_km": { + Type: schema.TypeInt, + Optional: true, + Default: 100, + }, + "countries": { + Type: schema.TypeList, + Optional: true, + Description: helpers.EnumToDescription(api.AllowedCountryCodeEnumEnumValues), + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateDiagFunc: helpers.StringInEnum(api.AllowedCountryCodeEnumEnumValues), + }, }, }, - }, + ), } } diff --git a/pkg/provider/resource_policy_password.go b/pkg/provider/resource_policy_password.go index 7c7a816a..9f1e4b22 100644 --- a/pkg/provider/resource_policy_password.go +++ b/pkg/provider/resource_policy_password.go @@ -19,80 +19,83 @@ func resourcePolicyPassword() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_POLICIES_PASSWORD_PASSWORDPOLICY, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "execution_logging": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "password_field": { + Type: schema.TypeString, + Optional: true, + Default: "password", + }, + + "check_static_rules": { + Type: schema.TypeBool, + Default: true, + Optional: true, + }, + "check_have_i_been_pwned": { + Type: schema.TypeBool, + Default: false, + Optional: true, + }, + "check_zxcvbn": { + Type: schema.TypeBool, + Default: false, + Optional: true, + }, + + "error_message": { + Type: schema.TypeString, + Required: true, + }, + "amount_uppercase": { + Type: schema.TypeInt, + Optional: true, + }, + "amount_lowercase": { + Type: schema.TypeInt, + Optional: true, + }, + "amount_symbols": { + Type: schema.TypeInt, + Optional: true, + }, + "amount_digits": { + Type: schema.TypeInt, + Optional: true, + }, + "length_min": { + Type: schema.TypeInt, + Optional: true, + }, + "symbol_charset": { + Type: schema.TypeString, + Optional: true, + Default: "!\\\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", + }, + + "hibp_allowed_count": { + Type: schema.TypeInt, + Optional: true, + Default: 1, + }, + + "zxcvbn_score_threshold": { + Type: schema.TypeInt, + Optional: true, + Default: 2, + }, }, - "execution_logging": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "password_field": { - Type: schema.TypeString, - Optional: true, - Default: "password", - }, - - "check_static_rules": { - Type: schema.TypeBool, - Default: true, - Optional: true, - }, - "check_have_i_been_pwned": { - Type: schema.TypeBool, - Default: false, - Optional: true, - }, - "check_zxcvbn": { - Type: schema.TypeBool, - Default: false, - Optional: true, - }, - - "error_message": { - Type: schema.TypeString, - Required: true, - }, - "amount_uppercase": { - Type: schema.TypeInt, - Optional: true, - }, - "amount_lowercase": { - Type: schema.TypeInt, - Optional: true, - }, - "amount_symbols": { - Type: schema.TypeInt, - Optional: true, - }, - "amount_digits": { - Type: schema.TypeInt, - Optional: true, - }, - "length_min": { - Type: schema.TypeInt, - Optional: true, - }, - "symbol_charset": { - Type: schema.TypeString, - Optional: true, - Default: "!\\\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", - }, - - "hibp_allowed_count": { - Type: schema.TypeInt, - Optional: true, - Default: 1, - }, - - "zxcvbn_score_threshold": { - Type: schema.TypeInt, - Optional: true, - Default: 2, - }, - }, + ), } } diff --git a/pkg/provider/resource_policy_reputation.go b/pkg/provider/resource_policy_reputation.go index e9c2217f..faea839f 100644 --- a/pkg/provider/resource_policy_reputation.go +++ b/pkg/provider/resource_policy_reputation.go @@ -19,32 +19,35 @@ func resourcePolicyReputation() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_POLICIES_REPUTATION_REPUTATIONPOLICY, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "execution_logging": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "check_ip": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "check_username": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "threshold": { + Type: schema.TypeInt, + Optional: true, + Default: 10, + }, }, - "execution_logging": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "check_ip": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "check_username": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "threshold": { - Type: schema.TypeInt, - Optional: true, - Default: 10, - }, - }, + ), } } diff --git a/pkg/provider/resource_policy_unique_password.go b/pkg/provider/resource_policy_unique_password.go index cdcf65f2..22740ac3 100644 --- a/pkg/provider/resource_policy_unique_password.go +++ b/pkg/provider/resource_policy_unique_password.go @@ -19,27 +19,30 @@ func resourcePolicyUniquePassword() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_POLICIES_UNIQUE_PASSWORD_UNIQUEPASSWORDPOLICY, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "execution_logging": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "password_field": { + Type: schema.TypeString, + Optional: true, + Default: "password", + }, + "num_historical_passwords": { + Type: schema.TypeInt, + Default: 1, + Optional: true, + }, }, - "execution_logging": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "password_field": { - Type: schema.TypeString, - Optional: true, - Default: "password", - }, - "num_historical_passwords": { - Type: schema.TypeInt, - Default: 1, - Optional: true, - }, - }, + ), } } diff --git a/pkg/provider/resource_property_mapping_notification.go b/pkg/provider/resource_property_mapping_notification.go index f37d76d6..0969666b 100644 --- a/pkg/provider/resource_property_mapping_notification.go +++ b/pkg/provider/resource_property_mapping_notification.go @@ -19,17 +19,20 @@ func resourcePropertyMappingNotification() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_EVENTS_NOTIFICATIONWEBHOOKMAPPING, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "expression": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: helpers.DiffSuppressExpression, + }, }, - "expression": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: helpers.DiffSuppressExpression, - }, - }, + ), } } diff --git a/pkg/provider/resource_property_mapping_provider_google_workspace.go b/pkg/provider/resource_property_mapping_provider_google_workspace.go index de339343..ca7a4388 100644 --- a/pkg/provider/resource_property_mapping_provider_google_workspace.go +++ b/pkg/provider/resource_property_mapping_provider_google_workspace.go @@ -19,17 +19,20 @@ func resourcePropertyMappingProviderGoogleWorkspace() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_PROVIDERS_GOOGLE_WORKSPACE_GOOGLEWORKSPACEPROVIDERMAPPING, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "expression": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: helpers.DiffSuppressExpression, + }, }, - "expression": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: helpers.DiffSuppressExpression, - }, - }, + ), } } diff --git a/pkg/provider/resource_property_mapping_provider_microsoft_entra.go b/pkg/provider/resource_property_mapping_provider_microsoft_entra.go index 64e7fe2b..35a3f3f8 100644 --- a/pkg/provider/resource_property_mapping_provider_microsoft_entra.go +++ b/pkg/provider/resource_property_mapping_provider_microsoft_entra.go @@ -19,17 +19,20 @@ func resourcePropertyMappingProviderMicrosoftEntra() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_PROVIDERS_MICROSOFT_ENTRA_MICROSOFTENTRAPROVIDERMAPPING, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "expression": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: helpers.DiffSuppressExpression, + }, }, - "expression": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: helpers.DiffSuppressExpression, - }, - }, + ), } } diff --git a/pkg/provider/resource_property_mapping_provider_rac.go b/pkg/provider/resource_property_mapping_provider_rac.go index 575936f1..1cdeb11f 100644 --- a/pkg/provider/resource_property_mapping_provider_rac.go +++ b/pkg/provider/resource_property_mapping_provider_rac.go @@ -19,25 +19,28 @@ func resourcePropertyMappingProviderRAC() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_PROVIDERS_RAC_RACPROPERTYMAPPING, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "expression": { + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: helpers.DiffSuppressExpression, + }, + "settings": { + Type: schema.TypeString, + Optional: true, + Default: "{}", + Description: helpers.JSONDescription, + DiffSuppressFunc: helpers.DiffSuppressJSON, + ValidateDiagFunc: helpers.ValidateJSON, + }, }, - "expression": { - Type: schema.TypeString, - Optional: true, - DiffSuppressFunc: helpers.DiffSuppressExpression, - }, - "settings": { - Type: schema.TypeString, - Optional: true, - Default: "{}", - Description: helpers.JSONDescription, - DiffSuppressFunc: helpers.DiffSuppressJSON, - ValidateDiagFunc: helpers.ValidateJSON, - }, - }, + ), } } diff --git a/pkg/provider/resource_property_mapping_provider_radius.go b/pkg/provider/resource_property_mapping_provider_radius.go index 5f02b9cf..d4f09d8a 100644 --- a/pkg/provider/resource_property_mapping_provider_radius.go +++ b/pkg/provider/resource_property_mapping_provider_radius.go @@ -19,17 +19,20 @@ func resourcePropertyMappingProviderRadius() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_PROVIDERS_RADIUS_RADIUSPROVIDERPROPERTYMAPPING, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "expression": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: helpers.DiffSuppressExpression, + }, }, - "expression": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: helpers.DiffSuppressExpression, - }, - }, + ), } } diff --git a/pkg/provider/resource_property_mapping_provider_saml.go b/pkg/provider/resource_property_mapping_provider_saml.go index a0b7e64f..f59bfaad 100644 --- a/pkg/provider/resource_property_mapping_provider_saml.go +++ b/pkg/provider/resource_property_mapping_provider_saml.go @@ -19,25 +19,28 @@ func resourcePropertyMappingProviderSAML() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_PROVIDERS_SAML_SAMLPROPERTYMAPPING, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "saml_name": { + Type: schema.TypeString, + Required: true, + }, + "friendly_name": { + Type: schema.TypeString, + Optional: true, + }, + "expression": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: helpers.DiffSuppressExpression, + }, }, - "saml_name": { - Type: schema.TypeString, - Required: true, - }, - "friendly_name": { - Type: schema.TypeString, - Optional: true, - }, - "expression": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: helpers.DiffSuppressExpression, - }, - }, + ), } } diff --git a/pkg/provider/resource_property_mapping_provider_scim.go b/pkg/provider/resource_property_mapping_provider_scim.go index 837d8c40..de036e2b 100644 --- a/pkg/provider/resource_property_mapping_provider_scim.go +++ b/pkg/provider/resource_property_mapping_provider_scim.go @@ -19,17 +19,20 @@ func resourcePropertyMappingProviderSCIM() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_PROVIDERS_SCIM_SCIMMAPPING, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "expression": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: helpers.DiffSuppressExpression, + }, }, - "expression": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: helpers.DiffSuppressExpression, - }, - }, + ), } } diff --git a/pkg/provider/resource_property_mapping_provider_scope.go b/pkg/provider/resource_property_mapping_provider_scope.go index 4c28c1b9..59574550 100644 --- a/pkg/provider/resource_property_mapping_provider_scope.go +++ b/pkg/provider/resource_property_mapping_provider_scope.go @@ -19,25 +19,28 @@ func resourcePropertyMappingProviderScope() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_PROVIDERS_OAUTH2_SCOPEMAPPING, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "scope_name": { + Type: schema.TypeString, + Required: true, + }, + "description": { + Type: schema.TypeString, + Optional: true, + }, + "expression": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: helpers.DiffSuppressExpression, + }, }, - "scope_name": { - Type: schema.TypeString, - Required: true, - }, - "description": { - Type: schema.TypeString, - Optional: true, - }, - "expression": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: helpers.DiffSuppressExpression, - }, - }, + ), } } diff --git a/pkg/provider/resource_property_mapping_source_kerberos.go b/pkg/provider/resource_property_mapping_source_kerberos.go index 9e6564e2..771877a7 100644 --- a/pkg/provider/resource_property_mapping_source_kerberos.go +++ b/pkg/provider/resource_property_mapping_source_kerberos.go @@ -19,17 +19,20 @@ func resourcePropertyMappingSourceKerberos() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_SOURCES_KERBEROS_KERBEROSSOURCEPROPERTYMAPPING, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "expression": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: helpers.DiffSuppressExpression, + }, }, - "expression": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: helpers.DiffSuppressExpression, - }, - }, + ), } } diff --git a/pkg/provider/resource_property_mapping_source_ldap.go b/pkg/provider/resource_property_mapping_source_ldap.go index 0426392e..5feb46f6 100644 --- a/pkg/provider/resource_property_mapping_source_ldap.go +++ b/pkg/provider/resource_property_mapping_source_ldap.go @@ -19,17 +19,20 @@ func resourcePropertyMappingSourceLDAP() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_SOURCES_LDAP_LDAPSOURCEPROPERTYMAPPING, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "expression": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: helpers.DiffSuppressExpression, + }, }, - "expression": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: helpers.DiffSuppressExpression, - }, - }, + ), } } diff --git a/pkg/provider/resource_property_mapping_source_oauth.go b/pkg/provider/resource_property_mapping_source_oauth.go index ec5b1280..94d2518a 100644 --- a/pkg/provider/resource_property_mapping_source_oauth.go +++ b/pkg/provider/resource_property_mapping_source_oauth.go @@ -19,17 +19,20 @@ func resourcePropertyMappingSourceOAuth() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_SOURCES_OAUTH_OAUTHSOURCEPROPERTYMAPPING, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "expression": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: helpers.DiffSuppressExpression, + }, }, - "expression": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: helpers.DiffSuppressExpression, - }, - }, + ), } } diff --git a/pkg/provider/resource_property_mapping_source_plex.go b/pkg/provider/resource_property_mapping_source_plex.go index 0c1a4481..54ef950a 100644 --- a/pkg/provider/resource_property_mapping_source_plex.go +++ b/pkg/provider/resource_property_mapping_source_plex.go @@ -19,17 +19,20 @@ func resourcePropertyMappingSourcePlex() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_SOURCES_PLEX_PLEXSOURCEPROPERTYMAPPING, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "expression": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: helpers.DiffSuppressExpression, + }, }, - "expression": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: helpers.DiffSuppressExpression, - }, - }, + ), } } diff --git a/pkg/provider/resource_property_mapping_source_saml.go b/pkg/provider/resource_property_mapping_source_saml.go index 03afe73d..da064fa5 100644 --- a/pkg/provider/resource_property_mapping_source_saml.go +++ b/pkg/provider/resource_property_mapping_source_saml.go @@ -19,17 +19,20 @@ func resourcePropertyMappingSourceSAML() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_SOURCES_SAML_SAMLSOURCEPROPERTYMAPPING, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "expression": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: helpers.DiffSuppressExpression, + }, }, - "expression": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: helpers.DiffSuppressExpression, - }, - }, + ), } } diff --git a/pkg/provider/resource_property_mapping_source_scim.go b/pkg/provider/resource_property_mapping_source_scim.go index b5c77da4..f8ac2592 100644 --- a/pkg/provider/resource_property_mapping_source_scim.go +++ b/pkg/provider/resource_property_mapping_source_scim.go @@ -19,17 +19,20 @@ func resourcePropertyMappingSourceSCIM() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_SOURCES_SCIM_SCIMSOURCEPROPERTYMAPPING, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "expression": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: helpers.DiffSuppressExpression, + }, }, - "expression": { - Type: schema.TypeString, - Required: true, - DiffSuppressFunc: helpers.DiffSuppressExpression, - }, - }, + ), } } diff --git a/pkg/provider/resource_provider_google_workspace.go b/pkg/provider/resource_provider_google_workspace.go index 209db792..6ec79294 100644 --- a/pkg/provider/resource_provider_google_workspace.go +++ b/pkg/provider/resource_provider_google_workspace.go @@ -20,76 +20,79 @@ func resourceProviderGoogleWorkspace() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "dry_run": { - Type: schema.TypeBool, - Default: false, - Optional: true, - }, + Schema: helpers.ModelSchema( + api.MODELENUM_PROVIDERS_GOOGLE_WORKSPACE_GOOGLEWORKSPACEPROVIDER, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "dry_run": { + Type: schema.TypeBool, + Default: false, + Optional: true, + }, - "credentials": { - Type: schema.TypeString, - Optional: true, - Default: "{}", - Description: helpers.JSONDescription, - DiffSuppressFunc: helpers.DiffSuppressJSON, - ValidateDiagFunc: helpers.ValidateJSON, - }, - "delegated_subject": { - Type: schema.TypeString, - Optional: true, - }, - "default_group_email_domain": { - Type: schema.TypeString, - Required: true, - }, - "property_mappings": { - Type: schema.TypeList, - Elem: &schema.Schema{ - Type: schema.TypeString, + "credentials": { + Type: schema.TypeString, + Optional: true, + Default: "{}", + Description: helpers.JSONDescription, + DiffSuppressFunc: helpers.DiffSuppressJSON, + ValidateDiagFunc: helpers.ValidateJSON, }, - Optional: true, - }, - "property_mappings_group": { - Type: schema.TypeList, - Elem: &schema.Schema{ - Type: schema.TypeString, + "delegated_subject": { + Type: schema.TypeString, + Optional: true, + }, + "default_group_email_domain": { + Type: schema.TypeString, + Required: true, + }, + "property_mappings": { + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + }, + "property_mappings_group": { + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + }, + "exclude_users_service_account": { + Type: schema.TypeBool, + Optional: true, + }, + "filter_group": { + Type: schema.TypeString, + Optional: true, + }, + "user_delete_action": { + Type: schema.TypeString, + Optional: true, + Default: api.OUTGOINGSYNCDELETEACTION_DELETE, + Description: helpers.EnumToDescription(api.AllowedOutgoingSyncDeleteActionEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedOutgoingSyncDeleteActionEnumValues), + }, + "group_delete_action": { + Type: schema.TypeString, + Optional: true, + Default: api.OUTGOINGSYNCDELETEACTION_DELETE, + Description: helpers.EnumToDescription([]api.OutgoingSyncDeleteAction{ + api.OUTGOINGSYNCDELETEACTION_DELETE, + api.OUTGOINGSYNCDELETEACTION_DO_NOTHING, + }), + ValidateDiagFunc: helpers.StringInEnum([]api.OutgoingSyncDeleteAction{ + api.OUTGOINGSYNCDELETEACTION_DELETE, + api.OUTGOINGSYNCDELETEACTION_DO_NOTHING, + }), }, - Optional: true, - }, - "exclude_users_service_account": { - Type: schema.TypeBool, - Optional: true, - }, - "filter_group": { - Type: schema.TypeString, - Optional: true, - }, - "user_delete_action": { - Type: schema.TypeString, - Optional: true, - Default: api.OUTGOINGSYNCDELETEACTION_DELETE, - Description: helpers.EnumToDescription(api.AllowedOutgoingSyncDeleteActionEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedOutgoingSyncDeleteActionEnumValues), - }, - "group_delete_action": { - Type: schema.TypeString, - Optional: true, - Default: api.OUTGOINGSYNCDELETEACTION_DELETE, - Description: helpers.EnumToDescription([]api.OutgoingSyncDeleteAction{ - api.OUTGOINGSYNCDELETEACTION_DELETE, - api.OUTGOINGSYNCDELETEACTION_DO_NOTHING, - }), - ValidateDiagFunc: helpers.StringInEnum([]api.OutgoingSyncDeleteAction{ - api.OUTGOINGSYNCDELETEACTION_DELETE, - api.OUTGOINGSYNCDELETEACTION_DO_NOTHING, - }), }, - }, + ), } } diff --git a/pkg/provider/resource_provider_ldap.go b/pkg/provider/resource_provider_ldap.go index 179208eb..6f8c967c 100644 --- a/pkg/provider/resource_provider_ldap.go +++ b/pkg/provider/resource_provider_ldap.go @@ -20,57 +20,60 @@ func resourceProviderLDAP() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_PROVIDERS_LDAP_LDAPPROVIDER, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "bind_flow": { + Type: schema.TypeString, + Required: true, + }, + "unbind_flow": { + Type: schema.TypeString, + Required: true, + }, + "base_dn": { + Type: schema.TypeString, + Required: true, + }, + "certificate": { + Type: schema.TypeString, + Optional: true, + }, + "tls_server_name": { + Type: schema.TypeString, + Optional: true, + }, + "uid_start_number": { + Type: schema.TypeInt, + Optional: true, + Default: 2000, + }, + "gid_start_number": { + Type: schema.TypeInt, + Optional: true, + Default: 4000, + }, + "search_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.LDAPAPIACCESSMODE_DIRECT, + }, + "bind_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.LDAPAPIACCESSMODE_DIRECT, + }, + "mfa_support": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, }, - "bind_flow": { - Type: schema.TypeString, - Required: true, - }, - "unbind_flow": { - Type: schema.TypeString, - Required: true, - }, - "base_dn": { - Type: schema.TypeString, - Required: true, - }, - "certificate": { - Type: schema.TypeString, - Optional: true, - }, - "tls_server_name": { - Type: schema.TypeString, - Optional: true, - }, - "uid_start_number": { - Type: schema.TypeInt, - Optional: true, - Default: 2000, - }, - "gid_start_number": { - Type: schema.TypeInt, - Optional: true, - Default: 4000, - }, - "search_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.LDAPAPIACCESSMODE_DIRECT, - }, - "bind_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.LDAPAPIACCESSMODE_DIRECT, - }, - "mfa_support": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - }, + ), } } diff --git a/pkg/provider/resource_provider_microsoft_entra.go b/pkg/provider/resource_provider_microsoft_entra.go index 8e82c50f..21b8b03d 100644 --- a/pkg/provider/resource_provider_microsoft_entra.go +++ b/pkg/provider/resource_provider_microsoft_entra.go @@ -20,78 +20,81 @@ func resourceProviderMicrosoftEntra() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "dry_run": { - Type: schema.TypeBool, - Default: false, - Optional: true, - }, - "client_id": { - Type: schema.TypeString, - Required: true, - }, - "client_secret": { - Type: schema.TypeString, - Required: true, - Sensitive: true, - }, - "tenant_id": { - Type: schema.TypeString, - Required: true, - }, - "property_mappings": { - Type: schema.TypeList, - Elem: &schema.Schema{ - Type: schema.TypeString, + Schema: helpers.ModelSchema( + api.MODELENUM_PROVIDERS_MICROSOFT_ENTRA_MICROSOFTENTRAPROVIDER, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, }, - Optional: true, - }, - "property_mappings_group": { - Type: schema.TypeList, - Elem: &schema.Schema{ - Type: schema.TypeString, + "dry_run": { + Type: schema.TypeBool, + Default: false, + Optional: true, + }, + "client_id": { + Type: schema.TypeString, + Required: true, + }, + "client_secret": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + }, + "tenant_id": { + Type: schema.TypeString, + Required: true, + }, + "property_mappings": { + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + }, + "property_mappings_group": { + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + }, + "exclude_users_service_account": { + Type: schema.TypeBool, + Optional: true, + }, + "filter_group": { + Type: schema.TypeString, + Optional: true, + }, + "user_delete_action": { + Type: schema.TypeString, + Optional: true, + Default: api.OUTGOINGSYNCDELETEACTION_DELETE, + Description: helpers.EnumToDescription([]api.OutgoingSyncDeleteAction{ + api.OUTGOINGSYNCDELETEACTION_DELETE, + api.OUTGOINGSYNCDELETEACTION_DO_NOTHING, + }), + ValidateDiagFunc: helpers.StringInEnum([]api.OutgoingSyncDeleteAction{ + api.OUTGOINGSYNCDELETEACTION_DELETE, + api.OUTGOINGSYNCDELETEACTION_DO_NOTHING, + }), + }, + "group_delete_action": { + Type: schema.TypeString, + Optional: true, + Default: api.OUTGOINGSYNCDELETEACTION_DELETE, + Description: helpers.EnumToDescription([]api.OutgoingSyncDeleteAction{ + api.OUTGOINGSYNCDELETEACTION_DELETE, + api.OUTGOINGSYNCDELETEACTION_DO_NOTHING, + }), + ValidateDiagFunc: helpers.StringInEnum([]api.OutgoingSyncDeleteAction{ + api.OUTGOINGSYNCDELETEACTION_DELETE, + api.OUTGOINGSYNCDELETEACTION_DO_NOTHING, + }), }, - Optional: true, - }, - "exclude_users_service_account": { - Type: schema.TypeBool, - Optional: true, - }, - "filter_group": { - Type: schema.TypeString, - Optional: true, - }, - "user_delete_action": { - Type: schema.TypeString, - Optional: true, - Default: api.OUTGOINGSYNCDELETEACTION_DELETE, - Description: helpers.EnumToDescription([]api.OutgoingSyncDeleteAction{ - api.OUTGOINGSYNCDELETEACTION_DELETE, - api.OUTGOINGSYNCDELETEACTION_DO_NOTHING, - }), - ValidateDiagFunc: helpers.StringInEnum([]api.OutgoingSyncDeleteAction{ - api.OUTGOINGSYNCDELETEACTION_DELETE, - api.OUTGOINGSYNCDELETEACTION_DO_NOTHING, - }), - }, - "group_delete_action": { - Type: schema.TypeString, - Optional: true, - Default: api.OUTGOINGSYNCDELETEACTION_DELETE, - Description: helpers.EnumToDescription([]api.OutgoingSyncDeleteAction{ - api.OUTGOINGSYNCDELETEACTION_DELETE, - api.OUTGOINGSYNCDELETEACTION_DO_NOTHING, - }), - ValidateDiagFunc: helpers.StringInEnum([]api.OutgoingSyncDeleteAction{ - api.OUTGOINGSYNCDELETEACTION_DELETE, - api.OUTGOINGSYNCDELETEACTION_DO_NOTHING, - }), }, - }, + ), } } diff --git a/pkg/provider/resource_provider_oauth2.go b/pkg/provider/resource_provider_oauth2.go index c75c433e..d0f891cd 100644 --- a/pkg/provider/resource_provider_oauth2.go +++ b/pkg/provider/resource_provider_oauth2.go @@ -20,145 +20,148 @@ func resourceProviderOAuth2() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "authentication_flow": { - Type: schema.TypeString, - Optional: true, - }, - "authorization_flow": { - Type: schema.TypeString, - Required: true, - }, - "invalidation_flow": { - Type: schema.TypeString, - Required: true, - }, - "property_mappings": { - Type: schema.TypeList, - Elem: &schema.Schema{ - Type: schema.TypeString, + Schema: helpers.ModelSchema( + api.MODELENUM_PROVIDERS_OAUTH2_OAUTH2PROVIDER, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, }, - Optional: true, - }, - "client_type": { - Type: schema.TypeString, - Optional: true, - Default: api.CLIENTTYPEENUM_CONFIDENTIAL, - Description: helpers.EnumToDescription(api.AllowedClientTypeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedClientTypeEnumEnumValues), - }, - "client_id": { - Type: schema.TypeString, - Required: true, - }, - "client_secret": { - Type: schema.TypeString, - Optional: true, - Sensitive: true, - Computed: true, - }, - "access_code_validity": { - Type: schema.TypeString, - Optional: true, - Default: "minutes=1", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, - "access_token_validity": { - Type: schema.TypeString, - Optional: true, - Default: "minutes=10", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, - "refresh_token_validity": { - Type: schema.TypeString, - Optional: true, - Default: "days=30", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, - "refresh_token_threshold": { - Type: schema.TypeString, - Optional: true, - Default: "seconds=0", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, - "include_claims_in_id_token": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "signing_key": { - Type: schema.TypeString, - Optional: true, - }, - "encryption_key": { - Type: schema.TypeString, - Optional: true, - }, - "allowed_redirect_uris": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeMap, + "authentication_flow": { + Type: schema.TypeString, + Optional: true, }, - }, - "logout_method": { - Type: schema.TypeString, - Default: api.OAUTH2PROVIDERLOGOUTMETHODENUM_BACKCHANNEL, - Optional: true, - Description: helpers.EnumToDescription(api.AllowedOAuth2ProviderLogoutMethodEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedOAuth2ProviderLogoutMethodEnumEnumValues), - }, - "logout_uri": { - Type: schema.TypeString, - Optional: true, - }, - "sub_mode": { - Type: schema.TypeString, - Default: api.SUBMODEENUM_HASHED_USER_ID, - Optional: true, - Description: helpers.EnumToDescription(api.AllowedSubModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedSubModeEnumEnumValues), - }, - "issuer_mode": { - Type: schema.TypeString, - Default: api.ISSUERMODEENUM_PER_PROVIDER, - Optional: true, - Description: helpers.EnumToDescription(api.AllowedIssuerModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedIssuerModeEnumEnumValues), - }, - "jwks_sources": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "authorization_flow": { + Type: schema.TypeString, + Required: true, }, - Description: "Deprecated. Use `jwt_federation_sources` instead.", - }, - "jwt_federation_sources": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "invalidation_flow": { + Type: schema.TypeString, + Required: true, }, - Description: "JWTs issued by keys configured in any of the selected sources can be used to authenticate on behalf of this provider.", - }, - "jwt_federation_providers": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeInt, + "property_mappings": { + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + }, + "client_type": { + Type: schema.TypeString, + Optional: true, + Default: api.CLIENTTYPEENUM_CONFIDENTIAL, + Description: helpers.EnumToDescription(api.AllowedClientTypeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedClientTypeEnumEnumValues), + }, + "client_id": { + Type: schema.TypeString, + Required: true, + }, + "client_secret": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + Computed: true, + }, + "access_code_validity": { + Type: schema.TypeString, + Optional: true, + Default: "minutes=1", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, + "access_token_validity": { + Type: schema.TypeString, + Optional: true, + Default: "minutes=10", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, + "refresh_token_validity": { + Type: schema.TypeString, + Optional: true, + Default: "days=30", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, + "refresh_token_threshold": { + Type: schema.TypeString, + Optional: true, + Default: "seconds=0", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, + "include_claims_in_id_token": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "signing_key": { + Type: schema.TypeString, + Optional: true, + }, + "encryption_key": { + Type: schema.TypeString, + Optional: true, + }, + "allowed_redirect_uris": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeMap, + }, + }, + "logout_method": { + Type: schema.TypeString, + Default: api.OAUTH2PROVIDERLOGOUTMETHODENUM_BACKCHANNEL, + Optional: true, + Description: helpers.EnumToDescription(api.AllowedOAuth2ProviderLogoutMethodEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedOAuth2ProviderLogoutMethodEnumEnumValues), + }, + "logout_uri": { + Type: schema.TypeString, + Optional: true, + }, + "sub_mode": { + Type: schema.TypeString, + Default: api.SUBMODEENUM_HASHED_USER_ID, + Optional: true, + Description: helpers.EnumToDescription(api.AllowedSubModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedSubModeEnumEnumValues), + }, + "issuer_mode": { + Type: schema.TypeString, + Default: api.ISSUERMODEENUM_PER_PROVIDER, + Optional: true, + Description: helpers.EnumToDescription(api.AllowedIssuerModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedIssuerModeEnumEnumValues), + }, + "jwks_sources": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Description: "Deprecated. Use `jwt_federation_sources` instead.", + }, + "jwt_federation_sources": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Description: "JWTs issued by keys configured in any of the selected sources can be used to authenticate on behalf of this provider.", + }, + "jwt_federation_providers": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + Description: "JWTs issued by any of the configured providers can be used to authenticate on behalf of this provider.", }, - Description: "JWTs issued by any of the configured providers can be used to authenticate on behalf of this provider.", }, - }, + ), } } diff --git a/pkg/provider/resource_provider_proxy.go b/pkg/provider/resource_provider_proxy.go index 225fdbb2..ccc15616 100644 --- a/pkg/provider/resource_provider_proxy.go +++ b/pkg/provider/resource_provider_proxy.go @@ -20,121 +20,124 @@ func resourceProviderProxy() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "client_id": { - Type: schema.TypeString, - Computed: true, - }, + Schema: helpers.ModelSchema( + api.MODELENUM_PROVIDERS_PROXY_PROXYPROVIDER, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "client_id": { + Type: schema.TypeString, + Computed: true, + }, - "authentication_flow": { - Type: schema.TypeString, - Optional: true, - }, - "authorization_flow": { - Type: schema.TypeString, - Required: true, - }, - "invalidation_flow": { - Type: schema.TypeString, - Required: true, - }, - "internal_host": { - Type: schema.TypeString, - Optional: true, - }, - "external_host": { - Type: schema.TypeString, - Required: true, - }, - "internal_host_ssl_validation": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "property_mappings": { - Type: schema.TypeList, - Elem: &schema.Schema{ - Type: schema.TypeString, + "authentication_flow": { + Type: schema.TypeString, + Optional: true, }, - Optional: true, - }, - "skip_path_regex": { - Type: schema.TypeString, - Optional: true, - DiffSuppressFunc: helpers.DiffSuppressExpression, - }, - "intercept_header_auth": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "basic_auth_enabled": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "basic_auth_username_attribute": { - Type: schema.TypeString, - Optional: true, - }, - "basic_auth_password_attribute": { - Type: schema.TypeString, - Optional: true, - }, - "mode": { - Type: schema.TypeString, - Optional: true, - Default: api.PROXYMODE_PROXY, - ValidateDiagFunc: helpers.StringInEnum(api.AllowedProxyModeEnumValues), - Description: helpers.EnumToDescription(api.AllowedProxyModeEnumValues), - }, - "cookie_domain": { - Type: schema.TypeString, - Optional: true, - }, - "access_token_validity": { - Type: schema.TypeString, - Optional: true, - Default: "minutes=10", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, - "refresh_token_validity": { - Type: schema.TypeString, - Optional: true, - Default: "days=30", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, - "jwks_sources": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "authorization_flow": { + Type: schema.TypeString, + Required: true, }, - Description: "Deprecated. Use `jwt_federation_sources` instead.", - }, - "jwt_federation_sources": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "invalidation_flow": { + Type: schema.TypeString, + Required: true, }, - Description: "JWTs issued by keys configured in any of the selected sources can be used to authenticate on behalf of this provider.", - }, - "jwt_federation_providers": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeInt, + "internal_host": { + Type: schema.TypeString, + Optional: true, + }, + "external_host": { + Type: schema.TypeString, + Required: true, + }, + "internal_host_ssl_validation": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "property_mappings": { + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + }, + "skip_path_regex": { + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: helpers.DiffSuppressExpression, + }, + "intercept_header_auth": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "basic_auth_enabled": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "basic_auth_username_attribute": { + Type: schema.TypeString, + Optional: true, + }, + "basic_auth_password_attribute": { + Type: schema.TypeString, + Optional: true, + }, + "mode": { + Type: schema.TypeString, + Optional: true, + Default: api.PROXYMODE_PROXY, + ValidateDiagFunc: helpers.StringInEnum(api.AllowedProxyModeEnumValues), + Description: helpers.EnumToDescription(api.AllowedProxyModeEnumValues), + }, + "cookie_domain": { + Type: schema.TypeString, + Optional: true, + }, + "access_token_validity": { + Type: schema.TypeString, + Optional: true, + Default: "minutes=10", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, + "refresh_token_validity": { + Type: schema.TypeString, + Optional: true, + Default: "days=30", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, + "jwks_sources": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Description: "Deprecated. Use `jwt_federation_sources` instead.", + }, + "jwt_federation_sources": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Description: "JWTs issued by keys configured in any of the selected sources can be used to authenticate on behalf of this provider.", + }, + "jwt_federation_providers": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + Description: "JWTs issued by any of the configured providers can be used to authenticate on behalf of this provider.", }, - Description: "JWTs issued by any of the configured providers can be used to authenticate on behalf of this provider.", }, - }, + ), } } diff --git a/pkg/provider/resource_provider_rac.go b/pkg/provider/resource_provider_rac.go index 1da4dad5..4a2978a4 100644 --- a/pkg/provider/resource_provider_rac.go +++ b/pkg/provider/resource_provider_rac.go @@ -20,43 +20,46 @@ func resourceProviderRAC() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, + Schema: helpers.ModelSchema( + api.MODELENUM_PROVIDERS_RAC_RACPROVIDER, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, - "authentication_flow": { - Type: schema.TypeString, - Optional: true, - }, - "authorization_flow": { - Type: schema.TypeString, - Required: true, - }, - "property_mappings": { - Type: schema.TypeList, - Elem: &schema.Schema{ - Type: schema.TypeString, + "authentication_flow": { + Type: schema.TypeString, + Optional: true, + }, + "authorization_flow": { + Type: schema.TypeString, + Required: true, + }, + "property_mappings": { + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + }, + "settings": { + Type: schema.TypeString, + Optional: true, + Default: "{}", + Description: helpers.JSONDescription, + DiffSuppressFunc: helpers.DiffSuppressJSON, + ValidateDiagFunc: helpers.ValidateJSON, + }, + "connection_expiry": { + Type: schema.TypeString, + Optional: true, + Default: "seconds=0", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, }, - Optional: true, - }, - "settings": { - Type: schema.TypeString, - Optional: true, - Default: "{}", - Description: helpers.JSONDescription, - DiffSuppressFunc: helpers.DiffSuppressJSON, - ValidateDiagFunc: helpers.ValidateJSON, - }, - "connection_expiry": { - Type: schema.TypeString, - Optional: true, - Default: "seconds=0", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, }, - }, + ), } } diff --git a/pkg/provider/resource_provider_radius.go b/pkg/provider/resource_provider_radius.go index 6c429373..9ae80bcf 100644 --- a/pkg/provider/resource_provider_radius.go +++ b/pkg/provider/resource_provider_radius.go @@ -20,46 +20,49 @@ func resourceProviderRadius() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "authorization_flow": { - Type: schema.TypeString, - Required: true, - }, - "invalidation_flow": { - Type: schema.TypeString, - Required: true, - }, - "property_mappings": { - Type: schema.TypeList, - Elem: &schema.Schema{ - Type: schema.TypeString, + Schema: helpers.ModelSchema( + api.MODELENUM_PROVIDERS_RADIUS_RADIUSPROVIDER, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "authorization_flow": { + Type: schema.TypeString, + Required: true, + }, + "invalidation_flow": { + Type: schema.TypeString, + Required: true, + }, + "property_mappings": { + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + }, + "client_networks": { + Type: schema.TypeString, + Optional: true, + Default: "0.0.0.0/0, ::/0", + }, + "shared_secret": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + }, + "mfa_support": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "certificate": { + Type: schema.TypeString, + Optional: true, }, - Optional: true, - }, - "client_networks": { - Type: schema.TypeString, - Optional: true, - Default: "0.0.0.0/0, ::/0", - }, - "shared_secret": { - Type: schema.TypeString, - Required: true, - Sensitive: true, - }, - "mfa_support": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "certificate": { - Type: schema.TypeString, - Optional: true, }, - }, + ), } } diff --git a/pkg/provider/resource_provider_saml.go b/pkg/provider/resource_provider_saml.go index 9d77f534..3304003b 100644 --- a/pkg/provider/resource_provider_saml.go +++ b/pkg/provider/resource_provider_saml.go @@ -20,172 +20,175 @@ func resourceProviderSAML() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, + Schema: helpers.ModelSchema( + api.MODELENUM_PROVIDERS_SAML_SAMLPROVIDER, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, - "url_sso_init": { - Type: schema.TypeString, - Computed: true, - Optional: true, - }, - "url_sso_post": { - Type: schema.TypeString, - Computed: true, - Optional: true, - }, - "url_sso_redirect": { - Type: schema.TypeString, - Computed: true, - Optional: true, - }, - "url_slo_post": { - Type: schema.TypeString, - Computed: true, - Optional: true, - }, - "url_slo_redirect": { - Type: schema.TypeString, - Computed: true, - Optional: true, - }, + "url_sso_init": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "url_sso_post": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "url_sso_redirect": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "url_slo_post": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "url_slo_redirect": { + Type: schema.TypeString, + Computed: true, + Optional: true, + }, - "authentication_flow": { - Type: schema.TypeString, - Optional: true, - }, - "authorization_flow": { - Type: schema.TypeString, - Required: true, - }, - "invalidation_flow": { - Type: schema.TypeString, - Required: true, - }, - "property_mappings": { - Type: schema.TypeList, - Elem: &schema.Schema{ - Type: schema.TypeString, + "authentication_flow": { + Type: schema.TypeString, + Optional: true, + }, + "authorization_flow": { + Type: schema.TypeString, + Required: true, + }, + "invalidation_flow": { + Type: schema.TypeString, + Required: true, + }, + "property_mappings": { + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + }, + "acs_url": { + Type: schema.TypeString, + Required: true, + }, + "audience": { + Type: schema.TypeString, + Optional: true, + Default: "", + }, + "issuer": { + Type: schema.TypeString, + Optional: true, + Default: "authentik", + }, + "assertion_valid_not_before": { + Type: schema.TypeString, + Optional: true, + Default: "minutes=-5", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, + "assertion_valid_not_on_or_after": { + Type: schema.TypeString, + Optional: true, + Default: "minutes=5", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, + "session_valid_not_on_or_after": { + Type: schema.TypeString, + Optional: true, + Default: "minutes=86400", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, + "name_id_mapping": { + Type: schema.TypeString, + Optional: true, + }, + "authn_context_class_ref_mapping": { + Type: schema.TypeString, + Optional: true, + }, + "digest_algorithm": { + Type: schema.TypeString, + Optional: true, + Default: api.DIGESTALGORITHMENUM__2001_04_XMLENCSHA256, + Description: helpers.EnumToDescription(api.AllowedDigestAlgorithmEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedDigestAlgorithmEnumEnumValues), + }, + "signature_algorithm": { + Type: schema.TypeString, + Optional: true, + Default: api.SIGNATUREALGORITHMENUM__2001_04_XMLDSIG_MORERSA_SHA256, + Description: helpers.EnumToDescription(api.AllowedSignatureAlgorithmEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedSignatureAlgorithmEnumEnumValues), + }, + "signing_kp": { + Type: schema.TypeString, + Optional: true, + }, + "sign_assertion": { + Type: schema.TypeBool, + Default: true, + Optional: true, + }, + "sign_response": { + Type: schema.TypeBool, + Default: false, + Optional: true, + }, + "verification_kp": { + Type: schema.TypeString, + Optional: true, + }, + "encryption_kp": { + Type: schema.TypeString, + Optional: true, + }, + "sp_binding": { + Type: schema.TypeString, + Optional: true, + Default: api.SAMLBINDINGSENUM_REDIRECT, + Description: helpers.EnumToDescription(api.AllowedSAMLBindingsEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedSAMLBindingsEnumEnumValues), + }, + "default_relay_state": { + Type: schema.TypeString, + Optional: true, + Default: "", + }, + "sls_url": { + Type: schema.TypeString, + Optional: true, + }, + "sign_logout_request": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "sls_binding": { + Type: schema.TypeString, + Optional: true, + Default: api.SAMLBINDINGSENUM_REDIRECT, + Description: helpers.EnumToDescription(api.AllowedSAMLBindingsEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedSAMLBindingsEnumEnumValues), + }, + "logout_method": { + Type: schema.TypeString, + Optional: true, + Default: api.SAMLPROVIDERLOGOUTMETHODENUM_FRONTCHANNEL_IFRAME, + Description: helpers.EnumToDescription(api.AllowedSAMLProviderLogoutMethodEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedSAMLProviderLogoutMethodEnumEnumValues), }, - Optional: true, - }, - "acs_url": { - Type: schema.TypeString, - Required: true, - }, - "audience": { - Type: schema.TypeString, - Optional: true, - Default: "", - }, - "issuer": { - Type: schema.TypeString, - Optional: true, - Default: "authentik", - }, - "assertion_valid_not_before": { - Type: schema.TypeString, - Optional: true, - Default: "minutes=-5", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, - "assertion_valid_not_on_or_after": { - Type: schema.TypeString, - Optional: true, - Default: "minutes=5", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, - "session_valid_not_on_or_after": { - Type: schema.TypeString, - Optional: true, - Default: "minutes=86400", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, - "name_id_mapping": { - Type: schema.TypeString, - Optional: true, - }, - "authn_context_class_ref_mapping": { - Type: schema.TypeString, - Optional: true, - }, - "digest_algorithm": { - Type: schema.TypeString, - Optional: true, - Default: api.DIGESTALGORITHMENUM__2001_04_XMLENCSHA256, - Description: helpers.EnumToDescription(api.AllowedDigestAlgorithmEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedDigestAlgorithmEnumEnumValues), - }, - "signature_algorithm": { - Type: schema.TypeString, - Optional: true, - Default: api.SIGNATUREALGORITHMENUM__2001_04_XMLDSIG_MORERSA_SHA256, - Description: helpers.EnumToDescription(api.AllowedSignatureAlgorithmEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedSignatureAlgorithmEnumEnumValues), - }, - "signing_kp": { - Type: schema.TypeString, - Optional: true, - }, - "sign_assertion": { - Type: schema.TypeBool, - Default: true, - Optional: true, - }, - "sign_response": { - Type: schema.TypeBool, - Default: false, - Optional: true, - }, - "verification_kp": { - Type: schema.TypeString, - Optional: true, - }, - "encryption_kp": { - Type: schema.TypeString, - Optional: true, - }, - "sp_binding": { - Type: schema.TypeString, - Optional: true, - Default: api.SAMLBINDINGSENUM_REDIRECT, - Description: helpers.EnumToDescription(api.AllowedSAMLBindingsEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedSAMLBindingsEnumEnumValues), - }, - "default_relay_state": { - Type: schema.TypeString, - Optional: true, - Default: "", - }, - "sls_url": { - Type: schema.TypeString, - Optional: true, - }, - "sign_logout_request": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "sls_binding": { - Type: schema.TypeString, - Optional: true, - Default: api.SAMLBINDINGSENUM_REDIRECT, - Description: helpers.EnumToDescription(api.AllowedSAMLBindingsEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedSAMLBindingsEnumEnumValues), - }, - "logout_method": { - Type: schema.TypeString, - Optional: true, - Default: api.SAMLPROVIDERLOGOUTMETHODENUM_FRONTCHANNEL_IFRAME, - Description: helpers.EnumToDescription(api.AllowedSAMLProviderLogoutMethodEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedSAMLProviderLogoutMethodEnumEnumValues), }, - }, + ), } } diff --git a/pkg/provider/resource_provider_scim.go b/pkg/provider/resource_provider_scim.go index 6f70d870..f20f14d7 100644 --- a/pkg/provider/resource_provider_scim.go +++ b/pkg/provider/resource_provider_scim.go @@ -20,75 +20,78 @@ func resourceProviderSCIM() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "dry_run": { - Type: schema.TypeBool, - Default: false, - Optional: true, - }, - "url": { - Type: schema.TypeString, - Required: true, - }, - "token": { - Type: schema.TypeString, - Sensitive: true, - Optional: true, - }, - "auth_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.SCIMAUTHENTICATIONMODEENUM_TOKEN, - Description: helpers.EnumToDescription(api.AllowedSCIMAuthenticationModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedSCIMAuthenticationModeEnumEnumValues), - }, - "auth_oauth": { - Type: schema.TypeString, - Optional: true, - Description: "Slug of an OAuth source used for authentication", - }, - "auth_oauth_params": { - Type: schema.TypeString, - Optional: true, - Default: "{}", - Description: helpers.JSONDescription, - DiffSuppressFunc: helpers.DiffSuppressJSON, - ValidateDiagFunc: helpers.ValidateJSON, - }, - "compatibility_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.COMPATIBILITYMODEENUM_DEFAULT, - Description: helpers.EnumToDescription(api.AllowedCompatibilityModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedCompatibilityModeEnumEnumValues), - }, - "property_mappings": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + Schema: helpers.ModelSchema( + api.MODELENUM_PROVIDERS_SCIM_SCIMPROVIDER, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, }, - }, - "property_mappings_group": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "dry_run": { + Type: schema.TypeBool, + Default: false, + Optional: true, + }, + "url": { + Type: schema.TypeString, + Required: true, + }, + "token": { + Type: schema.TypeString, + Sensitive: true, + Optional: true, + }, + "auth_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.SCIMAUTHENTICATIONMODEENUM_TOKEN, + Description: helpers.EnumToDescription(api.AllowedSCIMAuthenticationModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedSCIMAuthenticationModeEnumEnumValues), + }, + "auth_oauth": { + Type: schema.TypeString, + Optional: true, + Description: "Slug of an OAuth source used for authentication", + }, + "auth_oauth_params": { + Type: schema.TypeString, + Optional: true, + Default: "{}", + Description: helpers.JSONDescription, + DiffSuppressFunc: helpers.DiffSuppressJSON, + ValidateDiagFunc: helpers.ValidateJSON, + }, + "compatibility_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.COMPATIBILITYMODEENUM_DEFAULT, + Description: helpers.EnumToDescription(api.AllowedCompatibilityModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedCompatibilityModeEnumEnumValues), + }, + "property_mappings": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "property_mappings_group": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "exclude_users_service_account": { + Type: schema.TypeBool, + Optional: true, + }, + "filter_group": { + Type: schema.TypeString, + Optional: true, }, }, - "exclude_users_service_account": { - Type: schema.TypeBool, - Optional: true, - }, - "filter_group": { - Type: schema.TypeString, - Optional: true, - }, - }, + ), } } diff --git a/pkg/provider/resource_provider_ssf.go b/pkg/provider/resource_provider_ssf.go index 8ef91095..9a1f1eca 100644 --- a/pkg/provider/resource_provider_ssf.go +++ b/pkg/provider/resource_provider_ssf.go @@ -20,31 +20,34 @@ func resourceProviderSSF() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "signing_key": { - Type: schema.TypeString, - Optional: true, - }, - "jwt_federation_providers": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeInt, + Schema: helpers.ModelSchema( + api.MODELENUM_PROVIDERS_SSF_SSFPROVIDER, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "signing_key": { + Type: schema.TypeString, + Optional: true, + }, + "jwt_federation_providers": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + Description: "JWTs issued by any of the configured providers can be used to authenticate on behalf of this provider.", + }, + "event_retention": { + Type: schema.TypeString, + Optional: true, + Default: "days=30", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, }, - Description: "JWTs issued by any of the configured providers can be used to authenticate on behalf of this provider.", - }, - "event_retention": { - Type: schema.TypeString, - Optional: true, - Default: "days=30", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, }, - }, + ), } } diff --git a/pkg/provider/resource_rac_endpoint.go b/pkg/provider/resource_rac_endpoint.go index 65710761..7bf24411 100644 --- a/pkg/provider/resource_rac_endpoint.go +++ b/pkg/provider/resource_rac_endpoint.go @@ -19,48 +19,51 @@ func resourceRACEndpoint() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "protocol_provider": { - Type: schema.TypeInt, - Required: true, - }, + Schema: helpers.ModelSchema( + api.MODELENUM_PROVIDERS_RAC_ENDPOINT, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "protocol_provider": { + Type: schema.TypeInt, + Required: true, + }, - "protocol": { - Type: schema.TypeString, - Required: true, - ValidateDiagFunc: helpers.StringInEnum(api.AllowedProtocolEnumEnumValues), - Description: helpers.EnumToDescription(api.AllowedProtocolEnumEnumValues), - }, - "host": { - Type: schema.TypeString, - Required: true, - }, - "maximum_connections": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - }, + "protocol": { + Type: schema.TypeString, + Required: true, + ValidateDiagFunc: helpers.StringInEnum(api.AllowedProtocolEnumEnumValues), + Description: helpers.EnumToDescription(api.AllowedProtocolEnumEnumValues), + }, + "host": { + Type: schema.TypeString, + Required: true, + }, + "maximum_connections": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + }, - "property_mappings": { - Type: schema.TypeList, - Elem: &schema.Schema{ - Type: schema.TypeString, + "property_mappings": { + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + }, + "settings": { + Type: schema.TypeString, + Optional: true, + Default: "{}", + Description: helpers.JSONDescription, + DiffSuppressFunc: helpers.DiffSuppressJSON, + ValidateDiagFunc: helpers.ValidateJSON, }, - Optional: true, - }, - "settings": { - Type: schema.TypeString, - Optional: true, - Default: "{}", - Description: helpers.JSONDescription, - DiffSuppressFunc: helpers.DiffSuppressJSON, - ValidateDiagFunc: helpers.ValidateJSON, }, - }, + ), } } diff --git a/pkg/provider/resource_rbac_initial_permissions.go b/pkg/provider/resource_rbac_initial_permissions.go index 51ae6f36..f20edbe1 100644 --- a/pkg/provider/resource_rbac_initial_permissions.go +++ b/pkg/provider/resource_rbac_initial_permissions.go @@ -20,29 +20,32 @@ func resourceRBACInitialPermissions() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "role": { - Type: schema.TypeString, - Required: true, - }, - "mode": { - Type: schema.TypeString, - Required: true, - Description: helpers.EnumToDescription(api.AllowedInitialPermissionsModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedInitialPermissionsModeEnumEnumValues), - }, - "permissions": { - Type: schema.TypeList, - Required: true, - Elem: &schema.Schema{ - Type: schema.TypeInt, + Schema: helpers.ModelSchema( + api.MODELENUM_RBAC_INITIALPERMISSIONS, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "role": { + Type: schema.TypeString, + Required: true, + }, + "mode": { + Type: schema.TypeString, + Required: true, + Description: helpers.EnumToDescription(api.AllowedInitialPermissionsModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedInitialPermissionsModeEnumEnumValues), + }, + "permissions": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, }, }, - }, + ), } } diff --git a/pkg/provider/resource_rbac_role.go b/pkg/provider/resource_rbac_role.go index 3648d818..c1944f0e 100644 --- a/pkg/provider/resource_rbac_role.go +++ b/pkg/provider/resource_rbac_role.go @@ -19,12 +19,15 @@ func resourceRBACRole() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_RBAC_ROLE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, }, - }, + ), } } diff --git a/pkg/provider/resource_source_kerberos.go b/pkg/provider/resource_source_kerberos.go index d6334965..48156d51 100644 --- a/pkg/provider/resource_source_kerberos.go +++ b/pkg/provider/resource_source_kerberos.go @@ -19,127 +19,130 @@ func resourceSourceKerberos() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "uuid": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "slug": { - Type: schema.TypeString, - Required: true, - }, - "user_path_template": { - Type: schema.TypeString, - Default: "goauthentik.io/sources/%(slug)s", - Optional: true, - }, - "authentication_flow": { - Type: schema.TypeString, - Optional: true, - }, - "enrollment_flow": { - Type: schema.TypeString, - Optional: true, - }, - "enabled": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "policy_engine_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.POLICYENGINEMODE_ANY, - Description: helpers.EnumToDescription(api.AllowedPolicyEngineModeEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedPolicyEngineModeEnumValues), - }, - "user_matching_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.USERMATCHINGMODEENUM_IDENTIFIER, - Description: helpers.EnumToDescription(api.AllowedUserMatchingModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserMatchingModeEnumEnumValues), - }, - "group_matching_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.GROUPMATCHINGMODEENUM_IDENTIFIER, - Description: helpers.EnumToDescription(api.AllowedGroupMatchingModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedGroupMatchingModeEnumEnumValues), - }, - - "realm": { - Description: "Kerberos realm", - Type: schema.TypeString, - Required: true, - }, - "krb5_conf": { - Description: "Custom krb5.conf to use. Uses the system one by default", - Type: schema.TypeString, - Optional: true, - }, - "sync_users": { - Description: "Sync users from Kerberos into authentik", - Type: schema.TypeBool, - Default: true, - Optional: true, - }, - "sync_users_password": { - Description: "When a user changes their password, sync it back to Kerberos", - Type: schema.TypeBool, - Default: true, - Optional: true, - }, - "sync_principal": { - Description: "Principal to authenticate to kadmin for sync.", - Type: schema.TypeString, - Optional: true, - }, - "sync_password": { - Description: "Password to authenticate to kadmin for sync", - Type: schema.TypeString, - Optional: true, - Sensitive: true, - }, - "sync_keytab": { - Description: "Keytab to authenticate to kadmin for sync. Must be base64-encoded or in the form TYPE:residual", - Type: schema.TypeString, - Optional: true, - Sensitive: true, - }, - "sync_ccache": { - Description: "Credentials cache to authenticate to kadmin for sync. Must be in the form TYPE:residual", - Type: schema.TypeString, - Optional: true, - }, - "spnego_server_name": { - Description: "Force the use of a specific server name for SPNEGO", - Type: schema.TypeString, - Optional: true, - }, - "spnego_keytab": { - Description: "SPNEGO keytab base64-encoded or path to keytab in the form FILE:path", - Type: schema.TypeString, - Optional: true, - Sensitive: true, - }, - "spnego_ccache": { - Description: "Credential cache to use for SPNEGO in form type:residual", - Type: schema.TypeString, - Optional: true, - }, - "password_login_update_internal_password": { - Description: "If enabled, the authentik-stored password will be updated upon login with the Kerberos password backend", - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - }, + Schema: helpers.ModelSchema( + api.MODELENUM_SOURCES_KERBEROS_KERBEROSSOURCE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "uuid": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "slug": { + Type: schema.TypeString, + Required: true, + }, + "user_path_template": { + Type: schema.TypeString, + Default: "goauthentik.io/sources/%(slug)s", + Optional: true, + }, + "authentication_flow": { + Type: schema.TypeString, + Optional: true, + }, + "enrollment_flow": { + Type: schema.TypeString, + Optional: true, + }, + "enabled": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "policy_engine_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.POLICYENGINEMODE_ANY, + Description: helpers.EnumToDescription(api.AllowedPolicyEngineModeEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedPolicyEngineModeEnumValues), + }, + "user_matching_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.USERMATCHINGMODEENUM_IDENTIFIER, + Description: helpers.EnumToDescription(api.AllowedUserMatchingModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserMatchingModeEnumEnumValues), + }, + "group_matching_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.GROUPMATCHINGMODEENUM_IDENTIFIER, + Description: helpers.EnumToDescription(api.AllowedGroupMatchingModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedGroupMatchingModeEnumEnumValues), + }, + + "realm": { + Description: "Kerberos realm", + Type: schema.TypeString, + Required: true, + }, + "krb5_conf": { + Description: "Custom krb5.conf to use. Uses the system one by default", + Type: schema.TypeString, + Optional: true, + }, + "sync_users": { + Description: "Sync users from Kerberos into authentik", + Type: schema.TypeBool, + Default: true, + Optional: true, + }, + "sync_users_password": { + Description: "When a user changes their password, sync it back to Kerberos", + Type: schema.TypeBool, + Default: true, + Optional: true, + }, + "sync_principal": { + Description: "Principal to authenticate to kadmin for sync.", + Type: schema.TypeString, + Optional: true, + }, + "sync_password": { + Description: "Password to authenticate to kadmin for sync", + Type: schema.TypeString, + Optional: true, + Sensitive: true, + }, + "sync_keytab": { + Description: "Keytab to authenticate to kadmin for sync. Must be base64-encoded or in the form TYPE:residual", + Type: schema.TypeString, + Optional: true, + Sensitive: true, + }, + "sync_ccache": { + Description: "Credentials cache to authenticate to kadmin for sync. Must be in the form TYPE:residual", + Type: schema.TypeString, + Optional: true, + }, + "spnego_server_name": { + Description: "Force the use of a specific server name for SPNEGO", + Type: schema.TypeString, + Optional: true, + }, + "spnego_keytab": { + Description: "SPNEGO keytab base64-encoded or path to keytab in the form FILE:path", + Type: schema.TypeString, + Optional: true, + Sensitive: true, + }, + "spnego_ccache": { + Description: "Credential cache to use for SPNEGO in form type:residual", + Type: schema.TypeString, + Optional: true, + }, + "password_login_update_internal_password": { + Description: "If enabled, the authentik-stored password will be updated upon login with the Kerberos password backend", + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + }, + ), } } diff --git a/pkg/provider/resource_source_ldap.go b/pkg/provider/resource_source_ldap.go index d61e19d9..dbb09b51 100644 --- a/pkg/provider/resource_source_ldap.go +++ b/pkg/provider/resource_source_ldap.go @@ -19,142 +19,145 @@ func resourceSourceLDAP() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "uuid": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "slug": { - Type: schema.TypeString, - Required: true, - }, - "user_path_template": { - Type: schema.TypeString, - Default: "goauthentik.io/sources/%(slug)s", - Optional: true, - }, - "enabled": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, + Schema: helpers.ModelSchema( + api.MODELENUM_SOURCES_LDAP_LDAPSOURCE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "uuid": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "slug": { + Type: schema.TypeString, + Required: true, + }, + "user_path_template": { + Type: schema.TypeString, + Default: "goauthentik.io/sources/%(slug)s", + Optional: true, + }, + "enabled": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, - "server_uri": { - Type: schema.TypeString, - Required: true, - }, - "bind_cn": { - Type: schema.TypeString, - Required: true, - }, - "bind_password": { - Type: schema.TypeString, - Required: true, - Sensitive: true, - }, - "start_tls": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "sni": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "base_dn": { - Type: schema.TypeString, - Required: true, - }, - "additional_user_dn": { - Type: schema.TypeString, - Optional: true, - Default: "", - }, - "additional_group_dn": { - Type: schema.TypeString, - Optional: true, - Default: "", - }, - "user_object_filter": { - Type: schema.TypeString, - Optional: true, - Default: "(objectClass=person)", - }, - "user_membership_attribute": { - Type: schema.TypeString, - Optional: true, - Default: "distinguishedName", - }, - "group_object_filter": { - Type: schema.TypeString, - Optional: true, - Default: "(objectClass=group)", - }, - "group_membership_field": { - Type: schema.TypeString, - Optional: true, - Default: "member", - }, - "object_uniqueness_field": { - Type: schema.TypeString, - Optional: true, - Default: "objectSid", - }, - "lookup_groups_from_user": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "sync_users": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "sync_users_password": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "sync_groups": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "sync_parent_group": { - Type: schema.TypeString, - Optional: true, - }, - "password_login_update_internal_password": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "delete_not_found_objects": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "property_mappings": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "server_uri": { + Type: schema.TypeString, + Required: true, }, - }, - "property_mappings_group": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "bind_cn": { + Type: schema.TypeString, + Required: true, + }, + "bind_password": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + }, + "start_tls": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "sni": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "base_dn": { + Type: schema.TypeString, + Required: true, + }, + "additional_user_dn": { + Type: schema.TypeString, + Optional: true, + Default: "", + }, + "additional_group_dn": { + Type: schema.TypeString, + Optional: true, + Default: "", + }, + "user_object_filter": { + Type: schema.TypeString, + Optional: true, + Default: "(objectClass=person)", + }, + "user_membership_attribute": { + Type: schema.TypeString, + Optional: true, + Default: "distinguishedName", + }, + "group_object_filter": { + Type: schema.TypeString, + Optional: true, + Default: "(objectClass=group)", + }, + "group_membership_field": { + Type: schema.TypeString, + Optional: true, + Default: "member", + }, + "object_uniqueness_field": { + Type: schema.TypeString, + Optional: true, + Default: "objectSid", + }, + "lookup_groups_from_user": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "sync_users": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "sync_users_password": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "sync_groups": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "sync_parent_group": { + Type: schema.TypeString, + Optional: true, + }, + "password_login_update_internal_password": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "delete_not_found_objects": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "property_mappings": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "property_mappings_group": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, }, - }, + ), } } diff --git a/pkg/provider/resource_source_oauth.go b/pkg/provider/resource_source_oauth.go index a9b35fb0..702c05a4 100644 --- a/pkg/provider/resource_source_oauth.go +++ b/pkg/provider/resource_source_oauth.go @@ -19,154 +19,157 @@ func resourceSourceOAuth() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "uuid": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "slug": { - Type: schema.TypeString, - Required: true, - }, - "user_path_template": { - Type: schema.TypeString, - Default: "goauthentik.io/sources/%(slug)s", - Optional: true, - }, - "authentication_flow": { - Type: schema.TypeString, - Optional: true, - }, - "enrollment_flow": { - Type: schema.TypeString, - Optional: true, - }, - "enabled": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "authorization_code_auth_method": { - Type: schema.TypeString, - Optional: true, - Default: api.AUTHORIZATIONCODEAUTHMETHODENUM_BASIC_AUTH, - Description: helpers.EnumToDescription(api.AllowedAuthorizationCodeAuthMethodEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedAuthorizationCodeAuthMethodEnumEnumValues), - }, - "policy_engine_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.POLICYENGINEMODE_ANY, - Description: helpers.EnumToDescription(api.AllowedPolicyEngineModeEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedPolicyEngineModeEnumValues), - }, - "user_matching_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.USERMATCHINGMODEENUM_IDENTIFIER, - Description: helpers.EnumToDescription(api.AllowedUserMatchingModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserMatchingModeEnumEnumValues), - }, - "group_matching_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.GROUPMATCHINGMODEENUM_IDENTIFIER, - Description: helpers.EnumToDescription(api.AllowedGroupMatchingModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedGroupMatchingModeEnumEnumValues), - }, + Schema: helpers.ModelSchema( + api.MODELENUM_SOURCES_OAUTH_OAUTHSOURCE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "uuid": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "slug": { + Type: schema.TypeString, + Required: true, + }, + "user_path_template": { + Type: schema.TypeString, + Default: "goauthentik.io/sources/%(slug)s", + Optional: true, + }, + "authentication_flow": { + Type: schema.TypeString, + Optional: true, + }, + "enrollment_flow": { + Type: schema.TypeString, + Optional: true, + }, + "enabled": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "authorization_code_auth_method": { + Type: schema.TypeString, + Optional: true, + Default: api.AUTHORIZATIONCODEAUTHMETHODENUM_BASIC_AUTH, + Description: helpers.EnumToDescription(api.AllowedAuthorizationCodeAuthMethodEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedAuthorizationCodeAuthMethodEnumEnumValues), + }, + "policy_engine_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.POLICYENGINEMODE_ANY, + Description: helpers.EnumToDescription(api.AllowedPolicyEngineModeEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedPolicyEngineModeEnumValues), + }, + "user_matching_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.USERMATCHINGMODEENUM_IDENTIFIER, + Description: helpers.EnumToDescription(api.AllowedUserMatchingModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserMatchingModeEnumEnumValues), + }, + "group_matching_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.GROUPMATCHINGMODEENUM_IDENTIFIER, + Description: helpers.EnumToDescription(api.AllowedGroupMatchingModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedGroupMatchingModeEnumEnumValues), + }, - "provider_type": { - Type: schema.TypeString, - Required: true, - Description: helpers.EnumToDescription(api.AllowedProviderTypeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedProviderTypeEnumEnumValues), - }, + "provider_type": { + Type: schema.TypeString, + Required: true, + Description: helpers.EnumToDescription(api.AllowedProviderTypeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedProviderTypeEnumEnumValues), + }, - "request_token_url": { - Type: schema.TypeString, - Optional: true, - Description: "Manually configure OAuth2 URLs when `oidc_well_known_url` is not set.", - }, - "authorization_url": { - Type: schema.TypeString, - Optional: true, - Description: "Manually configure OAuth2 URLs when `oidc_well_known_url` is not set.", - }, - "access_token_url": { - Type: schema.TypeString, - Optional: true, - Description: "Only required for OAuth1.", - }, - "profile_url": { - Type: schema.TypeString, - Optional: true, - Description: "Manually configure OAuth2 URLs when `oidc_well_known_url` is not set.", - }, + "request_token_url": { + Type: schema.TypeString, + Optional: true, + Description: "Manually configure OAuth2 URLs when `oidc_well_known_url` is not set.", + }, + "authorization_url": { + Type: schema.TypeString, + Optional: true, + Description: "Manually configure OAuth2 URLs when `oidc_well_known_url` is not set.", + }, + "access_token_url": { + Type: schema.TypeString, + Optional: true, + Description: "Only required for OAuth1.", + }, + "profile_url": { + Type: schema.TypeString, + Optional: true, + Description: "Manually configure OAuth2 URLs when `oidc_well_known_url` is not set.", + }, - "oidc_well_known_url": { - Type: schema.TypeString, - Optional: true, - Description: "Automatically configure source from OIDC well-known endpoint. URL is taken as is, and should end with `.well-known/openid-configuration`.", - }, - "oidc_jwks_url": { - Type: schema.TypeString, - Optional: true, - Description: "Automatically configure JWKS if not specified by `oidc_well_known_url`.", - }, - "oidc_jwks": { - Type: schema.TypeString, - Optional: true, - Description: "Manually configure JWKS keys for use with machine-to-machine authentication. " + helpers.JSONDescription, - Computed: true, - DiffSuppressFunc: helpers.DiffSuppressJSON, - ValidateDiagFunc: helpers.ValidateJSON, - }, - "pkce": { - Type: schema.TypeString, - Optional: true, - Default: api.PKCEMETHODENUM_NONE, - Description: helpers.EnumToDescription(api.AllowedPKCEMethodEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedPKCEMethodEnumEnumValues), - }, + "oidc_well_known_url": { + Type: schema.TypeString, + Optional: true, + Description: "Automatically configure source from OIDC well-known endpoint. URL is taken as is, and should end with `.well-known/openid-configuration`.", + }, + "oidc_jwks_url": { + Type: schema.TypeString, + Optional: true, + Description: "Automatically configure JWKS if not specified by `oidc_well_known_url`.", + }, + "oidc_jwks": { + Type: schema.TypeString, + Optional: true, + Description: "Manually configure JWKS keys for use with machine-to-machine authentication. " + helpers.JSONDescription, + Computed: true, + DiffSuppressFunc: helpers.DiffSuppressJSON, + ValidateDiagFunc: helpers.ValidateJSON, + }, + "pkce": { + Type: schema.TypeString, + Optional: true, + Default: api.PKCEMETHODENUM_NONE, + Description: helpers.EnumToDescription(api.AllowedPKCEMethodEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedPKCEMethodEnumEnumValues), + }, - "additional_scopes": { - Type: schema.TypeString, - Optional: true, - }, - "consumer_key": { - Type: schema.TypeString, - Required: true, - }, - "consumer_secret": { - Type: schema.TypeString, - Required: true, - Sensitive: true, - }, + "additional_scopes": { + Type: schema.TypeString, + Optional: true, + }, + "consumer_key": { + Type: schema.TypeString, + Required: true, + }, + "consumer_secret": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + }, - "callback_uri": { - Type: schema.TypeString, - Computed: true, - }, - "property_mappings": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "callback_uri": { + Type: schema.TypeString, + Computed: true, }, - }, - "property_mappings_group": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "property_mappings": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "property_mappings_group": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, }, - }, + ), } } diff --git a/pkg/provider/resource_source_plex.go b/pkg/provider/resource_source_plex.go index fb8327a9..676abb83 100644 --- a/pkg/provider/resource_source_plex.go +++ b/pkg/provider/resource_source_plex.go @@ -19,82 +19,85 @@ func resourceSourcePlex() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "uuid": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "slug": { - Type: schema.TypeString, - Required: true, - }, - "user_path_template": { - Type: schema.TypeString, - Default: "goauthentik.io/sources/%(slug)s", - Optional: true, - }, - "authentication_flow": { - Type: schema.TypeString, - Optional: true, - }, - "enrollment_flow": { - Type: schema.TypeString, - Optional: true, - }, - "enabled": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "policy_engine_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.POLICYENGINEMODE_ANY, - Description: helpers.EnumToDescription(api.AllowedPolicyEngineModeEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedPolicyEngineModeEnumValues), - }, - "user_matching_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.USERMATCHINGMODEENUM_IDENTIFIER, - Description: helpers.EnumToDescription(api.AllowedUserMatchingModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserMatchingModeEnumEnumValues), - }, - "group_matching_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.GROUPMATCHINGMODEENUM_IDENTIFIER, - Description: helpers.EnumToDescription(api.AllowedGroupMatchingModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedGroupMatchingModeEnumEnumValues), - }, + Schema: helpers.ModelSchema( + api.MODELENUM_SOURCES_PLEX_PLEXSOURCE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "uuid": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "slug": { + Type: schema.TypeString, + Required: true, + }, + "user_path_template": { + Type: schema.TypeString, + Default: "goauthentik.io/sources/%(slug)s", + Optional: true, + }, + "authentication_flow": { + Type: schema.TypeString, + Optional: true, + }, + "enrollment_flow": { + Type: schema.TypeString, + Optional: true, + }, + "enabled": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "policy_engine_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.POLICYENGINEMODE_ANY, + Description: helpers.EnumToDescription(api.AllowedPolicyEngineModeEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedPolicyEngineModeEnumValues), + }, + "user_matching_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.USERMATCHINGMODEENUM_IDENTIFIER, + Description: helpers.EnumToDescription(api.AllowedUserMatchingModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserMatchingModeEnumEnumValues), + }, + "group_matching_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.GROUPMATCHINGMODEENUM_IDENTIFIER, + Description: helpers.EnumToDescription(api.AllowedGroupMatchingModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedGroupMatchingModeEnumEnumValues), + }, - "client_id": { - Type: schema.TypeString, - Required: true, - }, - "allowed_servers": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "client_id": { + Type: schema.TypeString, + Required: true, + }, + "allowed_servers": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "allow_friends": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "plex_token": { + Type: schema.TypeString, + Required: true, + Sensitive: true, }, }, - "allow_friends": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "plex_token": { - Type: schema.TypeString, - Required: true, - Sensitive: true, - }, - }, + ), } } diff --git a/pkg/provider/resource_source_saml.go b/pkg/provider/resource_source_saml.go index 01bc812f..c887c9be 100644 --- a/pkg/provider/resource_source_saml.go +++ b/pkg/provider/resource_source_saml.go @@ -19,160 +19,163 @@ func resourceSourceSAML() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "uuid": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "slug": { - Type: schema.TypeString, - Required: true, - }, - "user_path_template": { - Type: schema.TypeString, - Default: "goauthentik.io/sources/%(slug)s", - Optional: true, - }, - "authentication_flow": { - Type: schema.TypeString, - Optional: true, - }, - "enrollment_flow": { - Type: schema.TypeString, - Optional: true, - }, - "enabled": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "policy_engine_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.POLICYENGINEMODE_ANY, - Description: helpers.EnumToDescription(api.AllowedPolicyEngineModeEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedPolicyEngineModeEnumValues), - }, - "user_matching_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.USERMATCHINGMODEENUM_IDENTIFIER, - Description: helpers.EnumToDescription(api.AllowedUserMatchingModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserMatchingModeEnumEnumValues), - }, - "group_matching_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.GROUPMATCHINGMODEENUM_IDENTIFIER, - Description: helpers.EnumToDescription(api.AllowedGroupMatchingModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedGroupMatchingModeEnumEnumValues), - }, + Schema: helpers.ModelSchema( + api.MODELENUM_SOURCES_SAML_SAMLSOURCE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "uuid": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "slug": { + Type: schema.TypeString, + Required: true, + }, + "user_path_template": { + Type: schema.TypeString, + Default: "goauthentik.io/sources/%(slug)s", + Optional: true, + }, + "authentication_flow": { + Type: schema.TypeString, + Optional: true, + }, + "enrollment_flow": { + Type: schema.TypeString, + Optional: true, + }, + "enabled": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "policy_engine_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.POLICYENGINEMODE_ANY, + Description: helpers.EnumToDescription(api.AllowedPolicyEngineModeEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedPolicyEngineModeEnumValues), + }, + "user_matching_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.USERMATCHINGMODEENUM_IDENTIFIER, + Description: helpers.EnumToDescription(api.AllowedUserMatchingModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserMatchingModeEnumEnumValues), + }, + "group_matching_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.GROUPMATCHINGMODEENUM_IDENTIFIER, + Description: helpers.EnumToDescription(api.AllowedGroupMatchingModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedGroupMatchingModeEnumEnumValues), + }, - "pre_authentication_flow": { - Type: schema.TypeString, - Required: true, - }, - "issuer": { - Type: schema.TypeString, - Optional: true, - }, - "sso_url": { - Type: schema.TypeString, - Required: true, - }, - "slo_url": { - Type: schema.TypeString, - Optional: true, - }, - "allow_idp_initiated": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "name_id_policy": { - Type: schema.TypeString, - Optional: true, - Default: api.SAMLNAMEIDPOLICYENUM__2_0NAMEID_FORMATPERSISTENT, - Description: helpers.EnumToDescription(api.AllowedSAMLNameIDPolicyEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedSAMLNameIDPolicyEnumEnumValues), - }, - "binding_type": { - Type: schema.TypeString, - Optional: true, - Default: api.BINDINGTYPEENUM_REDIRECT, - Description: helpers.EnumToDescription(api.AllowedBindingTypeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedBindingTypeEnumEnumValues), - }, - "signing_kp": { - Type: schema.TypeString, - Optional: true, - }, - "encryption_kp": { - Type: schema.TypeString, - Optional: true, - }, - "verification_kp": { - Type: schema.TypeString, - Optional: true, - }, - "signed_assertion": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "signed_response": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "digest_algorithm": { - Type: schema.TypeString, - Optional: true, - Default: api.DIGESTALGORITHMENUM__2001_04_XMLENCSHA256, - Description: helpers.EnumToDescription(api.AllowedDigestAlgorithmEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedDigestAlgorithmEnumEnumValues), - }, - "signature_algorithm": { - Type: schema.TypeString, - Optional: true, - Default: api.SIGNATUREALGORITHMENUM__2001_04_XMLDSIG_MORERSA_SHA256, - Description: helpers.EnumToDescription(api.AllowedSignatureAlgorithmEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedSignatureAlgorithmEnumEnumValues), - }, - "temporary_user_delete_after": { - Type: schema.TypeString, - Optional: true, - Default: "days=1", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, + "pre_authentication_flow": { + Type: schema.TypeString, + Required: true, + }, + "issuer": { + Type: schema.TypeString, + Optional: true, + }, + "sso_url": { + Type: schema.TypeString, + Required: true, + }, + "slo_url": { + Type: schema.TypeString, + Optional: true, + }, + "allow_idp_initiated": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "name_id_policy": { + Type: schema.TypeString, + Optional: true, + Default: api.SAMLNAMEIDPOLICYENUM__2_0NAMEID_FORMATPERSISTENT, + Description: helpers.EnumToDescription(api.AllowedSAMLNameIDPolicyEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedSAMLNameIDPolicyEnumEnumValues), + }, + "binding_type": { + Type: schema.TypeString, + Optional: true, + Default: api.BINDINGTYPEENUM_REDIRECT, + Description: helpers.EnumToDescription(api.AllowedBindingTypeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedBindingTypeEnumEnumValues), + }, + "signing_kp": { + Type: schema.TypeString, + Optional: true, + }, + "encryption_kp": { + Type: schema.TypeString, + Optional: true, + }, + "verification_kp": { + Type: schema.TypeString, + Optional: true, + }, + "signed_assertion": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "signed_response": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "digest_algorithm": { + Type: schema.TypeString, + Optional: true, + Default: api.DIGESTALGORITHMENUM__2001_04_XMLENCSHA256, + Description: helpers.EnumToDescription(api.AllowedDigestAlgorithmEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedDigestAlgorithmEnumEnumValues), + }, + "signature_algorithm": { + Type: schema.TypeString, + Optional: true, + Default: api.SIGNATUREALGORITHMENUM__2001_04_XMLDSIG_MORERSA_SHA256, + Description: helpers.EnumToDescription(api.AllowedSignatureAlgorithmEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedSignatureAlgorithmEnumEnumValues), + }, + "temporary_user_delete_after": { + Type: schema.TypeString, + Optional: true, + Default: "days=1", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, - "metadata": { - Type: schema.TypeString, - Computed: true, - Description: "SAML Metadata", - }, + "metadata": { + Type: schema.TypeString, + Computed: true, + Description: "SAML Metadata", + }, - "property_mappings": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "property_mappings": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, - }, - "property_mappings_group": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "property_mappings_group": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, }, - }, + ), } } diff --git a/pkg/provider/resource_source_scim.go b/pkg/provider/resource_source_scim.go index 1d227793..795a7b7e 100644 --- a/pkg/provider/resource_source_scim.go +++ b/pkg/provider/resource_source_scim.go @@ -19,57 +19,60 @@ func resourceSourceSCIM() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "uuid": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "slug": { - Type: schema.TypeString, - Required: true, - }, - "user_path_template": { - Type: schema.TypeString, - Default: "goauthentik.io/sources/%(slug)s", - Optional: true, - }, - "enabled": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, + Schema: helpers.ModelSchema( + api.MODELENUM_SOURCES_SCIM_SCIMSOURCE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "uuid": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "slug": { + Type: schema.TypeString, + Required: true, + }, + "user_path_template": { + Type: schema.TypeString, + Default: "goauthentik.io/sources/%(slug)s", + Optional: true, + }, + "enabled": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, - "property_mappings": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "property_mappings": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, - }, - "property_mappings_group": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "property_mappings_group": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, - }, - "scim_url": { - Type: schema.TypeString, - Computed: true, - Description: "SCIM URL", - }, - "token": { - Type: schema.TypeString, - Computed: true, - Description: "SCIM URL", + "scim_url": { + Type: schema.TypeString, + Computed: true, + Description: "SCIM URL", + }, + "token": { + Type: schema.TypeString, + Computed: true, + Description: "SCIM URL", + }, }, - }, + ), } } diff --git a/pkg/provider/resource_source_telegram.go b/pkg/provider/resource_source_telegram.go index 35183aa2..1e0b9d4c 100644 --- a/pkg/provider/resource_source_telegram.go +++ b/pkg/provider/resource_source_telegram.go @@ -19,86 +19,89 @@ func resourceSourceTelegram() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "uuid": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "slug": { - Type: schema.TypeString, - Required: true, - }, - "user_path_template": { - Type: schema.TypeString, - Default: "goauthentik.io/sources/%(slug)s", - Optional: true, - }, - "authentication_flow": { - Type: schema.TypeString, - Optional: true, - }, - "enrollment_flow": { - Type: schema.TypeString, - Optional: true, - }, - "enabled": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "policy_engine_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.POLICYENGINEMODE_ANY, - Description: helpers.EnumToDescription(api.AllowedPolicyEngineModeEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedPolicyEngineModeEnumValues), - }, - "user_matching_mode": { - Type: schema.TypeString, - Optional: true, - Default: api.USERMATCHINGMODEENUM_IDENTIFIER, - Description: helpers.EnumToDescription(api.AllowedUserMatchingModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserMatchingModeEnumEnumValues), - }, - "pre_authentication_flow": { - Type: schema.TypeString, - Required: true, - }, + Schema: helpers.ModelSchema( + api.MODELENUM_SOURCES_TELEGRAM_TELEGRAMSOURCE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "uuid": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "slug": { + Type: schema.TypeString, + Required: true, + }, + "user_path_template": { + Type: schema.TypeString, + Default: "goauthentik.io/sources/%(slug)s", + Optional: true, + }, + "authentication_flow": { + Type: schema.TypeString, + Optional: true, + }, + "enrollment_flow": { + Type: schema.TypeString, + Optional: true, + }, + "enabled": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "policy_engine_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.POLICYENGINEMODE_ANY, + Description: helpers.EnumToDescription(api.AllowedPolicyEngineModeEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedPolicyEngineModeEnumValues), + }, + "user_matching_mode": { + Type: schema.TypeString, + Optional: true, + Default: api.USERMATCHINGMODEENUM_IDENTIFIER, + Description: helpers.EnumToDescription(api.AllowedUserMatchingModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserMatchingModeEnumEnumValues), + }, + "pre_authentication_flow": { + Type: schema.TypeString, + Required: true, + }, - "bot_username": { - Type: schema.TypeString, - Required: true, - }, - "bot_token": { - Type: schema.TypeString, - Required: true, - }, - "request_message_access": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, + "bot_username": { + Type: schema.TypeString, + Required: true, + }, + "bot_token": { + Type: schema.TypeString, + Required: true, + }, + "request_message_access": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, - "property_mappings": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "property_mappings": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, - }, - "property_mappings_group": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "property_mappings_group": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, }, - }, + ), } } diff --git a/pkg/provider/resource_stage_authenticator_duo.go b/pkg/provider/resource_stage_authenticator_duo.go index e804c6df..b5a7c817 100644 --- a/pkg/provider/resource_stage_authenticator_duo.go +++ b/pkg/provider/resource_stage_authenticator_duo.go @@ -19,43 +19,46 @@ func resourceStageAuthenticatorDuo() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_AUTHENTICATOR_DUO_AUTHENTICATORDUOSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "friendly_name": { + Type: schema.TypeString, + Optional: true, + Default: "", + }, + "configure_flow": { + Type: schema.TypeString, + Optional: true, + }, + "client_id": { + Type: schema.TypeString, + Required: true, + }, + "client_secret": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + }, + "admin_integration_key": { + Type: schema.TypeString, + Optional: true, + }, + "admin_secret_key": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + }, + "api_hostname": { + Type: schema.TypeString, + Required: true, + }, }, - "friendly_name": { - Type: schema.TypeString, - Optional: true, - Default: "", - }, - "configure_flow": { - Type: schema.TypeString, - Optional: true, - }, - "client_id": { - Type: schema.TypeString, - Required: true, - }, - "client_secret": { - Type: schema.TypeString, - Required: true, - Sensitive: true, - }, - "admin_integration_key": { - Type: schema.TypeString, - Optional: true, - }, - "admin_secret_key": { - Type: schema.TypeString, - Optional: true, - Sensitive: true, - }, - "api_hostname": { - Type: schema.TypeString, - Required: true, - }, - }, + ), } } diff --git a/pkg/provider/resource_stage_authenticator_email.go b/pkg/provider/resource_stage_authenticator_email.go index fd7b6d6c..d65b51d8 100644 --- a/pkg/provider/resource_stage_authenticator_email.go +++ b/pkg/provider/resource_stage_authenticator_email.go @@ -19,80 +19,83 @@ func resourceStageAuthenticatorEmail() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_AUTHENTICATOR_EMAIL_AUTHENTICATOREMAILSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "friendly_name": { + Type: schema.TypeString, + Optional: true, + Default: "", + }, + "configure_flow": { + Type: schema.TypeString, + Optional: true, + }, + "use_global_settings": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "host": { + Type: schema.TypeString, + Optional: true, + Default: "localhost", + }, + "port": { + Type: schema.TypeInt, + Optional: true, + Default: 25, + }, + "username": { + Type: schema.TypeString, + Optional: true, + }, + "password": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + }, + "use_tls": { + Type: schema.TypeBool, + Optional: true, + }, + "use_ssl": { + Type: schema.TypeBool, + Optional: true, + }, + "timeout": { + Type: schema.TypeInt, + Optional: true, + Default: 30, + }, + "from_address": { + Type: schema.TypeString, + Optional: true, + Default: "system@authentik.local", + }, + "token_expiry": { + Type: schema.TypeString, + Optional: true, + Default: "minutes=30", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, + "subject": { + Type: schema.TypeString, + Optional: true, + Default: "authentik", + }, + "template": { + Type: schema.TypeString, + Optional: true, + Default: "email/password_reset.html", + }, }, - "friendly_name": { - Type: schema.TypeString, - Optional: true, - Default: "", - }, - "configure_flow": { - Type: schema.TypeString, - Optional: true, - }, - "use_global_settings": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "host": { - Type: schema.TypeString, - Optional: true, - Default: "localhost", - }, - "port": { - Type: schema.TypeInt, - Optional: true, - Default: 25, - }, - "username": { - Type: schema.TypeString, - Optional: true, - }, - "password": { - Type: schema.TypeString, - Optional: true, - Sensitive: true, - }, - "use_tls": { - Type: schema.TypeBool, - Optional: true, - }, - "use_ssl": { - Type: schema.TypeBool, - Optional: true, - }, - "timeout": { - Type: schema.TypeInt, - Optional: true, - Default: 30, - }, - "from_address": { - Type: schema.TypeString, - Optional: true, - Default: "system@authentik.local", - }, - "token_expiry": { - Type: schema.TypeString, - Optional: true, - Default: "minutes=30", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, - "subject": { - Type: schema.TypeString, - Optional: true, - Default: "authentik", - }, - "template": { - Type: schema.TypeString, - Optional: true, - Default: "email/password_reset.html", - }, - }, + ), } } diff --git a/pkg/provider/resource_stage_authenticator_endpoint_gdtc.go b/pkg/provider/resource_stage_authenticator_endpoint_gdtc.go index e27c28ed..d4889c32 100644 --- a/pkg/provider/resource_stage_authenticator_endpoint_gdtc.go +++ b/pkg/provider/resource_stage_authenticator_endpoint_gdtc.go @@ -19,26 +19,29 @@ func resourceStageAuthenticatorEndpointGDTC() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_AUTHENTICATOR_ENDPOINT_GDTC_AUTHENTICATORENDPOINTGDTCSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "friendly_name": { + Type: schema.TypeString, + Optional: true, + Default: "", + }, + "configure_flow": { + Type: schema.TypeString, + Optional: true, + }, + "credentials": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + }, }, - "friendly_name": { - Type: schema.TypeString, - Optional: true, - Default: "", - }, - "configure_flow": { - Type: schema.TypeString, - Optional: true, - }, - "credentials": { - Type: schema.TypeString, - Required: true, - Sensitive: true, - }, - }, + ), } } diff --git a/pkg/provider/resource_stage_authenticator_sms.go b/pkg/provider/resource_stage_authenticator_sms.go index f559fb40..63680a17 100644 --- a/pkg/provider/resource_stage_authenticator_sms.go +++ b/pkg/provider/resource_stage_authenticator_sms.go @@ -19,63 +19,66 @@ func resourceStageAuthenticatorSms() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_AUTHENTICATOR_SMS_AUTHENTICATORSMSSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "friendly_name": { + Type: schema.TypeString, + Optional: true, + Default: "", + }, + "configure_flow": { + Type: schema.TypeString, + Optional: true, + }, + "sms_provider": { + Type: schema.TypeString, + Optional: true, + Default: api.PROVIDERENUM_TWILIO, + Description: helpers.EnumToDescription(api.AllowedProviderEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedProviderEnumEnumValues), + }, + "from_number": { + Type: schema.TypeString, + Required: true, + }, + "account_sid": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + }, + "auth": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + }, + "auth_type": { + Type: schema.TypeString, + Optional: true, + Default: api.AUTHTYPEENUM_BASIC, + Description: helpers.EnumToDescription(api.AllowedAuthTypeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedAuthTypeEnumEnumValues), + }, + "auth_password": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + }, + "mapping": { + Type: schema.TypeString, + Optional: true, + }, + "verify_only": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, }, - "friendly_name": { - Type: schema.TypeString, - Optional: true, - Default: "", - }, - "configure_flow": { - Type: schema.TypeString, - Optional: true, - }, - "sms_provider": { - Type: schema.TypeString, - Optional: true, - Default: api.PROVIDERENUM_TWILIO, - Description: helpers.EnumToDescription(api.AllowedProviderEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedProviderEnumEnumValues), - }, - "from_number": { - Type: schema.TypeString, - Required: true, - }, - "account_sid": { - Type: schema.TypeString, - Required: true, - Sensitive: true, - }, - "auth": { - Type: schema.TypeString, - Required: true, - Sensitive: true, - }, - "auth_type": { - Type: schema.TypeString, - Optional: true, - Default: api.AUTHTYPEENUM_BASIC, - Description: helpers.EnumToDescription(api.AllowedAuthTypeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedAuthTypeEnumEnumValues), - }, - "auth_password": { - Type: schema.TypeString, - Optional: true, - Sensitive: true, - }, - "mapping": { - Type: schema.TypeString, - Optional: true, - }, - "verify_only": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - }, + ), } } diff --git a/pkg/provider/resource_stage_authenticator_static.go b/pkg/provider/resource_stage_authenticator_static.go index cd0472be..c1b7a894 100644 --- a/pkg/provider/resource_stage_authenticator_static.go +++ b/pkg/provider/resource_stage_authenticator_static.go @@ -19,31 +19,34 @@ func resourceStageAuthenticatorStatic() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_AUTHENTICATOR_STATIC_AUTHENTICATORSTATICSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "friendly_name": { + Type: schema.TypeString, + Optional: true, + Default: "", + }, + "configure_flow": { + Type: schema.TypeString, + Optional: true, + }, + "token_count": { + Type: schema.TypeInt, + Optional: true, + Default: 6, + }, + "token_length": { + Type: schema.TypeInt, + Optional: true, + Default: 12, + }, }, - "friendly_name": { - Type: schema.TypeString, - Optional: true, - Default: "", - }, - "configure_flow": { - Type: schema.TypeString, - Optional: true, - }, - "token_count": { - Type: schema.TypeInt, - Optional: true, - Default: 6, - }, - "token_length": { - Type: schema.TypeInt, - Optional: true, - Default: 12, - }, - }, + ), } } diff --git a/pkg/provider/resource_stage_authenticator_totp.go b/pkg/provider/resource_stage_authenticator_totp.go index 21463a29..f8ca8138 100644 --- a/pkg/provider/resource_stage_authenticator_totp.go +++ b/pkg/provider/resource_stage_authenticator_totp.go @@ -19,28 +19,31 @@ func resourceStageAuthenticatorTOTP() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_AUTHENTICATOR_TOTP_AUTHENTICATORTOTPSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "friendly_name": { + Type: schema.TypeString, + Optional: true, + Default: "", + }, + "configure_flow": { + Type: schema.TypeString, + Optional: true, + }, + "digits": { + Type: schema.TypeString, + Optional: true, + Default: api.DIGITSENUM__6, + Description: helpers.EnumToDescription(api.AllowedDigitsEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedDigitsEnumEnumValues), + }, }, - "friendly_name": { - Type: schema.TypeString, - Optional: true, - Default: "", - }, - "configure_flow": { - Type: schema.TypeString, - Optional: true, - }, - "digits": { - Type: schema.TypeString, - Optional: true, - Default: api.DIGITSENUM__6, - Description: helpers.EnumToDescription(api.AllowedDigitsEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedDigitsEnumEnumValues), - }, - }, + ), } } diff --git a/pkg/provider/resource_stage_authenticator_validate.go b/pkg/provider/resource_stage_authenticator_validate.go index bc36a379..848364e9 100644 --- a/pkg/provider/resource_stage_authenticator_validate.go +++ b/pkg/provider/resource_stage_authenticator_validate.go @@ -19,55 +19,58 @@ func resourceStageAuthenticatorValidate() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "not_configured_action": { - Type: schema.TypeString, - Required: true, - Description: helpers.EnumToDescription(api.AllowedNotConfiguredActionEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedNotConfiguredActionEnumEnumValues), - }, - "device_classes": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_AUTHENTICATOR_VALIDATE_AUTHENTICATORVALIDATESTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "not_configured_action": { Type: schema.TypeString, - Description: helpers.EnumToDescription(api.AllowedDeviceClassesEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedDeviceClassesEnumEnumValues), + Required: true, + Description: helpers.EnumToDescription(api.AllowedNotConfiguredActionEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedNotConfiguredActionEnumEnumValues), }, - }, - "configuration_stages": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "device_classes": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + Description: helpers.EnumToDescription(api.AllowedDeviceClassesEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedDeviceClassesEnumEnumValues), + }, }, - }, - "last_auth_threshold": { - Type: schema.TypeString, - Optional: true, - Default: "seconds=0", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, - "webauthn_user_verification": { - Type: schema.TypeString, - Optional: true, - Default: api.USERVERIFICATIONENUM_PREFERRED, - Description: helpers.EnumToDescription(api.AllowedUserVerificationEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserVerificationEnumEnumValues), - }, - "webauthn_allowed_device_types": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "configuration_stages": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "last_auth_threshold": { + Type: schema.TypeString, + Optional: true, + Default: "seconds=0", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, + "webauthn_user_verification": { + Type: schema.TypeString, + Optional: true, + Default: api.USERVERIFICATIONENUM_PREFERRED, + Description: helpers.EnumToDescription(api.AllowedUserVerificationEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserVerificationEnumEnumValues), + }, + "webauthn_allowed_device_types": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, }, - }, + ), } } diff --git a/pkg/provider/resource_stage_authenticator_webauthn.go b/pkg/provider/resource_stage_authenticator_webauthn.go index 6b191a1d..0f77b588 100644 --- a/pkg/provider/resource_stage_authenticator_webauthn.go +++ b/pkg/provider/resource_stage_authenticator_webauthn.go @@ -19,52 +19,55 @@ func resourceStageAuthenticatorWebAuthn() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "friendly_name": { - Type: schema.TypeString, - Optional: true, - Default: "", - }, - "configure_flow": { - Type: schema.TypeString, - Optional: true, - }, - "user_verification": { - Type: schema.TypeString, - Optional: true, - Default: api.USERVERIFICATIONENUM_PREFERRED, - Description: helpers.EnumToDescription(api.AllowedUserVerificationEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserVerificationEnumEnumValues), - }, - "resident_key_requirement": { - Type: schema.TypeString, - Optional: true, - Default: api.RESIDENTKEYREQUIREMENTENUM_PREFERRED, - Description: helpers.EnumToDescription(api.AllowedResidentKeyRequirementEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedResidentKeyRequirementEnumEnumValues), - }, - "authenticator_attachment": { - Type: schema.TypeString, - Optional: true, - Description: helpers.EnumToDescription(api.AllowedAuthenticatorAttachmentEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedAuthenticatorAttachmentEnumEnumValues), - }, - "device_type_restrictions": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_AUTHENTICATOR_WEBAUTHN_AUTHENTICATORWEBAUTHNSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "friendly_name": { + Type: schema.TypeString, + Optional: true, + Default: "", + }, + "configure_flow": { + Type: schema.TypeString, + Optional: true, + }, + "user_verification": { + Type: schema.TypeString, + Optional: true, + Default: api.USERVERIFICATIONENUM_PREFERRED, + Description: helpers.EnumToDescription(api.AllowedUserVerificationEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserVerificationEnumEnumValues), + }, + "resident_key_requirement": { + Type: schema.TypeString, + Optional: true, + Default: api.RESIDENTKEYREQUIREMENTENUM_PREFERRED, + Description: helpers.EnumToDescription(api.AllowedResidentKeyRequirementEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedResidentKeyRequirementEnumEnumValues), + }, + "authenticator_attachment": { + Type: schema.TypeString, + Optional: true, + Description: helpers.EnumToDescription(api.AllowedAuthenticatorAttachmentEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedAuthenticatorAttachmentEnumEnumValues), + }, + "device_type_restrictions": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "max_attempts": { + Type: schema.TypeInt, + Optional: true, }, }, - "max_attempts": { - Type: schema.TypeInt, - Optional: true, - }, - }, + ), } } diff --git a/pkg/provider/resource_stage_captcha.go b/pkg/provider/resource_stage_captcha.go index 8d2e433b..e64bf44b 100644 --- a/pkg/provider/resource_stage_captcha.go +++ b/pkg/provider/resource_stage_captcha.go @@ -19,51 +19,54 @@ func resourceStageCaptcha() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_CAPTCHA_CAPTCHASTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "public_key": { + Type: schema.TypeString, + Required: true, + }, + "js_url": { + Type: schema.TypeString, + Optional: true, + Default: "https://www.recaptcha.net/recaptcha/api.js", + }, + "api_url": { + Type: schema.TypeString, + Optional: true, + Default: "https://www.recaptcha.net/recaptcha/api/siteverify", + }, + "private_key": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + }, + "score_min_threshold": { + Type: schema.TypeFloat, + Optional: true, + Default: 1, + }, + "score_max_threshold": { + Type: schema.TypeFloat, + Optional: true, + Default: 0.5, + }, + "error_on_invalid_score": { + Type: schema.TypeBool, + Default: true, + Optional: true, + }, + "interactive": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, }, - "public_key": { - Type: schema.TypeString, - Required: true, - }, - "js_url": { - Type: schema.TypeString, - Optional: true, - Default: "https://www.recaptcha.net/recaptcha/api.js", - }, - "api_url": { - Type: schema.TypeString, - Optional: true, - Default: "https://www.recaptcha.net/recaptcha/api/siteverify", - }, - "private_key": { - Type: schema.TypeString, - Required: true, - Sensitive: true, - }, - "score_min_threshold": { - Type: schema.TypeFloat, - Optional: true, - Default: 1, - }, - "score_max_threshold": { - Type: schema.TypeFloat, - Optional: true, - Default: 0.5, - }, - "error_on_invalid_score": { - Type: schema.TypeBool, - Default: true, - Optional: true, - }, - "interactive": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - }, + ), } } diff --git a/pkg/provider/resource_stage_consent.go b/pkg/provider/resource_stage_consent.go index 3d44ee4f..7f1a6eec 100644 --- a/pkg/provider/resource_stage_consent.go +++ b/pkg/provider/resource_stage_consent.go @@ -19,26 +19,29 @@ func resourceStageConsent() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_CONSENT_CONSENTSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "mode": { + Type: schema.TypeString, + Optional: true, + Default: api.CONSENTSTAGEMODEENUM_ALWAYS_REQUIRE, + Description: helpers.EnumToDescription(api.AllowedConsentStageModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedConsentStageModeEnumEnumValues), + }, + "consent_expire_in": { + Type: schema.TypeString, + Optional: true, + Default: "weeks=4", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, }, - "mode": { - Type: schema.TypeString, - Optional: true, - Default: api.CONSENTSTAGEMODEENUM_ALWAYS_REQUIRE, - Description: helpers.EnumToDescription(api.AllowedConsentStageModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedConsentStageModeEnumEnumValues), - }, - "consent_expire_in": { - Type: schema.TypeString, - Optional: true, - Default: "weeks=4", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, - }, + ), } } diff --git a/pkg/provider/resource_stage_deny.go b/pkg/provider/resource_stage_deny.go index ef71045d..f54848a3 100644 --- a/pkg/provider/resource_stage_deny.go +++ b/pkg/provider/resource_stage_deny.go @@ -19,16 +19,19 @@ func resourceStageDeny() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_DENY_DENYSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "deny_message": { + Type: schema.TypeString, + Optional: true, + }, }, - "deny_message": { - Type: schema.TypeString, - Optional: true, - }, - }, + ), } } diff --git a/pkg/provider/resource_stage_dummy.go b/pkg/provider/resource_stage_dummy.go index 80eb0ca6..b368d99e 100644 --- a/pkg/provider/resource_stage_dummy.go +++ b/pkg/provider/resource_stage_dummy.go @@ -19,12 +19,15 @@ func resourceStageDummy() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_DUMMY_DUMMYSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, }, - }, + ), } } diff --git a/pkg/provider/resource_stage_email.go b/pkg/provider/resource_stage_email.go index 86a46710..67547037 100644 --- a/pkg/provider/resource_stage_email.go +++ b/pkg/provider/resource_stage_email.go @@ -19,88 +19,91 @@ func resourceStageEmail() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "use_global_settings": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "host": { - Type: schema.TypeString, - Optional: true, - Default: "localhost", - }, - "port": { - Type: schema.TypeInt, - Optional: true, - Default: 25, - }, - "username": { - Type: schema.TypeString, - Optional: true, - }, - "password": { - Type: schema.TypeString, - Optional: true, - Sensitive: true, - }, - "use_tls": { - Type: schema.TypeBool, - Optional: true, - }, - "use_ssl": { - Type: schema.TypeBool, - Optional: true, - }, - "timeout": { - Type: schema.TypeInt, - Optional: true, - Default: 30, - }, - "from_address": { - Type: schema.TypeString, - Optional: true, - Default: "system@authentik.local", - }, - "token_expiry": { - Type: schema.TypeString, - Optional: true, - Default: "minutes=30", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, - "subject": { - Type: schema.TypeString, - Optional: true, - Default: "authentik", - }, - "template": { - Type: schema.TypeString, - Optional: true, - Default: "email/password_reset.html", - }, - "activate_user_on_success": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "recovery_max_attempts": { - Type: schema.TypeInt, - Optional: true, - Default: 5, - }, - "recovery_cache_timeout": { - Type: schema.TypeString, - Optional: true, - Default: "minutes=5", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, - }, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_EMAIL_EMAILSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "use_global_settings": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "host": { + Type: schema.TypeString, + Optional: true, + Default: "localhost", + }, + "port": { + Type: schema.TypeInt, + Optional: true, + Default: 25, + }, + "username": { + Type: schema.TypeString, + Optional: true, + }, + "password": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + }, + "use_tls": { + Type: schema.TypeBool, + Optional: true, + }, + "use_ssl": { + Type: schema.TypeBool, + Optional: true, + }, + "timeout": { + Type: schema.TypeInt, + Optional: true, + Default: 30, + }, + "from_address": { + Type: schema.TypeString, + Optional: true, + Default: "system@authentik.local", + }, + "token_expiry": { + Type: schema.TypeString, + Optional: true, + Default: "minutes=30", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, + "subject": { + Type: schema.TypeString, + Optional: true, + Default: "authentik", + }, + "template": { + Type: schema.TypeString, + Optional: true, + Default: "email/password_reset.html", + }, + "activate_user_on_success": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "recovery_max_attempts": { + Type: schema.TypeInt, + Optional: true, + Default: 5, + }, + "recovery_cache_timeout": { + Type: schema.TypeString, + Optional: true, + Default: "minutes=5", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, + }, + ), } } diff --git a/pkg/provider/resource_stage_identification.go b/pkg/provider/resource_stage_identification.go index 0a1a762c..bd46b8dd 100644 --- a/pkg/provider/resource_stage_identification.go +++ b/pkg/provider/resource_stage_identification.go @@ -19,72 +19,75 @@ func resourceStageIdentification() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "user_fields": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - Description: helpers.EnumToDescription(api.AllowedUserFieldsEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserFieldsEnumEnumValues), + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_IDENTIFICATION_IDENTIFICATIONSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, }, - }, - "password_stage": { - Type: schema.TypeString, - Optional: true, - }, - "captcha_stage": { - Type: schema.TypeString, - Optional: true, - }, - "case_insensitive_matching": { - Type: schema.TypeBool, - Optional: true, - }, - "show_matched_user": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "pretend_user_exists": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "show_source_labels": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "enable_remember_me": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "enrollment_flow": { - Type: schema.TypeString, - Optional: true, - }, - "recovery_flow": { - Type: schema.TypeString, - Optional: true, - }, - "passwordless_flow": { - Type: schema.TypeString, - Optional: true, - }, - "sources": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "user_fields": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + Description: helpers.EnumToDescription(api.AllowedUserFieldsEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserFieldsEnumEnumValues), + }, + }, + "password_stage": { + Type: schema.TypeString, + Optional: true, + }, + "captcha_stage": { + Type: schema.TypeString, + Optional: true, + }, + "case_insensitive_matching": { + Type: schema.TypeBool, + Optional: true, + }, + "show_matched_user": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "pretend_user_exists": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "show_source_labels": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "enable_remember_me": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "enrollment_flow": { + Type: schema.TypeString, + Optional: true, + }, + "recovery_flow": { + Type: schema.TypeString, + Optional: true, + }, + "passwordless_flow": { + Type: schema.TypeString, + Optional: true, + }, + "sources": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, }, - }, + ), } } diff --git a/pkg/provider/resource_stage_invitation.go b/pkg/provider/resource_stage_invitation.go index c3e90c29..ee96984e 100644 --- a/pkg/provider/resource_stage_invitation.go +++ b/pkg/provider/resource_stage_invitation.go @@ -19,17 +19,20 @@ func resourceStageInvitation() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_INVITATION_INVITATIONSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "continue_flow_without_invitation": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, }, - "continue_flow_without_invitation": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - }, + ), } } diff --git a/pkg/provider/resource_stage_mutual_tls.go b/pkg/provider/resource_stage_mutual_tls.go index 603b6be9..e680bf21 100644 --- a/pkg/provider/resource_stage_mutual_tls.go +++ b/pkg/provider/resource_stage_mutual_tls.go @@ -19,40 +19,43 @@ func resourceStageMutualTLS() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "mode": { - Type: schema.TypeString, - Optional: true, - Default: api.MUTUALTLSSTAGEMODEENUM_OPTIONAL, - Description: helpers.EnumToDescription(api.AllowedMutualTLSStageModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedMutualTLSStageModeEnumEnumValues), - }, - "cert_attribute": { - Type: schema.TypeString, - Optional: true, - Default: api.CERTATTRIBUTEENUM_EMAIL, - Description: helpers.EnumToDescription(api.AllowedCertAttributeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedCertAttributeEnumEnumValues), - }, - "user_attribute": { - Type: schema.TypeString, - Optional: true, - Default: api.USERATTRIBUTEENUM_EMAIL, - Description: helpers.EnumToDescription(api.AllowedUserAttributeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserAttributeEnumEnumValues), - }, - "certificate_authorities": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_MTLS_MUTUALTLSSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "mode": { + Type: schema.TypeString, + Optional: true, + Default: api.MUTUALTLSSTAGEMODEENUM_OPTIONAL, + Description: helpers.EnumToDescription(api.AllowedMutualTLSStageModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedMutualTLSStageModeEnumEnumValues), + }, + "cert_attribute": { + Type: schema.TypeString, + Optional: true, + Default: api.CERTATTRIBUTEENUM_EMAIL, + Description: helpers.EnumToDescription(api.AllowedCertAttributeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedCertAttributeEnumEnumValues), + }, + "user_attribute": { + Type: schema.TypeString, + Optional: true, + Default: api.USERATTRIBUTEENUM_EMAIL, + Description: helpers.EnumToDescription(api.AllowedUserAttributeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserAttributeEnumEnumValues), + }, + "certificate_authorities": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, }, - }, + ), } } diff --git a/pkg/provider/resource_stage_password.go b/pkg/provider/resource_stage_password.go index 41bade9e..c885347e 100644 --- a/pkg/provider/resource_stage_password.go +++ b/pkg/provider/resource_stage_password.go @@ -19,35 +19,38 @@ func resourceStagePassword() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "backends": { - Type: schema.TypeList, - Required: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - Description: helpers.EnumToDescription(api.AllowedBackendsEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedBackendsEnumEnumValues), + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_PASSWORD_PASSWORDSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "backends": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + Description: helpers.EnumToDescription(api.AllowedBackendsEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedBackendsEnumEnumValues), + }, + }, + "configure_flow": { + Type: schema.TypeString, + Optional: true, + }, + "failed_attempts_before_cancel": { + Type: schema.TypeInt, + Optional: true, + Default: 5, + }, + "allow_show_password": { + Type: schema.TypeBool, + Default: false, + Optional: true, }, }, - "configure_flow": { - Type: schema.TypeString, - Optional: true, - }, - "failed_attempts_before_cancel": { - Type: schema.TypeInt, - Optional: true, - Default: 5, - }, - "allow_show_password": { - Type: schema.TypeBool, - Default: false, - Optional: true, - }, - }, + ), } } diff --git a/pkg/provider/resource_stage_prompt.go b/pkg/provider/resource_stage_prompt.go index 4eb57a32..e81b44c5 100644 --- a/pkg/provider/resource_stage_prompt.go +++ b/pkg/provider/resource_stage_prompt.go @@ -19,26 +19,29 @@ func resourceStagePrompt() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - }, - "fields": { - Type: schema.TypeList, - Required: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_PROMPT_PROMPTSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, }, - }, - "validation_policies": { - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + "fields": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "validation_policies": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, }, - }, + ), } } diff --git a/pkg/provider/resource_stage_prompt_field.go b/pkg/provider/resource_stage_prompt_field.go index 5dfae886..cf8402da 100644 --- a/pkg/provider/resource_stage_prompt_field.go +++ b/pkg/provider/resource_stage_prompt_field.go @@ -19,60 +19,63 @@ func resourceStagePromptField() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_PROMPT_PROMPT, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "field_key": { + Type: schema.TypeString, + Required: true, + }, + "label": { + Type: schema.TypeString, + Required: true, + }, + "type": { + Type: schema.TypeString, + Required: true, + Description: helpers.EnumToDescription(api.AllowedPromptTypeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedPromptTypeEnumEnumValues), + }, + "required": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "placeholder": { + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: helpers.DiffSuppressExpression, + }, + "placeholder_expression": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "initial_value": { + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: helpers.DiffSuppressExpression, + }, + "initial_value_expression": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "order": { + Type: schema.TypeInt, + Optional: true, + }, + "sub_text": { + Type: schema.TypeString, + Optional: true, + Default: "", + }, }, - "field_key": { - Type: schema.TypeString, - Required: true, - }, - "label": { - Type: schema.TypeString, - Required: true, - }, - "type": { - Type: schema.TypeString, - Required: true, - Description: helpers.EnumToDescription(api.AllowedPromptTypeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedPromptTypeEnumEnumValues), - }, - "required": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "placeholder": { - Type: schema.TypeString, - Optional: true, - DiffSuppressFunc: helpers.DiffSuppressExpression, - }, - "placeholder_expression": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "initial_value": { - Type: schema.TypeString, - Optional: true, - DiffSuppressFunc: helpers.DiffSuppressExpression, - }, - "initial_value_expression": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "order": { - Type: schema.TypeInt, - Optional: true, - }, - "sub_text": { - Type: schema.TypeString, - Optional: true, - Default: "", - }, - }, + ), } } diff --git a/pkg/provider/resource_stage_redirect.go b/pkg/provider/resource_stage_redirect.go index d0b2627a..dc93b6ca 100644 --- a/pkg/provider/resource_stage_redirect.go +++ b/pkg/provider/resource_stage_redirect.go @@ -19,32 +19,35 @@ func resourceStageRedirect() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_REDIRECT_REDIRECTSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "mode": { + Type: schema.TypeString, + Optional: true, + Default: api.REDIRECTSTAGEMODEENUM_FLOW, + Description: helpers.EnumToDescription(api.AllowedRedirectStageModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedRedirectStageModeEnumEnumValues), + }, + "keep_context": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "target_static": { + Type: schema.TypeString, + Optional: true, + }, + "target_flow": { + Type: schema.TypeString, + Optional: true, + }, }, - "mode": { - Type: schema.TypeString, - Optional: true, - Default: api.REDIRECTSTAGEMODEENUM_FLOW, - Description: helpers.EnumToDescription(api.AllowedRedirectStageModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedRedirectStageModeEnumEnumValues), - }, - "keep_context": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "target_static": { - Type: schema.TypeString, - Optional: true, - }, - "target_flow": { - Type: schema.TypeString, - Optional: true, - }, - }, + ), } } diff --git a/pkg/provider/resource_stage_source.go b/pkg/provider/resource_stage_source.go index 27a7a61b..8445a472 100644 --- a/pkg/provider/resource_stage_source.go +++ b/pkg/provider/resource_stage_source.go @@ -19,23 +19,26 @@ func resourceStageSource() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_SOURCE_SOURCESTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "source": { + Type: schema.TypeString, + Optional: true, + }, + "resume_timeout": { + Type: schema.TypeString, + Optional: true, + Default: "minutes=10", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, }, - "source": { - Type: schema.TypeString, - Optional: true, - }, - "resume_timeout": { - Type: schema.TypeString, - Optional: true, - Default: "minutes=10", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, - }, + ), } } diff --git a/pkg/provider/resource_stage_user_delete.go b/pkg/provider/resource_stage_user_delete.go index 46633dc9..6f89c0cd 100644 --- a/pkg/provider/resource_stage_user_delete.go +++ b/pkg/provider/resource_stage_user_delete.go @@ -19,12 +19,15 @@ func resourceStageUserDelete() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_USER_DELETE_USERDELETESTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, }, - }, + ), } } diff --git a/pkg/provider/resource_stage_user_login.go b/pkg/provider/resource_stage_user_login.go index 7e565091..90c32fd0 100644 --- a/pkg/provider/resource_stage_user_login.go +++ b/pkg/provider/resource_stage_user_login.go @@ -19,52 +19,55 @@ func resourceStageUserLogin() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_USER_LOGIN_USERLOGINSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "session_duration": { + Type: schema.TypeString, + Optional: true, + Default: "seconds=0", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, + "remember_me_offset": { + Type: schema.TypeString, + Optional: true, + Default: "seconds=0", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, + "terminate_other_sessions": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "network_binding": { + Type: schema.TypeString, + Optional: true, + Default: api.NETWORKBINDINGENUM_NO_BINDING, + Description: helpers.EnumToDescription(api.AllowedNetworkBindingEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedNetworkBindingEnumEnumValues), + }, + "geoip_binding": { + Type: schema.TypeString, + Optional: true, + Default: api.GEOIPBINDINGENUM_NO_BINDING, + Description: helpers.EnumToDescription(api.AllowedGeoipBindingEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedGeoipBindingEnumEnumValues), + }, + "remember_device": { + Type: schema.TypeString, + Optional: true, + Default: "days=30", + Description: helpers.RelativeDurationDescription, + ValidateDiagFunc: helpers.ValidateRelativeDuration, + }, }, - "session_duration": { - Type: schema.TypeString, - Optional: true, - Default: "seconds=0", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, - "remember_me_offset": { - Type: schema.TypeString, - Optional: true, - Default: "seconds=0", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, - "terminate_other_sessions": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - "network_binding": { - Type: schema.TypeString, - Optional: true, - Default: api.NETWORKBINDINGENUM_NO_BINDING, - Description: helpers.EnumToDescription(api.AllowedNetworkBindingEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedNetworkBindingEnumEnumValues), - }, - "geoip_binding": { - Type: schema.TypeString, - Optional: true, - Default: api.GEOIPBINDINGENUM_NO_BINDING, - Description: helpers.EnumToDescription(api.AllowedGeoipBindingEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedGeoipBindingEnumEnumValues), - }, - "remember_device": { - Type: schema.TypeString, - Optional: true, - Default: "days=30", - Description: helpers.RelativeDurationDescription, - ValidateDiagFunc: helpers.ValidateRelativeDuration, - }, - }, + ), } } diff --git a/pkg/provider/resource_stage_user_logout.go b/pkg/provider/resource_stage_user_logout.go index e6d9ab02..376c8998 100644 --- a/pkg/provider/resource_stage_user_logout.go +++ b/pkg/provider/resource_stage_user_logout.go @@ -19,12 +19,15 @@ func resourceStageUserLogout() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_USER_LOGOUT_USERLOGOUTSTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, }, - }, + ), } } diff --git a/pkg/provider/resource_stage_user_write.go b/pkg/provider/resource_stage_user_write.go index a09c0cb1..b5b2390a 100644 --- a/pkg/provider/resource_stage_user_write.go +++ b/pkg/provider/resource_stage_user_write.go @@ -19,48 +19,51 @@ func resourceStageUserWrite() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, + Schema: helpers.ModelSchema( + api.MODELENUM_STAGES_USER_WRITE_USERWRITESTAGE, + map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "create_users_as_inactive": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "user_creation_mode": { + Type: schema.TypeString, + Default: api.USERCREATIONMODEENUM_CREATE_WHEN_REQUIRED, + Optional: true, + Description: helpers.EnumToDescription(api.AllowedUserCreationModeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserCreationModeEnumEnumValues), + }, + "create_users_group": { + Type: schema.TypeString, + Optional: true, + }, + "user_path_template": { + Type: schema.TypeString, + Default: "", + Optional: true, + }, + "user_type": { + Type: schema.TypeString, + Default: api.USERTYPEENUM_EXTERNAL, + Optional: true, + Description: helpers.EnumToDescription([]api.UserTypeEnum{ + api.USERTYPEENUM_INTERNAL, + api.USERTYPEENUM_EXTERNAL, + api.USERTYPEENUM_SERVICE_ACCOUNT, + }), + ValidateDiagFunc: helpers.StringInEnum([]api.UserTypeEnum{ + api.USERTYPEENUM_INTERNAL, + api.USERTYPEENUM_EXTERNAL, + api.USERTYPEENUM_SERVICE_ACCOUNT, + }), + }, }, - "create_users_as_inactive": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "user_creation_mode": { - Type: schema.TypeString, - Default: api.USERCREATIONMODEENUM_CREATE_WHEN_REQUIRED, - Optional: true, - Description: helpers.EnumToDescription(api.AllowedUserCreationModeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserCreationModeEnumEnumValues), - }, - "create_users_group": { - Type: schema.TypeString, - Optional: true, - }, - "user_path_template": { - Type: schema.TypeString, - Default: "", - Optional: true, - }, - "user_type": { - Type: schema.TypeString, - Default: api.USERTYPEENUM_EXTERNAL, - Optional: true, - Description: helpers.EnumToDescription([]api.UserTypeEnum{ - api.USERTYPEENUM_INTERNAL, - api.USERTYPEENUM_EXTERNAL, - api.USERTYPEENUM_SERVICE_ACCOUNT, - }), - ValidateDiagFunc: helpers.StringInEnum([]api.UserTypeEnum{ - api.USERTYPEENUM_INTERNAL, - api.USERTYPEENUM_EXTERNAL, - api.USERTYPEENUM_SERVICE_ACCOUNT, - }), - }, - }, + ), } } diff --git a/pkg/provider/resource_token.go b/pkg/provider/resource_token.go index 16e0ff94..27e64dd0 100644 --- a/pkg/provider/resource_token.go +++ b/pkg/provider/resource_token.go @@ -20,53 +20,56 @@ func resourceToken() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - // Computed - "key": { - Type: schema.TypeString, - Sensitive: true, - Computed: true, + Schema: helpers.ModelSchema( + api.MODELENUM_CORE_TOKEN, + map[string]*schema.Schema{ + // Computed + "key": { + Type: schema.TypeString, + Sensitive: true, + Computed: true, + }, + "expires_in": { + Type: schema.TypeInt, + Computed: true, + }, + // Meta + "retrieve_key": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + // Actual + "identifier": { + Type: schema.TypeString, + Required: true, + }, + "user": { + Type: schema.TypeInt, + Required: true, + }, + "intent": { + Type: schema.TypeString, + Optional: true, + Default: api.INTENTENUM_API, + Description: helpers.EnumToDescription(api.AllowedIntentEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedIntentEnumEnumValues), + }, + "expires": { + Type: schema.TypeString, + Optional: true, + }, + "expiring": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "description": { + Type: schema.TypeString, + Optional: true, + }, }, - "expires_in": { - Type: schema.TypeInt, - Computed: true, - }, - // Meta - "retrieve_key": { - Type: schema.TypeBool, - Optional: true, - Default: false, - }, - // Actual - "identifier": { - Type: schema.TypeString, - Required: true, - }, - "user": { - Type: schema.TypeInt, - Required: true, - }, - "intent": { - Type: schema.TypeString, - Optional: true, - Default: api.INTENTENUM_API, - Description: helpers.EnumToDescription(api.AllowedIntentEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedIntentEnumEnumValues), - }, - "expires": { - Type: schema.TypeString, - Optional: true, - }, - "expiring": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "description": { - Type: schema.TypeString, - Optional: true, - }, - }, + ), } } diff --git a/pkg/provider/resource_user.go b/pkg/provider/resource_user.go index 2d110266..a29d9962 100644 --- a/pkg/provider/resource_user.go +++ b/pkg/provider/resource_user.go @@ -20,60 +20,63 @@ func resourceUser() *schema.Resource { Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "username": { - Type: schema.TypeString, - Required: true, - }, - "name": { - Type: schema.TypeString, - Default: "", - Optional: true, - }, - "type": { - Type: schema.TypeString, - Default: api.USERTYPEENUM_INTERNAL, - Optional: true, - Description: helpers.EnumToDescription(api.AllowedUserTypeEnumEnumValues), - ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserTypeEnumEnumValues), - }, - "password": { - Type: schema.TypeString, - Optional: true, - Sensitive: true, - Description: `Optionally set the user's password. Changing the password in authentik will not trigger an update here.`, - }, - "is_active": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "email": { - Type: schema.TypeString, - Optional: true, - }, - "path": { - Type: schema.TypeString, - Default: "users", - Optional: true, - }, - "groups": { - Type: schema.TypeList, - Optional: true, - Computed: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + Schema: helpers.ModelSchema( + api.MODELENUM_CORE_USER, + map[string]*schema.Schema{ + "username": { + Type: schema.TypeString, + Required: true, + }, + "name": { + Type: schema.TypeString, + Default: "", + Optional: true, + }, + "type": { + Type: schema.TypeString, + Default: api.USERTYPEENUM_INTERNAL, + Optional: true, + Description: helpers.EnumToDescription(api.AllowedUserTypeEnumEnumValues), + ValidateDiagFunc: helpers.StringInEnum(api.AllowedUserTypeEnumEnumValues), + }, + "password": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + Description: `Optionally set the user's password. Changing the password in authentik will not trigger an update here.`, + }, + "is_active": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "email": { + Type: schema.TypeString, + Optional: true, + }, + "path": { + Type: schema.TypeString, + Default: "users", + Optional: true, + }, + "groups": { + Type: schema.TypeList, + Optional: true, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "attributes": { + Type: schema.TypeString, + Optional: true, + Default: "{}", + Description: helpers.JSONDescription, + DiffSuppressFunc: helpers.DiffSuppressJSON, + ValidateDiagFunc: helpers.ValidateJSON, }, }, - "attributes": { - Type: schema.TypeString, - Optional: true, - Default: "{}", - Description: helpers.JSONDescription, - DiffSuppressFunc: helpers.DiffSuppressJSON, - ValidateDiagFunc: helpers.ValidateJSON, - }, - }, + ), } }