From fa1dc133dddbcb939ea91e6d0454c4646c7dad12 Mon Sep 17 00:00:00 2001 From: Will Vedder Date: Thu, 13 Jul 2023 11:15:51 -0400 Subject: [PATCH] DXCDT-450: Remove deprecated tenant universal login fields (#712) Removing references to deprecated universal login fields in auth0_tenant resource Co-authored-by: Will Vedder Co-authored-by: Sergiu Ghitea <28300158+sergiught@users.noreply.github.com> --- docs/data-sources/tenant.md | 18 --------- docs/resources/tenant.md | 26 ------------- examples/resources/auth0_tenant/resource.tf | 8 ---- internal/auth0/tenant/data_source_test.go | 11 ------ internal/auth0/tenant/expand.go | 25 ------------ internal/auth0/tenant/flatten.go | 20 ---------- internal/auth0/tenant/resource.go | 43 --------------------- internal/auth0/tenant/resource_test.go | 19 --------- 8 files changed, 170 deletions(-) diff --git a/docs/data-sources/tenant.md b/docs/data-sources/tenant.md index 35154ded3..1bcb8f6b6 100644 --- a/docs/data-sources/tenant.md +++ b/docs/data-sources/tenant.md @@ -36,7 +36,6 @@ data "auth0_tenant" "my_tenant" {} - `session_lifetime` (Number) Number of hours during which a session will stay valid. - `support_email` (String) Support email address for authenticating users. - `support_url` (String) Support URL for authenticating users. -- `universal_login` (List of Object) Configuration settings for Universal Login. These configuration settings have been deprecated. Migrate to managing these settings through the `auth0_branding` resource. Check the [MIGRATION_GUIDE](https://github.com/auth0/terraform-provider-auth0/blob/main/MIGRATION_GUIDE.md#tenant-universal-login) for more info. (see [below for nested schema](#nestedatt--universal_login)) ### Nested Schema for `flags` @@ -64,7 +63,6 @@ Read-Only: - `mfa_show_factor_list_on_enrollment` (Boolean) - `no_disclose_enterprise_connections` (Boolean) - `revoke_refresh_token_grant` (Boolean) -- `universal_login` (Boolean) - `use_scope_descriptions_for_consent` (Boolean) @@ -76,19 +74,3 @@ Read-Only: - `mode` (String) - -### Nested Schema for `universal_login` - -Read-Only: - -- `colors` (List of Object) (see [below for nested schema](#nestedobjatt--universal_login--colors)) - - -### Nested Schema for `universal_login.colors` - -Read-Only: - -- `page_background` (String) -- `primary` (String) - - diff --git a/docs/resources/tenant.md b/docs/resources/tenant.md index a7d44271a..65e21bd8d 100644 --- a/docs/resources/tenant.md +++ b/docs/resources/tenant.md @@ -28,15 +28,7 @@ resource "auth0_tenant" "my_tenant" { mode = "non-persistent" } - universal_login { - colors { - primary = "#0059d6" - page_background = "#000000" - } - } - flags { - universal_login = true disable_clickjack_protection_headers = true enable_public_signup_user_exists_error = true use_scope_descriptions_for_consent = true @@ -66,7 +58,6 @@ resource "auth0_tenant" "my_tenant" { - `session_lifetime` (Number) Number of hours during which a session will stay valid. - `support_email` (String) Support email address for authenticating users. - `support_url` (String) Support URL for authenticating users. -- `universal_login` (Block List, Max: 1, Deprecated) Configuration settings for Universal Login. These configuration settings have been deprecated. Migrate to managing these settings through the `auth0_branding` resource. Check the [MIGRATION_GUIDE](https://github.com/auth0/terraform-provider-auth0/blob/main/MIGRATION_GUIDE.md#tenant-universal-login) for more info. (see [below for nested schema](#nestedblock--universal_login)) ### Read-Only @@ -98,7 +89,6 @@ Optional: - `mfa_show_factor_list_on_enrollment` (Boolean) Used to allow users to pick which factor to enroll with from the list of available MFA factors. - `no_disclose_enterprise_connections` (Boolean) Do not Publish Enterprise Connections Information with IdP domains on the lock configuration file. - `revoke_refresh_token_grant` (Boolean) Delete underlying grant when a refresh token is revoked via the Authentication API. -- `universal_login` (Boolean, Deprecated) Indicates whether the New Universal Login Experience is enabled. - `use_scope_descriptions_for_consent` (Boolean) Indicates whether to use scope descriptions for consent. @@ -109,22 +99,6 @@ Optional: - `mode` (String) Behavior of tenant session cookie. Accepts either "persistent" or "non-persistent". - - -### Nested Schema for `universal_login` - -Optional: - -- `colors` (Block List, Max: 1) Configuration settings for Universal Login colors. (see [below for nested schema](#nestedblock--universal_login--colors)) - - -### Nested Schema for `universal_login.colors` - -Optional: - -- `page_background` (String) Background color of login pages in hexadecimal. -- `primary` (String) Primary button background color in hexadecimal. - ## Import Import is supported using the following syntax: diff --git a/examples/resources/auth0_tenant/resource.tf b/examples/resources/auth0_tenant/resource.tf index 571863131..ca871462c 100644 --- a/examples/resources/auth0_tenant/resource.tf +++ b/examples/resources/auth0_tenant/resource.tf @@ -12,15 +12,7 @@ resource "auth0_tenant" "my_tenant" { mode = "non-persistent" } - universal_login { - colors { - primary = "#0059d6" - page_background = "#000000" - } - } - flags { - universal_login = true disable_clickjack_protection_headers = true enable_public_signup_user_exists_error = true use_scope_descriptions_for_consent = true diff --git a/internal/auth0/tenant/data_source_test.go b/internal/auth0/tenant/data_source_test.go index 3dffb37d1..8caed7a37 100644 --- a/internal/auth0/tenant/data_source_test.go +++ b/internal/auth0/tenant/data_source_test.go @@ -26,7 +26,6 @@ resource "auth0_tenant" "my_tenant" { enabled_locales = ["en", "de", "fr"] flags { - universal_login = true disable_clickjack_protection_headers = true enable_public_signup_user_exists_error = true use_scope_descriptions_for_consent = true @@ -35,13 +34,6 @@ resource "auth0_tenant" "my_tenant" { disable_fields_map_fix = false } - universal_login { - colors { - primary = "#0059d6" - page_background = "#000000" - } - } - session_cookie { mode = "non-persistent" } @@ -73,12 +65,9 @@ func TestAccDataSourceTenant(t *testing.T) { resource.TestCheckResourceAttr("data.auth0_tenant.current", "enabled_locales.0", "en"), resource.TestCheckResourceAttr("data.auth0_tenant.current", "enabled_locales.1", "de"), resource.TestCheckResourceAttr("data.auth0_tenant.current", "enabled_locales.2", "fr"), - resource.TestCheckResourceAttr("data.auth0_tenant.current", "flags.0.universal_login", "true"), resource.TestCheckResourceAttr("data.auth0_tenant.current", "flags.0.disable_clickjack_protection_headers", "true"), resource.TestCheckResourceAttr("data.auth0_tenant.current", "flags.0.enable_public_signup_user_exists_error", "true"), resource.TestCheckResourceAttr("data.auth0_tenant.current", "flags.0.use_scope_descriptions_for_consent", "true"), - resource.TestCheckResourceAttr("data.auth0_tenant.current", "universal_login.0.colors.0.primary", "#0059d6"), - resource.TestCheckResourceAttr("data.auth0_tenant.current", "universal_login.0.colors.0.page_background", "#000000"), resource.TestCheckResourceAttr("data.auth0_tenant.current", "default_redirection_uri", "https://example.com/login"), resource.TestCheckResourceAttr("data.auth0_tenant.current", "session_cookie.0.mode", "non-persistent"), ), diff --git a/internal/auth0/tenant/expand.go b/internal/auth0/tenant/expand.go index 4921a99ed..2a40ba488 100644 --- a/internal/auth0/tenant/expand.go +++ b/internal/auth0/tenant/expand.go @@ -27,7 +27,6 @@ func expandTenant(d *schema.ResourceData) *management.Tenant { SandboxVersion: value.String(config.GetAttr("sandbox_version")), EnabledLocales: value.Strings(config.GetAttr("enabled_locales")), Flags: expandTenantFlags(config.GetAttr("flags")), - UniversalLogin: expandTenantUniversalLogin(config.GetAttr("universal_login")), SessionCookie: expandTenantSessionCookie(config.GetAttr("session_cookie")), } @@ -48,7 +47,6 @@ func expandTenantFlags(config cty.Value) *management.TenantFlags { EnablePipeline2: value.Bool(flags.GetAttr("enable_pipeline2")), EnableDynamicClientRegistration: value.Bool(flags.GetAttr("enable_dynamic_client_registration")), EnableCustomDomainInEmails: value.Bool(flags.GetAttr("enable_custom_domain_in_emails")), - UniversalLogin: value.Bool(flags.GetAttr("universal_login")), EnableLegacyLogsSearchV2: value.Bool(flags.GetAttr("enable_legacy_logs_search_v2")), DisableClickjackProtectionHeaders: value.Bool(flags.GetAttr("disable_clickjack_protection_headers")), EnablePublicSignupUserExistsError: value.Bool(flags.GetAttr("enable_public_signup_user_exists_error")), @@ -74,29 +72,6 @@ func expandTenantFlags(config cty.Value) *management.TenantFlags { return tenantFlags } -func expandTenantUniversalLogin(config cty.Value) *management.TenantUniversalLogin { - var universalLogin management.TenantUniversalLogin - - config.ForEachElement(func(_ cty.Value, d cty.Value) (stop bool) { - colors := d.GetAttr("colors") - - colors.ForEachElement(func(_ cty.Value, color cty.Value) (stop bool) { - universalLogin.Colors = &management.TenantUniversalLoginColors{ - Primary: value.String(color.GetAttr("primary")), - PageBackground: value.String(color.GetAttr("page_background")), - } - return stop - }) - return stop - }) - - if universalLogin == (management.TenantUniversalLogin{}) { - return nil - } - - return &universalLogin -} - func expandTenantSessionCookie(config cty.Value) *management.TenantSessionCookie { var sessionCookie management.TenantSessionCookie diff --git a/internal/auth0/tenant/flatten.go b/internal/auth0/tenant/flatten.go index a8113d7e7..e02c9e52c 100644 --- a/internal/auth0/tenant/flatten.go +++ b/internal/auth0/tenant/flatten.go @@ -15,7 +15,6 @@ func flattenTenantFlags(flags *management.TenantFlags) []interface{} { m["enable_pipeline2"] = flags.EnablePipeline2 m["enable_dynamic_client_registration"] = flags.EnableDynamicClientRegistration m["enable_custom_domain_in_emails"] = flags.EnableCustomDomainInEmails - m["universal_login"] = flags.UniversalLogin m["enable_legacy_logs_search_v2"] = flags.EnableLegacyLogsSearchV2 m["disable_clickjack_protection_headers"] = flags.DisableClickjackProtectionHeaders m["enable_public_signup_user_exists_error"] = flags.EnablePublicSignupUserExistsError @@ -37,25 +36,6 @@ func flattenTenantFlags(flags *management.TenantFlags) []interface{} { return []interface{}{m} } -func flattenTenantUniversalLogin(universalLogin *management.TenantUniversalLogin) []interface{} { - if universalLogin == nil { - return nil - } - if universalLogin.Colors == nil { - return nil - } - - m := make(map[string]interface{}) - m["colors"] = []interface{}{ - map[string]interface{}{ - "primary": universalLogin.Colors.Primary, - "page_background": universalLogin.Colors.PageBackground, - }, - } - - return []interface{}{m} -} - func flattenTenantSessionCookie(sessionCookie *management.TenantSessionCookie) []interface{} { m := make(map[string]interface{}) m["mode"] = sessionCookie.GetMode() diff --git a/internal/auth0/tenant/resource.go b/internal/auth0/tenant/resource.go index ca038f162..55e18cc6e 100644 --- a/internal/auth0/tenant/resource.go +++ b/internal/auth0/tenant/resource.go @@ -142,14 +142,6 @@ func NewResource() *schema.Resource { Computed: true, Description: "Indicates whether the tenant allows custom domains in emails.", }, - "universal_login": { - Type: schema.TypeBool, - Optional: true, - Computed: true, - Deprecated: "This attribute is deprecated. Use the `universal_login_experience` attribute" + - " on the `auth0_prompt` resource to toggle the new or classic experience instead.", - Description: "Indicates whether the New Universal Login Experience is enabled.", - }, "enable_legacy_logs_search_v2": { Type: schema.TypeBool, Optional: true, @@ -255,40 +247,6 @@ func NewResource() *schema.Resource { }, }, }, - "universal_login": { - Type: schema.TypeList, - Optional: true, - Computed: true, - MaxItems: 1, - Description: "Configuration settings for Universal Login. These configuration settings have been deprecated. Migrate to managing these settings through the `auth0_branding` resource. Check the [MIGRATION_GUIDE](https://github.com/auth0/terraform-provider-auth0/blob/main/MIGRATION_GUIDE.md#tenant-universal-login) for more info.", - Deprecated: "These configuration settings have been deprecated. Migrate to managing these settings through the `auth0_branding` resource. Check the [MIGRATION_GUIDE](https://github.com/auth0/terraform-provider-auth0/blob/main/MIGRATION_GUIDE.md#tenant-universal-login) for more info.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "colors": { - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Description: "Configuration settings for Universal Login colors.", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "primary": { - Type: schema.TypeString, - Optional: true, - Computed: true, - Description: "Primary button background color in hexadecimal.", - }, - "page_background": { - Type: schema.TypeString, - Optional: true, - Computed: true, - Description: "Background color of login pages in hexadecimal.", - }, - }, - }, - }, - }, - }, - }, "default_redirection_uri": { Type: schema.TypeString, Optional: true, @@ -352,7 +310,6 @@ func readTenant(ctx context.Context, d *schema.ResourceData, m interface{}) diag d.Set("sandbox_version", tenant.GetSandboxVersion()), d.Set("enabled_locales", tenant.GetEnabledLocales()), d.Set("flags", flattenTenantFlags(tenant.GetFlags())), - d.Set("universal_login", flattenTenantUniversalLogin(tenant.GetUniversalLogin())), d.Set("session_cookie", flattenTenantSessionCookie(tenant.GetSessionCookie())), ) diff --git a/internal/auth0/tenant/resource_test.go b/internal/auth0/tenant/resource_test.go index c952a00cc..78c315769 100644 --- a/internal/auth0/tenant/resource_test.go +++ b/internal/auth0/tenant/resource_test.go @@ -37,13 +37,10 @@ func TestAccTenant(t *testing.T) { resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "enabled_locales.1", "de"), resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "enabled_locales.2", "fr"), resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.#", "1"), - resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.0.universal_login", "true"), resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.0.disable_clickjack_protection_headers", "true"), resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.0.enable_public_signup_user_exists_error", "true"), resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.0.use_scope_descriptions_for_consent", "true"), resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.0.mfa_show_factor_list_on_enrollment", "false"), - resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "universal_login.0.colors.0.primary", "#0059d6"), - resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "universal_login.0.colors.0.page_background", "#000000"), resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "default_redirection_uri", "https://example.com/login"), resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "session_cookie.0.mode", "non-persistent"), ), @@ -96,7 +93,6 @@ resource "auth0_tenant" "my_tenant" { enabled_locales = ["en", "de", "fr"] flags { - universal_login = true disable_clickjack_protection_headers = true enable_public_signup_user_exists_error = true use_scope_descriptions_for_consent = true @@ -106,13 +102,6 @@ resource "auth0_tenant" "my_tenant" { mfa_show_factor_list_on_enrollment = false } - universal_login { - colors { - primary = "#0059d6" - page_background = "#000000" - } - } - session_cookie { mode = "non-persistent" } @@ -134,7 +123,6 @@ resource "auth0_tenant" "my_tenant" { enabled_locales = ["de", "fr"] flags { - universal_login = true enable_public_signup_user_exists_error = true disable_clickjack_protection_headers = false # <---- disable and test use_scope_descriptions_for_consent = false @@ -144,13 +132,6 @@ resource "auth0_tenant" "my_tenant" { mfa_show_factor_list_on_enrollment = true } - universal_login { - colors { - primary = "#0059d6" - page_background = "#000000" - } - } - session_cookie { mode = "persistent" }