-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
2,209 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
--- | ||
page_title: "Resource: auth0_pages" | ||
description: |- | ||
With this resource you can manage custom HTML for the Login, Reset Password, Multi-Factor Authentication and Error pages. | ||
--- | ||
|
||
# Resource: auth0_pages | ||
|
||
With this resource you can manage custom HTML for the Login, Reset Password, Multi-Factor Authentication and Error pages. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "auth0_pages" "my_pages" { | ||
login { | ||
enabled = true | ||
html = "<html><body>My Custom Login Page</body></html>" | ||
} | ||
change_password { | ||
enabled = true | ||
html = "<html><body>My Custom Reset Password Page</body></html>" | ||
} | ||
guardian_mfa { | ||
enabled = true | ||
html = "<html><body>My Custom MFA Page</body></html>" | ||
} | ||
error { | ||
show_log_link = true | ||
html = "<html><body>My Custom Error Page</body></html>" | ||
url = "https://example.com" | ||
} | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Optional | ||
|
||
- `change_password` (Block List, Max: 1) Configuration settings for customizing the Password Reset page. (see [below for nested schema](#nestedblock--change_password)) | ||
- `error` (Block List, Max: 1) Configuration settings for the Error pages. (see [below for nested schema](#nestedblock--error)) | ||
- `guardian_mfa` (Block List, Max: 1) Configuration settings for customizing the Guardian Multi-Factor Authentication page. (see [below for nested schema](#nestedblock--guardian_mfa)) | ||
- `login` (Block List, Max: 1) Configuration settings for customizing the Login page. (see [below for nested schema](#nestedblock--login)) | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
|
||
<a id="nestedblock--change_password"></a> | ||
### Nested Schema for `change_password` | ||
|
||
Required: | ||
|
||
- `enabled` (Boolean) Indicates whether to use the custom Reset Password HTML (`true`) or the default Auth0 page (`false`). Defaults to `false`. | ||
- `html` (String) Customized content for the Reset Password page. HTML format with supported [Liquid syntax](https://github.com/Shopify/liquid/wiki/Liquid-for-Designers). | ||
|
||
|
||
<a id="nestedblock--error"></a> | ||
### Nested Schema for `error` | ||
|
||
Required: | ||
|
||
- `html` (String) Customized content for the Error page. HTML format with supported [Liquid syntax](https://github.com/Shopify/liquid/wiki/Liquid-for-Designers). | ||
- `show_log_link` (Boolean) Indicates whether to show the link to logs as part of the default error page. Defaults to `true`. | ||
|
||
Optional: | ||
|
||
- `url` (String) URL to redirect to when an error occurs, instead of showing the default error page. | ||
|
||
|
||
<a id="nestedblock--guardian_mfa"></a> | ||
### Nested Schema for `guardian_mfa` | ||
|
||
Required: | ||
|
||
- `enabled` (Boolean) Indicates whether to use the custom Guardian MFA HTML (`true`) or the default Auth0 page (`false`). Defaults to `false`. | ||
- `html` (String) Customized content for the Guardian MFA page. HTML format with supported [Liquid syntax](https://github.com/Shopify/liquid/wiki/Liquid-for-Designers). | ||
|
||
|
||
<a id="nestedblock--login"></a> | ||
### Nested Schema for `login` | ||
|
||
Required: | ||
|
||
- `enabled` (Boolean) Indicates whether to use the custom Login page HTML (`true`) or the default Auth0 page (`false`). Defaults to `false`. | ||
- `html` (String) Customized content for the Login page. HTML format with supported [Liquid syntax](https://github.com/Shopify/liquid/wiki/Liquid-for-Designers). | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
```shell | ||
# As this is not a resource identifiable by an ID within the Auth0 Management API, | ||
# pages can be imported using a random string. | ||
# | ||
# We recommend [Version 4 UUID](https://www.uuidgenerator.net/version4) | ||
# | ||
# Example: | ||
terraform import auth0_pages.my_pages 22f4f21b-017a-319d-92e7-2291c1ca36c4 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# As this is not a resource identifiable by an ID within the Auth0 Management API, | ||
# pages can be imported using a random string. | ||
# | ||
# We recommend [Version 4 UUID](https://www.uuidgenerator.net/version4) | ||
# | ||
# Example: | ||
terraform import auth0_pages.my_pages 22f4f21b-017a-319d-92e7-2291c1ca36c4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
resource "auth0_pages" "my_pages" { | ||
login { | ||
enabled = true | ||
html = "<html><body>My Custom Login Page</body></html>" | ||
} | ||
|
||
change_password { | ||
enabled = true | ||
html = "<html><body>My Custom Reset Password Page</body></html>" | ||
} | ||
|
||
guardian_mfa { | ||
enabled = true | ||
html = "<html><body>My Custom MFA Page</body></html>" | ||
} | ||
|
||
error { | ||
show_log_link = true | ||
html = "<html><body>My Custom Error Page</body></html>" | ||
url = "https://example.com" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package page | ||
|
||
import ( | ||
"github.com/auth0/go-auth0/management" | ||
"github.com/hashicorp/go-cty/cty" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
|
||
"github.com/auth0/terraform-provider-auth0/internal/auth0/tenant" | ||
"github.com/auth0/terraform-provider-auth0/internal/value" | ||
) | ||
|
||
func expandLoginPage(data *schema.ResourceData) *management.Client { | ||
if !data.HasChange("login") { | ||
return nil | ||
} | ||
|
||
var clientWithLoginPage *management.Client | ||
|
||
data.GetRawConfig().GetAttr("login").ForEachElement(func(_ cty.Value, cfg cty.Value) (stop bool) { | ||
clientWithLoginPage = &management.Client{ | ||
CustomLoginPageOn: value.Bool(cfg.GetAttr("enabled")), | ||
CustomLoginPage: value.String(cfg.GetAttr("html")), | ||
} | ||
|
||
return stop | ||
}) | ||
|
||
return clientWithLoginPage | ||
} | ||
|
||
func expandTenantPages(cfg cty.Value) *management.Tenant { | ||
tenantPages := &management.Tenant{ | ||
ChangePassword: tenant.ExpandTenantChangePassword(cfg.GetAttr("change_password")), | ||
GuardianMFAPage: tenant.ExpandTenantGuardianMFAPage(cfg.GetAttr("guardian_mfa")), | ||
ErrorPage: tenant.ExpandTenantErrorPage(cfg.GetAttr("error")), | ||
} | ||
|
||
if tenantPages.String() == "{}" { | ||
return nil | ||
} | ||
|
||
return tenantPages | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package page | ||
|
||
import ( | ||
"github.com/auth0/go-auth0/management" | ||
) | ||
|
||
func flattenLoginPage(clientWithLoginPage *management.Client) []interface{} { | ||
return []interface{}{ | ||
map[string]interface{}{ | ||
"enabled": clientWithLoginPage.GetCustomLoginPageOn(), | ||
"html": clientWithLoginPage.GetCustomLoginPage(), | ||
}, | ||
} | ||
} |
Oops, something went wrong.