Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions docs/data-sources/branding_phone_notification_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
page_title: "Data Source: auth0_branding_phone_notification_template"
description: |-
Data source to retrieve a specific Auth0 Phone Notification Template by template_id.
---

# Data Source: auth0_branding_phone_notification_template

Data source to retrieve a specific Auth0 Phone Notification Template by `template_id`.

## Example Usage

```terraform
# Data Source Example: Retrieve Auth0 Phone Notification Templates
# This example shows how to fetch existing phone notification templates from your Auth0 tenant

# Retrieve the OTP enrollment template
data "auth0_branding_phone_notification_template" "otp_enrollment" {
template_id = "tem_xxxxxxxxxxxxxxxxx"
}

# Output the template ID
output "otp_enrollment_id" {
description = "The ID of the OTP enrollment phone notification template"
value = data.auth0_branding_phone_notification_template.otp_enrollment.id
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `template_id` (String) The ID of the Phone Notification Template.

### Read-Only

- `channel` (String) The channel of the phone notification template (e.g., `sms`, `voice`).
- `content` (List of Object) The content of the phone notification template. (see [below for nested schema](#nestedatt--content))
- `customizable` (Boolean) Indicates whether the phone notification template is customizable.
- `disabled` (Boolean) Indicates whether the phone notification template is disabled.
- `id` (String) The ID of this resource.
- `tenant` (String) The tenant of the phone notification template.
- `type` (String) The type of the phone notification template.

<a id="nestedatt--content"></a>
### Nested Schema for `content`

Read-Only:

- `body` (List of Object) (see [below for nested schema](#nestedobjatt--content--body))
- `from` (String)
- `syntax` (String)

<a id="nestedobjatt--content--body"></a>
### Nested Schema for `content.body`

Read-Only:

- `text` (String)
- `voice` (String)


47 changes: 47 additions & 0 deletions docs/data-sources/phone_notification_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
page_title: "Data Source: auth0_phone_notification_template"
description: |-
Data source to retrieve a specific Auth0 Phone Notification Template by template_id.
---

# Data Source: auth0_phone_notification_template

Data source to retrieve a specific Auth0 Phone Notification Template by `template_id`.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `template_id` (String) The ID of the Phone Notification Template.

### Read-Only

- `channel` (String) The channel of the phone notification template (e.g., `sms`, `voice`).
- `content` (List of Object) The content of the phone notification template. (see [below for nested schema](#nestedatt--content))
- `customizable` (Boolean) Indicates whether the phone notification template is customizable.
- `disabled` (Boolean) Indicates whether the phone notification template is disabled.
- `id` (String) The ID of this resource.
- `tenant` (String) The tenant of the phone notification template.
- `type` (String) The type of the phone notification template.

<a id="nestedatt--content"></a>
### Nested Schema for `content`

Read-Only:

- `body` (List of Object) (see [below for nested schema](#nestedobjatt--content--body))
- `from` (String)
- `syntax` (String)

<a id="nestedobjatt--content--body"></a>
### Nested Schema for `content.body`

Read-Only:

- `text` (String)
- `voice` (String)


95 changes: 95 additions & 0 deletions docs/resources/branding_phone_notification_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
page_title: "Resource: auth0_branding_phone_notification_template"
description: |-
Manages phone notification templates used for SMS and voice communications in Auth0.
---

# Resource: auth0_branding_phone_notification_template

Manages phone notification templates used for SMS and voice communications in Auth0.

## Example Usage

```terraform
# Phone Notification Template - OTP Enrollment
# Configure the OTP enrollment phone notification template with SMS and voice support.
resource "auth0_branding_phone_notification_template" "otp_enrollment" {
type = "otp_enroll"
disabled = false

content {
from = "+1234567890"

body {
text = "Your enrollment code is: @{code}"
voice = "Your enrollment code is @{code}"
}
}
}

# Phone Notification Template - OTP Verification
# Configure the OTP verification phone notification template.
resource "auth0_branding_phone_notification_template" "otp_verification" {
type = "otp_verify"
disabled = false

content {
from = "+1234567890"

body {
text = "Your verification code is: @{code}"
voice = "Your verification code is @{code}"
}
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `type` (String) The type of the phone notification template.

### Optional

- `content` (Block List, Max: 1) The content of the phone notification template. (see [below for nested schema](#nestedblock--content))
- `disabled` (Boolean) Indicates whether the phone notification template is disabled.

### Read-Only

- `channel` (String) The channel of the phone notification template (e.g., `sms`, `voice`).
- `customizable` (Boolean) Indicates whether the phone notification template is customizable.
- `id` (String) The ID of this resource.
- `template_id` (String) The ID of the phone notification template.
- `tenant` (String) The tenant of the phone notification template.

<a id="nestedblock--content"></a>
### Nested Schema for `content`

Optional:

- `body` (Block List, Max: 1) The body content of the phone notification template. (see [below for nested schema](#nestedblock--content--body))
- `from` (String) The sender phone number for SMS or voice notifications.
- `syntax` (String) The syntax of the phone notification template.

<a id="nestedblock--content--body"></a>
### Nested Schema for `content.body`

Optional:

- `text` (String) The text content for SMS notifications.
- `voice` (String) The voice content for voice notifications.

## Import

Import is supported using the following syntax:

```shell
#!/bin/bash
# Example: Import an existing Auth0 phone notification template into Terraform state

# Replace TEMPLATE_ID with the actual template ID from your Auth0 tenant

terraform import auth0_branding_phone_notification_template.otp_enrollment "tem_xxxxxxxxxxxxxxxxxxx"
```
50 changes: 50 additions & 0 deletions docs/resources/phone_notification_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
page_title: "Resource: auth0_phone_notification_template"
description: |-
Manages phone notification templates used for SMS and voice communications in Auth0.
---

# Resource: auth0_phone_notification_template

Manages phone notification templates used for SMS and voice communications in Auth0.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `type` (String) The type of the phone notification template.

### Optional

- `content` (Block List, Max: 1) The content of the phone notification template. (see [below for nested schema](#nestedblock--content))
- `disabled` (Boolean) Indicates whether the phone notification template is disabled.

### Read-Only

- `channel` (String) The channel of the phone notification template (e.g., `sms`, `voice`).
- `customizable` (Boolean) Indicates whether the phone notification template is customizable.
- `id` (String) The ID of this resource.
- `template_id` (String) The ID of the phone notification template.
- `tenant` (String) The tenant of the phone notification template.

<a id="nestedblock--content"></a>
### Nested Schema for `content`

Optional:

- `body` (Block List, Max: 1) The body content of the phone notification template. (see [below for nested schema](#nestedblock--content--body))
- `from` (String) The sender phone number for SMS or voice notifications.
- `syntax` (String) The syntax of the phone notification template.

<a id="nestedblock--content--body"></a>
### Nested Schema for `content.body`

Optional:

- `text` (String) The text content for SMS notifications.
- `voice` (String) The voice content for voice notifications.


Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Data Source Example: Retrieve Auth0 Phone Notification Templates
# This example shows how to fetch existing phone notification templates from your Auth0 tenant

# Retrieve the OTP enrollment template
data "auth0_branding_phone_notification_template" "otp_enrollment" {
template_id = "tem_xxxxxxxxxxxxxxxxx"
}

# Output the template ID
output "otp_enrollment_id" {
description = "The ID of the OTP enrollment phone notification template"
value = data.auth0_branding_phone_notification_template.otp_enrollment.id
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
# Example: Import an existing Auth0 phone notification template into Terraform state

# Replace TEMPLATE_ID with the actual template ID from your Auth0 tenant

terraform import auth0_branding_phone_notification_template.otp_enrollment "tem_xxxxxxxxxxxxxxxxxxx"

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Phone Notification Template - OTP Enrollment
# Configure the OTP enrollment phone notification template with SMS and voice support.
resource "auth0_branding_phone_notification_template" "otp_enrollment" {
type = "otp_enroll"
disabled = false

content {
from = "+1234567890"

body {
text = "Your enrollment code is: @{code}"
voice = "Your enrollment code is @{code}"
}
}
}

# Phone Notification Template - OTP Verification
# Configure the OTP verification phone notification template.
resource "auth0_branding_phone_notification_template" "otp_verification" {
type = "otp_verify"
disabled = false

content {
from = "+1234567890"

body {
text = "Your verification code is: @{code}"
voice = "Your verification code is @{code}"
}
}
}
45 changes: 45 additions & 0 deletions internal/auth0/branding/data_source_phone_template.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package branding

import (
"context"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

"github.com/auth0/terraform-provider-auth0/internal/config"
internalSchema "github.com/auth0/terraform-provider-auth0/internal/schema"
)

// NewPhoneNotificationTemplateDataSource creates a new auth0_branding_phone_notification_template data source.
func NewPhoneNotificationTemplateDataSource() *schema.Resource {
return &schema.Resource{
ReadContext: readPhoneNotificationTemplateForDataSource,
Description: "Data source to retrieve a specific Auth0 Phone Notification Template by `template_id`.",
Schema: phoneNotificationTemplateDataSourceSchema(),
}
}

func phoneNotificationTemplateDataSourceSchema() map[string]*schema.Schema {
dataSourceSchemas := internalSchema.TransformResourceToDataSource(NewPhoneNotificationTemplateResource().Schema)
dataSourceSchemas["template_id"] = &schema.Schema{
Type: schema.TypeString,
Required: true,
Description: "The ID of the Phone Notification Template.",
}

return dataSourceSchemas
}

func readPhoneNotificationTemplateForDataSource(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics {
api := meta.(*config.Config).GetAPI()

templateID := data.Get("template_id").(string)
data.SetId(templateID)

template, err := api.Branding.ReadPhoneNotificationTemplate(ctx, templateID)
if err != nil {
return diag.FromErr(err)
}

return diag.FromErr(flattenPhoneNotificationTemplate(data, template))
}
Loading
Loading