From 3bee019b8afff4bf481d4025139a9b4aead91563 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Fri, 5 Dec 2025 21:08:14 +0530 Subject: [PATCH] feat: Add resource and data-source to manage Phone Notification Templates --- .../branding_phone_notification_template.md | 63 ++ .../phone_notification_template.md | 47 ++ .../branding_phone_notification_template.md | 95 +++ docs/resources/phone_notification_template.md | 50 ++ .../data-source.tf | 13 + .../import.sh | 7 + .../resource.tf | 31 + .../branding/data_source_phone_template.go | 45 + internal/auth0/branding/expand.go | 43 + internal/auth0/branding/flatten.go | 41 + .../auth0/branding/resource_phone_template.go | 158 ++++ .../branding/resource_phone_template_test.go | 402 +++++++++ internal/provider/provider.go | 202 ++--- ...ccDataSourcePhoneNotificationTemplate.yaml | 504 ++++++++++++ .../TestAccPhoneNotificationTemplate.yaml | 777 ++++++++++++++++++ ...cPhoneNotificationTemplateInvalidType.yaml | 3 + 16 files changed, 2382 insertions(+), 99 deletions(-) create mode 100644 docs/data-sources/branding_phone_notification_template.md create mode 100644 docs/data-sources/phone_notification_template.md create mode 100644 docs/resources/branding_phone_notification_template.md create mode 100644 docs/resources/phone_notification_template.md create mode 100644 examples/data-sources/auth0_branding_phone_notification_template/data-source.tf create mode 100644 examples/resources/auth0_branding_phone_notification_template/import.sh create mode 100644 examples/resources/auth0_branding_phone_notification_template/resource.tf create mode 100644 internal/auth0/branding/data_source_phone_template.go create mode 100644 internal/auth0/branding/resource_phone_template.go create mode 100644 internal/auth0/branding/resource_phone_template_test.go create mode 100644 test/data/recordings/TestAccDataSourcePhoneNotificationTemplate.yaml create mode 100644 test/data/recordings/TestAccPhoneNotificationTemplate.yaml create mode 100644 test/data/recordings/TestAccPhoneNotificationTemplateInvalidType.yaml diff --git a/docs/data-sources/branding_phone_notification_template.md b/docs/data-sources/branding_phone_notification_template.md new file mode 100644 index 000000000..c61200615 --- /dev/null +++ b/docs/data-sources/branding_phone_notification_template.md @@ -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 + +### 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. + + +### Nested Schema for `content` + +Read-Only: + +- `body` (List of Object) (see [below for nested schema](#nestedobjatt--content--body)) +- `from` (String) +- `syntax` (String) + + +### Nested Schema for `content.body` + +Read-Only: + +- `text` (String) +- `voice` (String) + + diff --git a/docs/data-sources/phone_notification_template.md b/docs/data-sources/phone_notification_template.md new file mode 100644 index 000000000..f82154a5c --- /dev/null +++ b/docs/data-sources/phone_notification_template.md @@ -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 + +### 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. + + +### Nested Schema for `content` + +Read-Only: + +- `body` (List of Object) (see [below for nested schema](#nestedobjatt--content--body)) +- `from` (String) +- `syntax` (String) + + +### Nested Schema for `content.body` + +Read-Only: + +- `text` (String) +- `voice` (String) + + diff --git a/docs/resources/branding_phone_notification_template.md b/docs/resources/branding_phone_notification_template.md new file mode 100644 index 000000000..3f9374c65 --- /dev/null +++ b/docs/resources/branding_phone_notification_template.md @@ -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 + +### 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. + + +### 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. + + +### 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" +``` diff --git a/docs/resources/phone_notification_template.md b/docs/resources/phone_notification_template.md new file mode 100644 index 000000000..8d7557acf --- /dev/null +++ b/docs/resources/phone_notification_template.md @@ -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 + +### 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. + + +### 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. + + +### Nested Schema for `content.body` + +Optional: + +- `text` (String) The text content for SMS notifications. +- `voice` (String) The voice content for voice notifications. + + diff --git a/examples/data-sources/auth0_branding_phone_notification_template/data-source.tf b/examples/data-sources/auth0_branding_phone_notification_template/data-source.tf new file mode 100644 index 000000000..ba7f8582c --- /dev/null +++ b/examples/data-sources/auth0_branding_phone_notification_template/data-source.tf @@ -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 +} diff --git a/examples/resources/auth0_branding_phone_notification_template/import.sh b/examples/resources/auth0_branding_phone_notification_template/import.sh new file mode 100644 index 000000000..138797027 --- /dev/null +++ b/examples/resources/auth0_branding_phone_notification_template/import.sh @@ -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" + diff --git a/examples/resources/auth0_branding_phone_notification_template/resource.tf b/examples/resources/auth0_branding_phone_notification_template/resource.tf new file mode 100644 index 000000000..19d03189b --- /dev/null +++ b/examples/resources/auth0_branding_phone_notification_template/resource.tf @@ -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}" + } + } +} diff --git a/internal/auth0/branding/data_source_phone_template.go b/internal/auth0/branding/data_source_phone_template.go new file mode 100644 index 000000000..2f460fac6 --- /dev/null +++ b/internal/auth0/branding/data_source_phone_template.go @@ -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)) +} diff --git a/internal/auth0/branding/expand.go b/internal/auth0/branding/expand.go index 999718c37..7b6ea0888 100644 --- a/internal/auth0/branding/expand.go +++ b/internal/auth0/branding/expand.go @@ -196,3 +196,46 @@ func expandPhoneProviderCredentials(config cty.Value) *management.BrandingPhoneP return credentials } + +func expandPhoneNotificationTemplate(config cty.Value) *management.BrandingPhoneNotificationTemplate { + template := &management.BrandingPhoneNotificationTemplate{ + Type: value.String(config.GetAttr("type")), + Disabled: value.Bool(config.GetAttr("disabled")), + Content: expandPhoneNotificationTemplateContent(config.GetAttr("content")), + } + + return template +} + +func expandPhoneNotificationTemplateContent(config cty.Value) *management.BrandingPhoneNotificationTemplateContent { + var content management.BrandingPhoneNotificationTemplateContent + + config.ForEachElement(func(_ cty.Value, c cty.Value) (stop bool) { + content.Syntax = value.String(c.GetAttr("syntax")) + content.From = value.String(c.GetAttr("from")) + content.Body = expandPhoneNotificationTemplateContentBody(c.GetAttr("body")) + return stop + }) + + if content == (management.BrandingPhoneNotificationTemplateContent{}) { + return nil + } + + return &content +} + +func expandPhoneNotificationTemplateContentBody(config cty.Value) *management.BrandingPhoneNotificationTemplateContentBody { + var body management.BrandingPhoneNotificationTemplateContentBody + + config.ForEachElement(func(_ cty.Value, b cty.Value) (stop bool) { + body.Text = value.String(b.GetAttr("text")) + body.Voice = value.String(b.GetAttr("voice")) + return stop + }) + + if body == (management.BrandingPhoneNotificationTemplateContentBody{}) { + return nil + } + + return &body +} diff --git a/internal/auth0/branding/flatten.go b/internal/auth0/branding/flatten.go index c19333c1e..04bd5b144 100644 --- a/internal/auth0/branding/flatten.go +++ b/internal/auth0/branding/flatten.go @@ -212,3 +212,44 @@ func flattenPhoneProviderCredentials(data *schema.ResourceData) []interface{} { }, } } + +func flattenPhoneNotificationTemplate(data *schema.ResourceData, template *management.BrandingPhoneNotificationTemplate) error { + result := multierror.Append( + data.Set("template_id", template.GetID()), + data.Set("channel", template.GetChannel()), + data.Set("tenant", template.GetTenant()), + data.Set("type", template.GetType()), + data.Set("customizable", template.GetCustomizable()), + data.Set("disabled", template.GetDisabled()), + data.Set("content", flattenPhoneNotificationTemplateContent(template.GetContent())), + ) + + return result.ErrorOrNil() +} + +func flattenPhoneNotificationTemplateContent(content *management.BrandingPhoneNotificationTemplateContent) []interface{} { + if content == nil { + return nil + } + + return []interface{}{ + map[string]interface{}{ + "syntax": content.GetSyntax(), + "from": content.GetFrom(), + "body": flattenPhoneNotificationTemplateContentBody(content.GetBody()), + }, + } +} + +func flattenPhoneNotificationTemplateContentBody(body *management.BrandingPhoneNotificationTemplateContentBody) []interface{} { + if body == nil { + return nil + } + + return []interface{}{ + map[string]interface{}{ + "text": body.GetText(), + "voice": body.GetVoice(), + }, + } +} diff --git a/internal/auth0/branding/resource_phone_template.go b/internal/auth0/branding/resource_phone_template.go new file mode 100644 index 000000000..253d08277 --- /dev/null +++ b/internal/auth0/branding/resource_phone_template.go @@ -0,0 +1,158 @@ +package branding + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + + "github.com/auth0/terraform-provider-auth0/internal/config" + internalError "github.com/auth0/terraform-provider-auth0/internal/error" +) + +// NewPhoneNotificationTemplateResource returns a new auth0_branding_phone_notification_template resource. +func NewPhoneNotificationTemplateResource() *schema.Resource { + return &schema.Resource{ + CreateContext: createPhoneNotificationTemplate, + ReadContext: readPhoneNotificationTemplate, + UpdateContext: updatePhoneNotificationTemplate, + DeleteContext: deletePhoneNotificationTemplate, + Importer: &schema.ResourceImporter{ + StateContext: schema.ImportStatePassthroughContext, + }, + Description: "Manages phone notification templates used for SMS and voice communications in Auth0.", + Schema: map[string]*schema.Schema{ + "template_id": { + Type: schema.TypeString, + Computed: true, + Description: "The ID of the phone notification template.", + }, + "channel": { + Type: schema.TypeString, + Computed: true, + Description: "The channel of the phone notification template (e.g., `sms`, `voice`).", + }, + "tenant": { + Type: schema.TypeString, + Computed: true, + Description: "The tenant of the phone notification template.", + }, + "type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + "otp_verify", + "otp_enroll", + "change_password", + "blocked_account", + "password_breach"}, + false), + Description: "The type of the phone notification template.", + }, + "customizable": { + Type: schema.TypeBool, + Computed: true, + Description: "Indicates whether the phone notification template is customizable.", + }, + "disabled": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "Indicates whether the phone notification template is disabled.", + }, + "content": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "The content of the phone notification template.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "syntax": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The syntax of the phone notification template.", + }, + "from": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + Description: "The sender phone number for SMS or voice notifications.", + }, + "body": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "The body content of the phone notification template.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "text": { + Type: schema.TypeString, + Optional: true, + Description: "The text content for SMS notifications.", + }, + "voice": { + Type: schema.TypeString, + Optional: true, + Description: "The voice content for voice notifications.", + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func createPhoneNotificationTemplate(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { + api := meta.(*config.Config).GetAPI() + + templateConfig := expandPhoneNotificationTemplate(data.GetRawConfig()) + + if err := api.Branding.CreatePhoneNotificationTemplate(ctx, templateConfig); err != nil { + return diag.FromErr(err) + } + + data.SetId(templateConfig.GetID()) + + return readPhoneNotificationTemplate(ctx, data, meta) +} + +func readPhoneNotificationTemplate(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { + api := meta.(*config.Config).GetAPI() + + template, err := api.Branding.ReadPhoneNotificationTemplate(ctx, data.Id()) + if err != nil { + return diag.FromErr(internalError.HandleAPIError(data, err)) + } + + return diag.FromErr(flattenPhoneNotificationTemplate(data, template)) +} + +func updatePhoneNotificationTemplate(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { + api := meta.(*config.Config).GetAPI() + + templateConfig := expandPhoneNotificationTemplate(data.GetRawConfig()) + + if err := api.Branding.UpdatePhoneNotificationTemplate(ctx, data.Id(), templateConfig); err != nil { + return diag.FromErr(internalError.HandleAPIError(data, err)) + } + + return readPhoneNotificationTemplate(ctx, data, meta) +} + +func deletePhoneNotificationTemplate(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { + api := meta.(*config.Config).GetAPI() + + if err := api.Branding.DeletePhoneNotificationTemplate(ctx, data.Id()); err != nil { + return diag.FromErr(internalError.HandleAPIError(data, err)) + } + + return nil +} diff --git a/internal/auth0/branding/resource_phone_template_test.go b/internal/auth0/branding/resource_phone_template_test.go new file mode 100644 index 000000000..76d3c0701 --- /dev/null +++ b/internal/auth0/branding/resource_phone_template_test.go @@ -0,0 +1,402 @@ +package branding_test + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + + "github.com/auth0/terraform-provider-auth0/internal/acctest" +) + +const testAccPhoneNotificationTemplateChangePassword = ` +resource "auth0_branding_phone_notification_template" "change_password" { + type = "change_password" + disabled = true + content { + from = "+918095250531" + body { + text = "Your password has been changed" + voice = "Your password has been changed" + } + } +} +` + +const testAccPhoneNotificationTemplateOTPEnroll = ` +resource "auth0_branding_phone_notification_template" "otp_enroll" { + type = "otp_enroll" + disabled = false + content { + from = "+1234567890" + body { + text = "Your enrollment code is: @{code}" + voice = "Your enrollment code is @{code}" + } + } +} +` + +const testAccPhoneNotificationTemplateOTPEnrollUpdated = ` +resource "auth0_branding_phone_notification_template" "otp_enroll" { + type = "otp_enroll" + disabled = true + + content { + from = "+9876543210" + body { + text = "Updated enrollment code: @{code}" + voice = "Updated enrollment code: @{code}" + } + } +} +` + +const testAccPhoneNotificationTemplateOTPVerify = ` +resource "auth0_branding_phone_notification_template" "otp_verify" { + type = "otp_verify" + disabled = false + + content { + from = "+1111111111" + body { + text = "Your verification code is: @{code}" + voice = "Your verification code is @{code}" + } + } +} +` + +const testAccPhoneNotificationTemplateBlockedAccount = ` +resource "auth0_branding_phone_notification_template" "blocked_account" { + type = "blocked_account" + disabled = false + content { + body { + text = "Your account has been blocked" + voice = "Your account has been blocked" + } + } +} +` + +const testAccDataSourcePhoneNotificationTemplateOTPEnroll = ` +resource "auth0_branding_phone_notification_template" "otp_enroll" { + type = "otp_enroll" + disabled = false + content { + from = "+1234567890" + body { + text = "Your enrollment code is: @{code}" + voice = "Your enrollment code is @{code}" + } + } +} + +data "auth0_branding_phone_notification_template" "otp_enroll" { + depends_on = [auth0_branding_phone_notification_template.otp_enroll] + template_id = auth0_branding_phone_notification_template.otp_enroll.id +} +` + +const testAccDataSourcePhoneNotificationTemplateChangePassword = ` +resource "auth0_branding_phone_notification_template" "change_password" { + type = "change_password" + disabled = true + + content { + from = "+918095250531" + body { + text = "Your password has been changed" + voice = "Your password has been changed" + } + } +} + +data "auth0_branding_phone_notification_template" "change_password" { + depends_on = [auth0_branding_phone_notification_template.change_password] + template_id = auth0_branding_phone_notification_template.change_password.id +} +` + +// TestAccPhoneNotificationTemplate tests creation, update, and basic operations. +func TestAccPhoneNotificationTemplate(t *testing.T) { + acctest.Test(t, resource.TestCase{ + Steps: []resource.TestStep{ + { + Config: testAccPhoneNotificationTemplateChangePassword, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.change_password", + "type", + "change_password", + ), + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.change_password", + "disabled", + "true", + ), + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.change_password", + "content.0.from", + "+918095250531", + ), + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.change_password", + "content.0.body.0.text", + "Your password has been changed", + ), + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.change_password", + "content.0.body.0.voice", + "Your password has been changed", + ), + // Verify computed fields exist and are not empty. + resource.TestCheckResourceAttrSet( + "auth0_branding_phone_notification_template.change_password", + "id", + ), + resource.TestCheckResourceAttrSet( + "auth0_branding_phone_notification_template.change_password", + "template_id", + ), + resource.TestCheckResourceAttrSet( + "auth0_branding_phone_notification_template.change_password", + "channel", + ), + resource.TestCheckResourceAttrSet( + "auth0_branding_phone_notification_template.change_password", + "tenant", + ), + resource.TestCheckResourceAttrSet( + "auth0_branding_phone_notification_template.change_password", + "customizable", + ), + resource.TestCheckResourceAttrSet( + "auth0_branding_phone_notification_template.change_password", + "content.0.syntax", + ), + ), + }, + { + Config: testAccPhoneNotificationTemplateOTPEnroll, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.otp_enroll", + "type", + "otp_enroll", + ), + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.otp_enroll", + "disabled", + "false", + ), + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.otp_enroll", + "content.0.from", + "+1234567890", + ), + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.otp_enroll", + "content.0.body.0.text", + "Your enrollment code is: @{code}", + ), + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.otp_enroll", + "content.0.body.0.voice", + "Your enrollment code is @{code}", + ), + ), + }, + { + Config: testAccPhoneNotificationTemplateOTPEnrollUpdated, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.otp_enroll", + "type", + "otp_enroll", + ), + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.otp_enroll", + "disabled", + "true", + ), + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.otp_enroll", + "content.0.from", + "+9876543210", + ), + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.otp_enroll", + "content.0.body.0.text", + "Updated enrollment code: @{code}", + ), + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.otp_enroll", + "content.0.body.0.voice", + "Updated enrollment code: @{code}", + ), + ), + }, + { + Config: testAccPhoneNotificationTemplateOTPVerify, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.otp_verify", + "type", + "otp_verify", + ), + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.otp_verify", + "disabled", + "false", + ), + ), + }, + { + Config: testAccPhoneNotificationTemplateBlockedAccount, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.blocked_account", + "type", + "blocked_account", + ), + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.blocked_account", + "disabled", + "false", + ), + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.blocked_account", + "content.0.body.0.text", + "Your account has been blocked", + ), + ), + }, + }, + }) +} + +// TestAccDataSourcePhoneNotificationTemplate tests data source retrieval. +func TestAccDataSourcePhoneNotificationTemplate(t *testing.T) { + acctest.Test(t, resource.TestCase{ + Steps: []resource.TestStep{ + { + Config: testAccDataSourcePhoneNotificationTemplateOTPEnroll, + Check: resource.ComposeTestCheckFunc( + // Verify resource was created. + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.otp_enroll", + "type", + "otp_enroll", + ), + // Verify data source can read the resource. + resource.TestCheckResourceAttr( + "data.auth0_branding_phone_notification_template.otp_enroll", + "type", + "otp_enroll", + ), + resource.TestCheckResourceAttr( + "data.auth0_branding_phone_notification_template.otp_enroll", + "disabled", + "false", + ), + resource.TestCheckResourceAttr( + "data.auth0_branding_phone_notification_template.otp_enroll", + "content.0.from", + "+1234567890", + ), + resource.TestCheckResourceAttr( + "data.auth0_branding_phone_notification_template.otp_enroll", + "content.0.body.0.text", + "Your enrollment code is: @{code}", + ), + // Verify computed fields are present in data source. + resource.TestCheckResourceAttrSet( + "data.auth0_branding_phone_notification_template.otp_enroll", + "template_id", + ), + resource.TestCheckResourceAttrSet( + "data.auth0_branding_phone_notification_template.otp_enroll", + "channel", + ), + resource.TestCheckResourceAttrSet( + "data.auth0_branding_phone_notification_template.otp_enroll", + "tenant", + ), + resource.TestCheckResourceAttrSet( + "data.auth0_branding_phone_notification_template.otp_enroll", + "customizable", + ), + resource.TestCheckResourceAttrSet( + "data.auth0_branding_phone_notification_template.otp_enroll", + "content.0.syntax", + ), + ), + }, + { + Config: testAccDataSourcePhoneNotificationTemplateChangePassword, + Check: resource.ComposeTestCheckFunc( + // Verify resource was created. + resource.TestCheckResourceAttr( + "auth0_branding_phone_notification_template.change_password", + "type", + "change_password", + ), + // Verify data source can read the resource. + resource.TestCheckResourceAttr( + "data.auth0_branding_phone_notification_template.change_password", + "type", + "change_password", + ), + resource.TestCheckResourceAttr( + "data.auth0_branding_phone_notification_template.change_password", + "disabled", + "true", + ), + resource.TestCheckResourceAttr( + "data.auth0_branding_phone_notification_template.change_password", + "content.0.from", + "+918095250531", + ), + resource.TestCheckResourceAttr( + "data.auth0_branding_phone_notification_template.change_password", + "content.0.body.0.text", + "Your password has been changed", + ), + // Verify IDs match between resource and data source. + resource.TestCheckResourceAttrPair( + "data.auth0_branding_phone_notification_template.change_password", + "template_id", + "auth0_branding_phone_notification_template.change_password", + "template_id", + ), + ), + }, + }, + }) +} + +// TestAccPhoneNotificationTemplateInvalidType tests validation of template type. +func TestAccPhoneNotificationTemplateInvalidType(t *testing.T) { + acctest.Test(t, resource.TestCase{ + Steps: []resource.TestStep{ + { + Config: ` +resource "auth0_branding_phone_notification_template" "invalid" { + type = "invalid_type" + disabled = false + + content { + from = "+1234567890" + body { + text = "Test" + } + } +} +`, + ExpectError: regexp.MustCompile("expected type to be one of"), + }, + }, + }) +} diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 8f3524fb0..93d6db889 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -153,107 +153,111 @@ func New() *schema.Provider { }, }, ResourcesMap: map[string]*schema.Resource{ - "auth0_action": action.NewResource(), - "auth0_trigger_actions": action.NewTriggerActionsResource(), - "auth0_trigger_action": action.NewTriggerActionResource(), - "auth0_attack_protection": attackprotection.NewResource(), - "auth0_branding": branding.NewResource(), - "auth0_branding_theme": branding.NewThemeResource(), - "auth0_client": client.NewResource(), - "auth0_client_credentials": client.NewCredentialsResource(), - "auth0_client_grant": client.NewGrantResource(), - "auth0_connection": connection.NewResource(), - "auth0_connection_client": connection.NewClientResource(), - "auth0_connection_clients": connection.NewClientsResource(), - "auth0_connection_profile": connection.NewConnectionProfileResource(), - "auth0_connection_keys": connection.NewKeysResource(), - "auth0_connection_scim_configuration": connection.NewSCIMConfigurationResource(), - "auth0_connection_scim_token": connection.NewSCIMTokenResource(), - "auth0_custom_domain": customdomain.NewResource(), - "auth0_custom_domain_verification": customdomain.NewVerificationResource(), - "auth0_email_provider": email.NewResource(), - "auth0_email_template": email.NewTemplateResource(), - "auth0_event_stream": eventstream.NewResource(), - "auth0_encryption_key_manager": encryptionkeymanager.NewEncryptionKeyManagerResource(), - "auth0_flow": flow.NewResource(), - "auth0_flow_vault_connection": flow.NewVaultConnectionResource(), - "auth0_form": form.NewResource(), - "auth0_guardian": guardian.NewResource(), - "auth0_hook": hook.NewResource(), - "auth0_log_stream": logstream.NewResource(), - "auth0_organization": organization.NewResource(), - "auth0_organization_client_grant": organization.NewOrganizationClientGrantResource(), - "auth0_organization_connection": organization.NewConnectionResource(), - "auth0_organization_connections": organization.NewConnectionsResource(), - "auth0_organization_discovery_domain": organization.NewDiscoveryDomainResource(), - "auth0_organization_discovery_domains": organization.NewDiscoveryDomainsResource(), - "auth0_organization_member": organization.NewMemberResource(), - "auth0_organization_member_role": organization.NewMemberRoleResource(), - "auth0_organization_member_roles": organization.NewMemberRolesResource(), - "auth0_organization_members": organization.NewMembersResource(), - "auth0_network_acl": networkacl.NewResource(), - "auth0_pages": page.NewResource(), - "auth0_phone_provider": branding.NewPhoneProviderResource(), - "auth0_prompt": prompt.NewResource(), - "auth0_prompt_custom_text": prompt.NewCustomTextResource(), - "auth0_prompt_partials": prompt.NewPartialsResource(), - "auth0_prompt_screen_partial": prompt.NewScreenPartialResource(), - "auth0_prompt_screen_partials": prompt.NewScreenPartialsResource(), - "auth0_prompt_screen_renderer": prompt.NewPromptScreenRenderResource(), - "auth0_resource_server": resourceserver.NewResource(), - "auth0_resource_server_scope": resourceserver.NewScopeResource(), - "auth0_resource_server_scopes": resourceserver.NewScopesResource(), - "auth0_risk_assessments": riskassessment.NewResource(), - "auth0_risk_assessments_new_device": riskassessment.NewDeviceSettingResource(), - "auth0_role": role.NewResource(), - "auth0_role_permission": role.NewPermissionResource(), - "auth0_role_permissions": role.NewPermissionsResource(), - "auth0_rule": rule.NewResource(), - "auth0_rule_config": rule.NewConfigResource(), - "auth0_self_service_profile": selfserviceprofile.NewResource(), - "auth0_self_service_profile_custom_text": selfserviceprofile.NewCustomTextResource(), - "auth0_tenant": tenant.NewResource(), - "auth0_token_exchange_profile": tokenexchangeprofile.NewResource(), - "auth0_user": user.NewResource(), - "auth0_user_attribute_profile": userattributeprofile.NewResource(), - "auth0_user_permission": user.NewPermissionResource(), - "auth0_user_permissions": user.NewPermissionsResource(), - "auth0_user_role": user.NewRoleResource(), - "auth0_user_roles": user.NewRolesResource(), + "auth0_action": action.NewResource(), + "auth0_trigger_actions": action.NewTriggerActionsResource(), + "auth0_trigger_action": action.NewTriggerActionResource(), + "auth0_attack_protection": attackprotection.NewResource(), + "auth0_branding": branding.NewResource(), + "auth0_branding_theme": branding.NewThemeResource(), + "auth0_branding_phone_notification_template": branding.NewPhoneNotificationTemplateResource(), + "auth0_client": client.NewResource(), + "auth0_client_credentials": client.NewCredentialsResource(), + "auth0_client_grant": client.NewGrantResource(), + "auth0_connection": connection.NewResource(), + "auth0_connection_client": connection.NewClientResource(), + "auth0_connection_clients": connection.NewClientsResource(), + "auth0_connection_profile": connection.NewConnectionProfileResource(), + "auth0_connection_keys": connection.NewKeysResource(), + "auth0_connection_scim_configuration": connection.NewSCIMConfigurationResource(), + "auth0_connection_scim_token": connection.NewSCIMTokenResource(), + "auth0_custom_domain": customdomain.NewResource(), + "auth0_custom_domain_verification": customdomain.NewVerificationResource(), + "auth0_email_provider": email.NewResource(), + "auth0_email_template": email.NewTemplateResource(), + "auth0_event_stream": eventstream.NewResource(), + "auth0_encryption_key_manager": encryptionkeymanager.NewEncryptionKeyManagerResource(), + "auth0_flow": flow.NewResource(), + "auth0_flow_vault_connection": flow.NewVaultConnectionResource(), + "auth0_form": form.NewResource(), + "auth0_guardian": guardian.NewResource(), + "auth0_hook": hook.NewResource(), + "auth0_log_stream": logstream.NewResource(), + "auth0_organization": organization.NewResource(), + "auth0_organization_client_grant": organization.NewOrganizationClientGrantResource(), + "auth0_organization_connection": organization.NewConnectionResource(), + "auth0_organization_connections": organization.NewConnectionsResource(), + "auth0_organization_discovery_domain": organization.NewDiscoveryDomainResource(), + "auth0_organization_discovery_domains": organization.NewDiscoveryDomainsResource(), + "auth0_organization_member": organization.NewMemberResource(), + "auth0_organization_member_role": organization.NewMemberRoleResource(), + "auth0_organization_member_roles": organization.NewMemberRolesResource(), + "auth0_organization_members": organization.NewMembersResource(), + "auth0_network_acl": networkacl.NewResource(), + "auth0_pages": page.NewResource(), + "auth0_phone_provider": branding.NewPhoneProviderResource(), + "auth0_phone_notification_template": branding.NewPhoneNotificationTemplateResource(), + "auth0_prompt": prompt.NewResource(), + "auth0_prompt_custom_text": prompt.NewCustomTextResource(), + "auth0_prompt_partials": prompt.NewPartialsResource(), + "auth0_prompt_screen_partial": prompt.NewScreenPartialResource(), + "auth0_prompt_screen_partials": prompt.NewScreenPartialsResource(), + "auth0_prompt_screen_renderer": prompt.NewPromptScreenRenderResource(), + "auth0_resource_server": resourceserver.NewResource(), + "auth0_resource_server_scope": resourceserver.NewScopeResource(), + "auth0_resource_server_scopes": resourceserver.NewScopesResource(), + "auth0_risk_assessments": riskassessment.NewResource(), + "auth0_risk_assessments_new_device": riskassessment.NewDeviceSettingResource(), + "auth0_role": role.NewResource(), + "auth0_role_permission": role.NewPermissionResource(), + "auth0_role_permissions": role.NewPermissionsResource(), + "auth0_rule": rule.NewResource(), + "auth0_rule_config": rule.NewConfigResource(), + "auth0_self_service_profile": selfserviceprofile.NewResource(), + "auth0_self_service_profile_custom_text": selfserviceprofile.NewCustomTextResource(), + "auth0_tenant": tenant.NewResource(), + "auth0_token_exchange_profile": tokenexchangeprofile.NewResource(), + "auth0_user": user.NewResource(), + "auth0_user_attribute_profile": userattributeprofile.NewResource(), + "auth0_user_permission": user.NewPermissionResource(), + "auth0_user_permissions": user.NewPermissionsResource(), + "auth0_user_role": user.NewRoleResource(), + "auth0_user_roles": user.NewRolesResource(), }, DataSourcesMap: map[string]*schema.Resource{ - "auth0_attack_protection": attackprotection.NewDataSource(), - "auth0_action": action.NewDataSource(), - "auth0_branding": branding.NewDataSource(), - "auth0_branding_theme": branding.NewThemeDataSource(), - "auth0_client": client.NewDataSource(), - "auth0_clients": client.NewClientsDataSource(), - "auth0_client_grants": client.NewClientGrantsDataSource(), - "auth0_connection": connection.NewDataSource(), - "auth0_connection_keys": connection.NewKeysDataSource(), - "auth0_connection_profile": connection.NewConnectionProfileDataSource(), - "auth0_connection_scim_configuration": connection.NewSCIMConfigurationDataSource(), - "auth0_custom_domain": customdomain.NewDataSource(), - "auth0_custom_domains": customdomain.NewCustomDomainsDataSource(), - "auth0_event_stream": eventstream.NewDataSource(), - "auth0_flow": flow.NewDataSource(), - "auth0_flow_vault_connection": flow.NewVaultConnectionDataSource(), - "auth0_form": form.NewDataSource(), - "auth0_organization": organization.NewDataSource(), - "auth0_network_acl": networkacl.NewDataSource(), - "auth0_outbound_ips": outboundips.NewDataSource(), - "auth0_pages": page.NewDataSource(), - "auth0_phone_provider": branding.NewPhoneProviderDataSource(), - "auth0_prompt_screen_partials": prompt.NewPromptScreenPartialsDataSource(), - "auth0_prompt_screen_renderer": prompt.NewPromptScreenRenderDataSource(), - "auth0_resource_server": resourceserver.NewDataSource(), - "auth0_role": role.NewDataSource(), - "auth0_self_service_profile": selfserviceprofile.NewDataSource(), - "auth0_signing_keys": signingkey.NewDataSource(), - "auth0_tenant": tenant.NewDataSource(), - "auth0_token_exchange_profile": tokenexchangeprofile.NewDataSource(), - "auth0_user": user.NewDataSource(), - "auth0_user_attribute_profile": userattributeprofile.NewDataSource(), + "auth0_attack_protection": attackprotection.NewDataSource(), + "auth0_action": action.NewDataSource(), + "auth0_branding": branding.NewDataSource(), + "auth0_branding_theme": branding.NewThemeDataSource(), + "auth0_branding_phone_notification_template": branding.NewPhoneNotificationTemplateDataSource(), + "auth0_client": client.NewDataSource(), + "auth0_clients": client.NewClientsDataSource(), + "auth0_client_grants": client.NewClientGrantsDataSource(), + "auth0_connection": connection.NewDataSource(), + "auth0_connection_keys": connection.NewKeysDataSource(), + "auth0_connection_profile": connection.NewConnectionProfileDataSource(), + "auth0_connection_scim_configuration": connection.NewSCIMConfigurationDataSource(), + "auth0_custom_domain": customdomain.NewDataSource(), + "auth0_custom_domains": customdomain.NewCustomDomainsDataSource(), + "auth0_event_stream": eventstream.NewDataSource(), + "auth0_flow": flow.NewDataSource(), + "auth0_flow_vault_connection": flow.NewVaultConnectionDataSource(), + "auth0_form": form.NewDataSource(), + "auth0_organization": organization.NewDataSource(), + "auth0_network_acl": networkacl.NewDataSource(), + "auth0_outbound_ips": outboundips.NewDataSource(), + "auth0_pages": page.NewDataSource(), + "auth0_phone_provider": branding.NewPhoneProviderDataSource(), + "auth0_phone_notification_template": branding.NewPhoneNotificationTemplateDataSource(), + "auth0_prompt_screen_partials": prompt.NewPromptScreenPartialsDataSource(), + "auth0_prompt_screen_renderer": prompt.NewPromptScreenRenderDataSource(), + "auth0_resource_server": resourceserver.NewDataSource(), + "auth0_role": role.NewDataSource(), + "auth0_self_service_profile": selfserviceprofile.NewDataSource(), + "auth0_signing_keys": signingkey.NewDataSource(), + "auth0_tenant": tenant.NewDataSource(), + "auth0_token_exchange_profile": tokenexchangeprofile.NewDataSource(), + "auth0_user": user.NewDataSource(), + "auth0_user_attribute_profile": userattributeprofile.NewDataSource(), }, } diff --git a/test/data/recordings/TestAccDataSourcePhoneNotificationTemplate.yaml b/test/data/recordings/TestAccDataSourcePhoneNotificationTemplate.yaml new file mode 100644 index 000000000..f3065a562 --- /dev/null +++ b/test/data/recordings/TestAccDataSourcePhoneNotificationTemplate.yaml @@ -0,0 +1,504 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 165 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"content":{"from":"+1234567890","body":{"text":"Your enrollment code is: @{code}","voice":"Your enrollment code is @{code}"}},"type":"otp_enroll","disabled":false} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 369 + uncompressed: false + body: '{"id":"tem_8pL3hxcTvbEzKcnsrikpM5","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_enroll","disabled":false,"created_at":"2025-12-05T15:30:47.600Z","updated_at":"2025-12-05T15:30:47.600Z","content":{"syntax":"liquid","body":{"text":"Your enrollment code is: @{code}","voice":"Your enrollment code is @{code}"},"from":"+1234567890"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 201 Created + code: 201 + duration: 376.761583ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_8pL3hxcTvbEzKcnsrikpM5 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_8pL3hxcTvbEzKcnsrikpM5","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_enroll","disabled":false,"created_at":"2025-12-05T15:30:47.600Z","updated_at":"2025-12-05T15:30:47.600Z","content":{"syntax":"liquid","body":{"text":"Your enrollment code is: @{code}","voice":"Your enrollment code is @{code}"},"from":"+1234567890"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 383.176625ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_8pL3hxcTvbEzKcnsrikpM5 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_8pL3hxcTvbEzKcnsrikpM5","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_enroll","disabled":false,"created_at":"2025-12-05T15:30:47.600Z","updated_at":"2025-12-05T15:30:47.600Z","content":{"syntax":"liquid","body":{"text":"Your enrollment code is: @{code}","voice":"Your enrollment code is @{code}"},"from":"+1234567890"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 363.462875ms + - id: 3 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_8pL3hxcTvbEzKcnsrikpM5 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_8pL3hxcTvbEzKcnsrikpM5","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_enroll","disabled":false,"created_at":"2025-12-05T15:30:47.600Z","updated_at":"2025-12-05T15:30:47.600Z","content":{"syntax":"liquid","body":{"text":"Your enrollment code is: @{code}","voice":"Your enrollment code is @{code}"},"from":"+1234567890"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 347.898792ms + - id: 4 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_8pL3hxcTvbEzKcnsrikpM5 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_8pL3hxcTvbEzKcnsrikpM5","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_enroll","disabled":false,"created_at":"2025-12-05T15:30:47.600Z","updated_at":"2025-12-05T15:30:47.600Z","content":{"syntax":"liquid","body":{"text":"Your enrollment code is: @{code}","voice":"Your enrollment code is @{code}"},"from":"+1234567890"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 347.987833ms + - id: 5 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_8pL3hxcTvbEzKcnsrikpM5 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_8pL3hxcTvbEzKcnsrikpM5","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_enroll","disabled":false,"created_at":"2025-12-05T15:30:47.600Z","updated_at":"2025-12-05T15:30:47.600Z","content":{"syntax":"liquid","body":{"text":"Your enrollment code is: @{code}","voice":"Your enrollment code is @{code}"},"from":"+1234567890"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 366.020375ms + - id: 6 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_8pL3hxcTvbEzKcnsrikpM5 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_8pL3hxcTvbEzKcnsrikpM5","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_enroll","disabled":false,"created_at":"2025-12-05T15:30:47.600Z","updated_at":"2025-12-05T15:30:47.600Z","content":{"syntax":"liquid","body":{"text":"Your enrollment code is: @{code}","voice":"Your enrollment code is @{code}"},"from":"+1234567890"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 330.416583ms + - id: 7 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 168 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"content":{"from":"+918095250531","body":{"text":"Your password has been changed","voice":"Your password has been changed"}},"type":"change_password","disabled":true} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 372 + uncompressed: false + body: '{"id":"tem_1wn2r31HdSEYFEyHC1BC85","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"change_password","disabled":true,"created_at":"2025-12-05T15:30:52.583Z","updated_at":"2025-12-05T15:30:52.583Z","content":{"syntax":"liquid","body":{"text":"Your password has been changed","voice":"Your password has been changed"},"from":"+918095250531"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 201 Created + code: 201 + duration: 362.436875ms + - id: 8 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_8pL3hxcTvbEzKcnsrikpM5 + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 387.694958ms + - id: 9 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_1wn2r31HdSEYFEyHC1BC85 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_1wn2r31HdSEYFEyHC1BC85","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"change_password","disabled":true,"created_at":"2025-12-05T15:30:52.583Z","updated_at":"2025-12-05T15:30:52.583Z","content":{"syntax":"liquid","body":{"text":"Your password has been changed","voice":"Your password has been changed"},"from":"+918095250531"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 360.104459ms + - id: 10 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_1wn2r31HdSEYFEyHC1BC85 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_1wn2r31HdSEYFEyHC1BC85","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"change_password","disabled":true,"created_at":"2025-12-05T15:30:52.583Z","updated_at":"2025-12-05T15:30:52.583Z","content":{"syntax":"liquid","body":{"text":"Your password has been changed","voice":"Your password has been changed"},"from":"+918095250531"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 365.114208ms + - id: 11 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_1wn2r31HdSEYFEyHC1BC85 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_1wn2r31HdSEYFEyHC1BC85","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"change_password","disabled":true,"created_at":"2025-12-05T15:30:52.583Z","updated_at":"2025-12-05T15:30:52.583Z","content":{"syntax":"liquid","body":{"text":"Your password has been changed","voice":"Your password has been changed"},"from":"+918095250531"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 380.544125ms + - id: 12 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_1wn2r31HdSEYFEyHC1BC85 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_1wn2r31HdSEYFEyHC1BC85","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"change_password","disabled":true,"created_at":"2025-12-05T15:30:52.583Z","updated_at":"2025-12-05T15:30:52.583Z","content":{"syntax":"liquid","body":{"text":"Your password has been changed","voice":"Your password has been changed"},"from":"+918095250531"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 373.216625ms + - id: 13 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_1wn2r31HdSEYFEyHC1BC85 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_1wn2r31HdSEYFEyHC1BC85","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"change_password","disabled":true,"created_at":"2025-12-05T15:30:52.583Z","updated_at":"2025-12-05T15:30:52.583Z","content":{"syntax":"liquid","body":{"text":"Your password has been changed","voice":"Your password has been changed"},"from":"+918095250531"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 357.422ms + - id: 14 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_1wn2r31HdSEYFEyHC1BC85 + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 394.892417ms diff --git a/test/data/recordings/TestAccPhoneNotificationTemplate.yaml b/test/data/recordings/TestAccPhoneNotificationTemplate.yaml new file mode 100644 index 000000000..030e7a8ae --- /dev/null +++ b/test/data/recordings/TestAccPhoneNotificationTemplate.yaml @@ -0,0 +1,777 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 168 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"content":{"from":"+918095250531","body":{"text":"Your password has been changed","voice":"Your password has been changed"}},"type":"change_password","disabled":true} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 372 + uncompressed: false + body: '{"id":"tem_eB3MHus8uwdTPfPV1TWiSb","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"change_password","disabled":true,"created_at":"2025-12-05T15:30:12.547Z","updated_at":"2025-12-05T15:30:12.547Z","content":{"syntax":"liquid","body":{"text":"Your password has been changed","voice":"Your password has been changed"},"from":"+918095250531"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 201 Created + code: 201 + duration: 424.68225ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_eB3MHus8uwdTPfPV1TWiSb + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_eB3MHus8uwdTPfPV1TWiSb","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"change_password","disabled":true,"created_at":"2025-12-05T15:30:12.547Z","updated_at":"2025-12-05T15:30:12.547Z","content":{"syntax":"liquid","body":{"text":"Your password has been changed","voice":"Your password has been changed"},"from":"+918095250531"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 933.100917ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_eB3MHus8uwdTPfPV1TWiSb + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_eB3MHus8uwdTPfPV1TWiSb","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"change_password","disabled":true,"created_at":"2025-12-05T15:30:12.547Z","updated_at":"2025-12-05T15:30:12.547Z","content":{"syntax":"liquid","body":{"text":"Your password has been changed","voice":"Your password has been changed"},"from":"+918095250531"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 367.105ms + - id: 3 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_eB3MHus8uwdTPfPV1TWiSb + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_eB3MHus8uwdTPfPV1TWiSb","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"change_password","disabled":true,"created_at":"2025-12-05T15:30:12.547Z","updated_at":"2025-12-05T15:30:12.547Z","content":{"syntax":"liquid","body":{"text":"Your password has been changed","voice":"Your password has been changed"},"from":"+918095250531"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 369.407167ms + - id: 4 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_eB3MHus8uwdTPfPV1TWiSb + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 366.415917ms + - id: 5 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 165 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"content":{"from":"+1234567890","body":{"text":"Your enrollment code is: @{code}","voice":"Your enrollment code is @{code}"}},"type":"otp_enroll","disabled":false} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 369 + uncompressed: false + body: '{"id":"tem_unfGwbzq8aykhGPih5QLs1","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_enroll","disabled":false,"created_at":"2025-12-05T15:30:16.653Z","updated_at":"2025-12-05T15:30:16.653Z","content":{"syntax":"liquid","body":{"text":"Your enrollment code is: @{code}","voice":"Your enrollment code is @{code}"},"from":"+1234567890"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 201 Created + code: 201 + duration: 417.277458ms + - id: 6 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_unfGwbzq8aykhGPih5QLs1 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_unfGwbzq8aykhGPih5QLs1","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_enroll","disabled":false,"created_at":"2025-12-05T15:30:16.653Z","updated_at":"2025-12-05T15:30:16.653Z","content":{"syntax":"liquid","body":{"text":"Your enrollment code is: @{code}","voice":"Your enrollment code is @{code}"},"from":"+1234567890"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 368.970792ms + - id: 7 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_unfGwbzq8aykhGPih5QLs1 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_unfGwbzq8aykhGPih5QLs1","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_enroll","disabled":false,"created_at":"2025-12-05T15:30:16.653Z","updated_at":"2025-12-05T15:30:16.653Z","content":{"syntax":"liquid","body":{"text":"Your enrollment code is: @{code}","voice":"Your enrollment code is @{code}"},"from":"+1234567890"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 376.18125ms + - id: 8 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_unfGwbzq8aykhGPih5QLs1 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_unfGwbzq8aykhGPih5QLs1","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_enroll","disabled":false,"created_at":"2025-12-05T15:30:16.653Z","updated_at":"2025-12-05T15:30:16.653Z","content":{"syntax":"liquid","body":{"text":"Your enrollment code is: @{code}","voice":"Your enrollment code is @{code}"},"from":"+1234567890"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 349.087583ms + - id: 9 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 145 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"content":{"from":"+9876543210","body":{"text":"Updated enrollment code: @{code}","voice":"Updated enrollment code: @{code}"}},"disabled":true} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_unfGwbzq8aykhGPih5QLs1 + method: PATCH + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_unfGwbzq8aykhGPih5QLs1","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_enroll","disabled":true,"created_at":"2025-12-05T15:30:16.653Z","updated_at":"2025-12-05T15:30:20.261Z","content":{"syntax":"liquid","body":{"text":"Updated enrollment code: @{code}","voice":"Updated enrollment code: @{code}"},"from":"+9876543210"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 363.634209ms + - id: 10 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_unfGwbzq8aykhGPih5QLs1 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_unfGwbzq8aykhGPih5QLs1","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_enroll","disabled":true,"created_at":"2025-12-05T15:30:16.653Z","updated_at":"2025-12-05T15:30:20.261Z","content":{"syntax":"liquid","body":{"text":"Updated enrollment code: @{code}","voice":"Updated enrollment code: @{code}"},"from":"+9876543210"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 352.035708ms + - id: 11 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_unfGwbzq8aykhGPih5QLs1 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_unfGwbzq8aykhGPih5QLs1","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_enroll","disabled":true,"created_at":"2025-12-05T15:30:16.653Z","updated_at":"2025-12-05T15:30:20.261Z","content":{"syntax":"liquid","body":{"text":"Updated enrollment code: @{code}","voice":"Updated enrollment code: @{code}"},"from":"+9876543210"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 359.573834ms + - id: 12 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_unfGwbzq8aykhGPih5QLs1 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_unfGwbzq8aykhGPih5QLs1","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_enroll","disabled":true,"created_at":"2025-12-05T15:30:16.653Z","updated_at":"2025-12-05T15:30:20.261Z","content":{"syntax":"liquid","body":{"text":"Updated enrollment code: @{code}","voice":"Updated enrollment code: @{code}"},"from":"+9876543210"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 544.423583ms + - id: 13 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_unfGwbzq8aykhGPih5QLs1 + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 368.06425ms + - id: 14 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 169 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"content":{"from":"+1111111111","body":{"text":"Your verification code is: @{code}","voice":"Your verification code is @{code}"}},"type":"otp_verify","disabled":false} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 373 + uncompressed: false + body: '{"id":"tem_31KZf7BGaGMAQVqqeGc8Mg","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_verify","disabled":false,"created_at":"2025-12-05T15:30:23.726Z","updated_at":"2025-12-05T15:30:23.726Z","content":{"syntax":"liquid","body":{"text":"Your verification code is: @{code}","voice":"Your verification code is @{code}"},"from":"+1111111111"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 201 Created + code: 201 + duration: 376.532166ms + - id: 15 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_31KZf7BGaGMAQVqqeGc8Mg + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_31KZf7BGaGMAQVqqeGc8Mg","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_verify","disabled":false,"created_at":"2025-12-05T15:30:23.726Z","updated_at":"2025-12-05T15:30:23.726Z","content":{"syntax":"liquid","body":{"text":"Your verification code is: @{code}","voice":"Your verification code is @{code}"},"from":"+1111111111"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 371.897875ms + - id: 16 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_31KZf7BGaGMAQVqqeGc8Mg + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_31KZf7BGaGMAQVqqeGc8Mg","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_verify","disabled":false,"created_at":"2025-12-05T15:30:23.726Z","updated_at":"2025-12-05T15:30:23.726Z","content":{"syntax":"liquid","body":{"text":"Your verification code is: @{code}","voice":"Your verification code is @{code}"},"from":"+1111111111"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 340.267208ms + - id: 17 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_31KZf7BGaGMAQVqqeGc8Mg + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_31KZf7BGaGMAQVqqeGc8Mg","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"otp_verify","disabled":false,"created_at":"2025-12-05T15:30:23.726Z","updated_at":"2025-12-05T15:30:23.726Z","content":{"syntax":"liquid","body":{"text":"Your verification code is: @{code}","voice":"Your verification code is @{code}"},"from":"+1111111111"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 359.542542ms + - id: 18 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_31KZf7BGaGMAQVqqeGc8Mg + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 382.442333ms + - id: 19 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 144 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"content":{"body":{"text":"Your account has been blocked","voice":"Your account has been blocked"}},"type":"blocked_account","disabled":false} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 348 + uncompressed: false + body: '{"id":"tem_r3baZ7EAaWYN75fFxAMJ3A","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"blocked_account","disabled":false,"created_at":"2025-12-05T15:30:27.368Z","updated_at":"2025-12-05T15:30:27.368Z","content":{"syntax":"liquid","body":{"text":"Your account has been blocked","voice":"Your account has been blocked"}}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 201 Created + code: 201 + duration: 547.403084ms + - id: 20 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_r3baZ7EAaWYN75fFxAMJ3A + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_r3baZ7EAaWYN75fFxAMJ3A","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"blocked_account","disabled":false,"created_at":"2025-12-05T15:30:27.368Z","updated_at":"2025-12-05T15:30:27.368Z","content":{"syntax":"liquid","body":{"text":"Your account has been blocked","voice":"Your account has been blocked"}}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 353.190833ms + - id: 21 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_r3baZ7EAaWYN75fFxAMJ3A + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tem_r3baZ7EAaWYN75fFxAMJ3A","tenant":"terraform-provider-auth0-dev","channel":"phone","type":"blocked_account","disabled":false,"created_at":"2025-12-05T15:30:27.368Z","updated_at":"2025-12-05T15:30:27.368Z","content":{"syntax":"liquid","body":{"text":"Your account has been blocked","voice":"Your account has been blocked"}}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 352.593791ms + - id: 22 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + User-Agent: + - Go-Auth0/1.32.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/branding/phone/templates/tem_r3baZ7EAaWYN75fFxAMJ3A + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 459.916625ms diff --git a/test/data/recordings/TestAccPhoneNotificationTemplateInvalidType.yaml b/test/data/recordings/TestAccPhoneNotificationTemplateInvalidType.yaml new file mode 100644 index 000000000..2797c38e0 --- /dev/null +++ b/test/data/recordings/TestAccPhoneNotificationTemplateInvalidType.yaml @@ -0,0 +1,3 @@ +--- +version: 2 +interactions: []