Skip to content

Conversation

@bkiran6398
Copy link

@bkiran6398 bkiran6398 commented Jan 28, 2026

🔧 Changes

This PR enhances the Terraform generation feature with two key improvements:

  1. Added support for auth0_prompt_screen_partial resource - The terraform generate command now includes support for generating configuration for prompt screen partials across various login and signup screens (login, login-id, login-password, login-passwordless, signup, signup-id, signup-password, and customized-consent).

  2. Improved handling of sensitive fields - Implemented automatic detection and processing of sensitive fields that cannot be exported via the Management API. When terraform plan fails due to sensitive null values, the CLI now automatically replaces them with empty strings and adds TODO comments, allowing users to manually provide the required values.

Additional improvements include standardizing file name constants throughout the codebase for better maintainability.

📚 References

N/A

🔬 Testing

Automated Testing:

  • Added unit tests for the new promptScreenPartialResourceFetcher to verify correct generation of import statements for screen partials
  • Added unit tests for sensitive field detection and processing (hasSensitiveNullValues and processSensitiveFieldsInConfig)
  • Updated existing tests to reflect expanded list of custom text prompt types
  • All existing terraform generation tests continue to pass

Manual Testing:

  1. Ran auth0 terraform generate with auth0_prompt_screen_partial resource included
  2. Verified that import statements are generated for supported prompt screen partials
  3. Tested with resources that have sensitive fields to verify automatic handling and TODO comment generation

📝 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)

- Reformatted the `customTextPromptTypes` array for better readability.
- Added new prompt types: `email_identifier_challenge` and `passkeys`.
- This change enhances the prompt handling capabilities in the `terraform_fetcher.go` file.
- Introduced `promptScreenPartialResourceFetcher` to handle fetching data for screen partial prompts.
- Updated `parseResourceFetchers` method in `terraform.go` to include the new fetcher for "auth0_prompt_screen_partial".
- Added a mapping for screen partial prompt types to their corresponding screens in `terraform_fetcher.go`.
- This enhancement allows for better management and retrieval of screen partial prompts in the CLI.
- Added missing custom text prompt types including "login-passwordless", "phone-identifier-enrollment", and others to enhance prompt coverage.
- Removed outdated TODO comments to improve code clarity.
- Updated references in comments for better documentation and accuracy.
- Refactored the promptTypes array in TestPromptCustomTextResourceFetcher to improve readability and added new prompt types.
- Introduced Test_promptScreenPartialResourceFetcher to validate the retrieval of screen partial prompts data.
- Ensured that the new tests cover various scenarios for screen partial prompts, enhancing overall test coverage.
- Updated the default resources list to include `auth0_prompt_screen_partial`.
- This change allows users to generate Terraform configurations for screen partial prompts, enhancing the flexibility of the `auth0 terraform generate` command.
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.99%. Comparing base (72153d5) to head (2b05189).
⚠️ Report is 52 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1426      +/-   ##
==========================================
- Coverage   64.51%   58.99%   -5.53%     
==========================================
  Files         108      117       +9     
  Lines       17959    20421    +2462     
==========================================
+ Hits        11586    12047     +461     
- Misses       5615     7587    +1972     
- Partials      758      787      +29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- Eliminated "async-approval-flow" from the customTextPromptTypes slice in terraform_fetcher.go.
- This prompt type is not supported in go-auth0 and terraform provider.
- Consolidated the definition of `customTextPromptTypes` in `terraform_fetcher.go` and `terraform_fetcher_test.go` to a single line for improved readability.
- This change reduces visual clutter and maintains consistency across the codebase.
- No functional changes were made; the prompt types remain the same.
…her_FetchData

- Changed assertion from assert.Equal to assert.ElementsMatch to ensure
  that the order of elements in the fetched data does not affect the test
  outcome.
- Introduced functions to check for and process sensitive fields in the generated Terraform config.
- Added `hasSensitiveNullValues` to identify sensitive fields set to null.
- Implemented `processSensitiveFieldsInConfig` to replace sensitive null values with empty strings and a TODO comment.
- Created `replaceSensitiveNullWithEmptyString` to modify the content of the generated config file accordingly.
- Enhances security by ensuring sensitive values are flagged for user input.
- Introduced constants for Terraform file names: `mainTFFileName`, `importTFFileName`, and `generatedTFFileName`.
- Updated all references in the codebase to use these constants for better maintainability and readability.
- Ensured consistency across functions like `createMainFile`, `createImportFile`, and `generateTerraformResourceConfig`.
- Improved error messages and assertions in tests to reflect the new constants.
…config

- Introduced new test cases to validate the handling of sensitive fields in Terraform configurations.
- Implemented `Test_hasSensitiveNullValues` to check for presence of sensitive null values.
- Added `Test_processSensitiveFieldsInConfig` to ensure sensitive fields are replaced correctly.
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.

3 participants