Skip to content

Add phone notification template support to terraform generation#1514

Open
bkiran6398 wants to merge 2 commits intomainfrom
DXCDT-1632/tf_generate_resource
Open

Add phone notification template support to terraform generation#1514
bkiran6398 wants to merge 2 commits intomainfrom
DXCDT-1632/tf_generate_resource

Conversation

@bkiran6398
Copy link
Copy Markdown
Contributor

🔧 Changes

Adds auth0_phone_notification_template resource support to the auth0 tf generate command.

  • Introduces PhoneNotificationTemplateAPI interface backed by the go-auth0 v2 SDK (m.Branding.Phone.Templates)
  • Implements phoneNotificationTemplateResourceFetcher that lists phone notification templates and generates Terraform import blocks
  • Extends parseResourceFetchers to accept *auth0.APIV2 alongside the existing v1 API, enabling v2 SDK usage in the terraform generation flow
  • Adds auth0_phone_notification_template to the default resources list so it is included in generation by default

📚 References

🔬 Testing

  • 3 unit tests added for phoneNotificationTemplateResourceFetcher:
    • Success path with multiple templates
    • Empty list returns nil
    • API error propagation
  • Existing TestTerraformInputs_ParseResourceFetchers updated and extended with a new test case for the resource
  • All existing terraform tests continue to pass
go test ./internal/cli/ -run "Test.*[Tt]erraform" -v -count=1
go test ./internal/auth0/... -count=1
  • Manually verified generation:
./auth0 terraform generate -o tf-import-test -r auth0_phone_notification_template                                                         3s
Fetching data from Auth0... done
 ▸    Output directory "tf-import-test" is not empty. Proceeding will overwrite the auth0_main.tf, auth0_import.tf and auth0_generated.tf files.
 Are you sure you want to proceed? Yes
Generating Terraform configuration... done
 ▸    Terraform resource config files generated successfully in: tf-import-test
 ▸    Review the config and generate the terraform state by running: 

        cd tf-import-test && ./terraform apply

 ▸    Once Terraform files are auto-generated, the terraform binary and auth0_import.tf files can be deleted.

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

@bkiran6398 bkiran6398 requested a review from a team as a code owner May 7, 2026 12:25
- Introduced PhoneNotificationTemplateAPI to manage phone notification templates.
- Updated APIV2 to include PhoneNotificationTemplate.
- Enhanced resource fetchers to support fetching phone notification templates.
- Modified terraform command parsing to accommodate new resource type.
- Added tests for phone notification template fetching functionality.
@bkiran6398 bkiran6398 force-pushed the DXCDT-1632/tf_generate_resource branch from d675301 to 6911a52 Compare May 7, 2026 12:34
…essed

- Added a check to ensure that only templates with a non-empty ID are appended to the import data list in the FetchData method of the phoneNotificationTemplateResourceFetcher.
- This change prevents potential errors when processing templates without valid IDs, improving the robustness of the data fetching logic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support auth0_phone_notification_template resources for tf generate

1 participant