Skip to content

Commit

Permalink
Update docs and examples (#1143)
Browse files Browse the repository at this point in the history
* Uodate docs and examples

* Updated docs

* Updated docs

* Updated docs for is_first_party

---------

Co-authored-by: Rajat Bajaj <rajat.bajaj@okta.com>
  • Loading branch information
ramya18101 and duedares-rvj authored Feb 28, 2025
1 parent 08143bf commit 43c35ed
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/data-sources/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ data "auth0_client" "some-client-by-id" {
- `grant_types` (List of String) Types of grants that this client is authorized to use.
- `id` (String) The ID of this resource.
- `initiate_login_uri` (String) Initiate login URI. Must be HTTPS or an empty string.
- `is_first_party` (Boolean) Indicates whether this client is a first-party client.
- `is_first_party` (Boolean) Indicates whether this client is a first-party client.Defaults to true from the API
- `is_token_endpoint_ip_header_trusted` (Boolean) Indicates whether the token endpoint IP header is trusted. Requires the authentication method to be set to `client_secret_post` or `client_secret_basic`. Setting this property when creating the resource, will default the authentication method to `client_secret_post`. To change the authentication method to `client_secret_basic` use the `auth0_client_credentials` resource.
- `jwt_configuration` (List of Object) Configuration settings for the JWTs issued for this client. (see [below for nested schema](#nestedatt--jwt_configuration))
- `logo_uri` (String) URL of the logo for the client. Recommended size is 150px x 150px. If none is set, the default badge for the application type will be shown.
Expand Down
6 changes: 6 additions & 0 deletions docs/resources/action.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ description: |-

Actions are secure, tenant-specific, versioned functions written in Node.js that execute at certain points during the Auth0 runtime. Actions are used to customize and extend Auth0's capabilities with custom logic.

-> An action bound to a trigger cannot be deleted. To destroy such an action, the trigger binding must first be deleted.
A binding is usually managed by [auth0_trigger_action](https://registry.terraform.io/providers/auth0/auth0/latest/docs/resources/trigger_action) resource.
The provider also supports a 1:many variant [auth0_trigger_actions](https://registry.terraform.io/providers/auth0/auth0/latest/docs/resources/trigger_actions).
If by any means, a binding is missing is the state file, it can be imported to the state and deleted, before attempting to delete the action.


## Example Usage

```terraform
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ resource "auth0_client" "my_client" {
- `form_template` (String) HTML form template to be used for WS-Federation.
- `grant_types` (List of String) Types of grants that this client is authorized to use.
- `initiate_login_uri` (String) Initiate login URI. Must be HTTPS or an empty string.
- `is_first_party` (Boolean) Indicates whether this client is a first-party client.
- `is_first_party` (Boolean) Indicates whether this client is a first-party client.Defaults to true from the API
- `is_token_endpoint_ip_header_trusted` (Boolean) Indicates whether the token endpoint IP header is trusted. Requires the authentication method to be set to `client_secret_post` or `client_secret_basic`. Setting this property when creating the resource, will default the authentication method to `client_secret_post`. To change the authentication method to `client_secret_basic` use the `auth0_client_credentials` resource.
- `jwt_configuration` (Block List, Max: 1) Configuration settings for the JWTs issued for this client. (see [below for nested schema](#nestedblock--jwt_configuration))
- `logo_uri` (String) URL of the logo for the client. Recommended size is 150px x 150px. If none is set, the default badge for the application type will be shown.
Expand Down
34 changes: 31 additions & 3 deletions docs/resources/email_provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ description: |-

With Auth0, you can have standard welcome, password reset, and account verification email-based workflows built right into Auth0. This resource allows you to configure email providers, so you can route all emails that are part of Auth0's authentication workflows through the supported high-volume email service of your choice.

-> For configuring a custom email provider, an action with supported triggers custom-email-provider must exist.


## Example Usage

```terraform
Expand Down Expand Up @@ -75,10 +78,35 @@ resource "auth0_email_provider" "ms365_email_provider" {
}
}
# This is an example on how to set up the email provider with a custom action.
# Make sure a corresponding action exists with custom-email-provider as supported triggers
# Below is an example of how to set up a custom email provider.
# The action with custom-email-provider as supported_triggers is a prerequisite.
resource "auth0_action" "custom_email_provider_action" {
name = "custom-email-provider-action"
runtime = "node18"
deploy = true
code = <<-EOT
/**
* Handler to be executed while sending an email notification.
*
* @param {Event} event - Details about the user and the context in which they are logging in.
* @param {CustomEmailProviderAPI} api - Methods and utilities to help change the behavior of sending a email notification.
*/
exports.onExecuteCustomEmailProvider = async (event, api) => {
// Code goes here
console.log(event);
return;
};
EOT
supported_triggers {
id = "custom-email-provider"
version = "v1"
}
}
resource "auth0_email_provider" "custom_email_provider" {
name = "custom"
depends_on = [auth0_action.custom_email_provider_action] # Ensuring the action is created first with `custom-email-provider` as the supported_triggers
name = "custom" # Indicates a custom implementation
enabled = true
default_from_address = "accounts@example.com"
credentials {}
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/trigger_action.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ resource "auth0_trigger_action" "post_login_alert_action" {
### Required

- `action_id` (String) The ID of the action to bind to the trigger.
- `trigger` (String) The ID of the trigger to bind with. Available options: `post-login`, `credentials-exchange`, `pre-user-registration`, `post-user-registration`, `post-change-password`, `send-phone-message`, `password-reset-post-challenge`, `custom-token-exchange`, `custom-email-provider`.
- `trigger` (String) The ID of the trigger to bind with. Available options: `post-login`, `credentials-exchange`, `pre-user-registration`, `post-user-registration`, `post-change-password`, `send-phone-message`, `password-reset-post-challenge`, `custom-email-provider`.

### Optional

Expand Down
31 changes: 28 additions & 3 deletions examples/resources/auth0_email_provider/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,35 @@ resource "auth0_email_provider" "ms365_email_provider" {
}
}

# This is an example on how to set up the email provider with a custom action.
# Make sure a corresponding action exists with custom-email-provider as supported triggers
# Below is an example of how to set up a custom email provider.
# The action with custom-email-provider as supported_triggers is a prerequisite.
resource "auth0_action" "custom_email_provider_action" {
name = "custom-email-provider-action"
runtime = "node18"
deploy = true
code = <<-EOT
/**
* Handler to be executed while sending an email notification.
*
* @param {Event} event - Details about the user and the context in which they are logging in.
* @param {CustomEmailProviderAPI} api - Methods and utilities to help change the behavior of sending a email notification.
*/
exports.onExecuteCustomEmailProvider = async (event, api) => {
// Code goes here
console.log(event);
return;
};
EOT

supported_triggers {
id = "custom-email-provider"
version = "v1"
}
}

resource "auth0_email_provider" "custom_email_provider" {
name = "custom"
depends_on = [auth0_action.custom_email_provider_action] # Ensuring the action is created first with `custom-email-provider` as the supported_triggers
name = "custom" # Indicates a custom implementation
enabled = true
default_from_address = "accounts@example.com"
credentials {}
Expand Down
3 changes: 1 addition & 2 deletions internal/auth0/action/resource_trigger_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ func NewTriggerActionResource() *schema.Resource {
"post-change-password",
"send-phone-message",
"password-reset-post-challenge",
"custom-token-exchange",
"custom-email-provider",
}, false),
Description: "The ID of the trigger to bind with. Available options: `post-login`, `credentials-exchange`, `pre-user-registration`, `post-user-registration`, `post-change-password`, `send-phone-message`, `password-reset-post-challenge`, `custom-token-exchange`, `custom-email-provider`.",
Description: "The ID of the trigger to bind with. Available options: `post-login`, `credentials-exchange`, `pre-user-registration`, `post-user-registration`, `post-change-password`, `send-phone-message`, `password-reset-post-challenge`, `custom-email-provider`.",
},
"action_id": {
Type: schema.TypeString,
Expand Down
9 changes: 5 additions & 4 deletions internal/auth0/client/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ func NewResource() *schema.Resource {
"If none is set, the default badge for the application type will be shown.",
},
"is_first_party": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
Description: "Indicates whether this client is a first-party client.",
Type: schema.TypeBool,
Optional: true,
Computed: true,
Description: "Indicates whether this client is a first-party client." +
"Defaults to true from the API",
},
"is_token_endpoint_ip_header_trusted": {
Type: schema.TypeBool,
Expand Down
6 changes: 6 additions & 0 deletions templates/resources/action.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ description: |-

{{ .Description | trimspace }}

-> An action bound to a trigger cannot be deleted. To destroy such an action, the trigger binding must first be deleted.
A binding is usually managed by [auth0_trigger_action](https://registry.terraform.io/providers/auth0/auth0/latest/docs/resources/trigger_action) resource.
The provider also supports a 1:many variant [auth0_trigger_actions](https://registry.terraform.io/providers/auth0/auth0/latest/docs/resources/trigger_actions).
If by any means, a binding is missing is the state file, it can be imported to the state and deleted, before attempting to delete the action.


{{ if .HasExample -}}

## Example Usage
Expand Down
32 changes: 32 additions & 0 deletions templates/resources/email_provider.md.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
page_title: "{{.Type}}: {{.Name}}"
description: |-
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
---

# {{.Type}}: {{.Name}}

{{ .Description | trimspace }}

-> For configuring a custom email provider, an action with supported triggers custom-email-provider must exist.


{{ if .HasExample -}}

## Example Usage

{{ tffile .ExampleFile }}

{{- end }}

{{ .SchemaMarkdown | trimspace }}

{{ if .HasImport -}}

## Import

Import is supported using the following syntax:

{{ codefile "shell" .ImportFile }}

{{- end }}

0 comments on commit 43c35ed

Please sign in to comment.