Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DXCDT-540: Prevent null string literal when importing custom text prompts #821

Merged

Conversation

willvedd
Copy link
Contributor

@willvedd willvedd commented Sep 8, 2023

🔧 Changes

When using Terraform config-driven imports with the auth0_prompt_custom_text resource, there can be cases where the body property gets generated literally as "null". This occurred because the Management API returns an empty object string literal "{}" for unconfigured custom text prompts and would get interpreted somewhere in the Terraform SDK as nil which would cause a bit of havoc when marshalling back to a string.

With this PR, the generated custom text prompt looks like this:

resource "auth0_prompt_custom_text" "fr_signup" {
  body     = "{}"
  language = "fr"
  prompt   = "signup"
}

This is preferred because it matches the output of the Management API.

🔬 Testing

Added unit tests to enable empty object as body property. Manually verified that config-driven import works as expected.

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

@willvedd willvedd requested a review from a team as a code owner September 8, 2023 19:03
@codecov-commenter
Copy link

Codecov Report

Merging #821 (061dc5c) into v1 (d292300) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##               v1     #821   +/-   ##
=======================================
  Coverage   90.38%   90.38%           
=======================================
  Files          99       99           
  Lines       13525    13528    +3     
=======================================
+ Hits        12224    12227    +3     
  Misses        924      924           
  Partials      377      377           
Files Changed Coverage Δ
internal/auth0/prompt/flatten.go 67.85% <100.00%> (+3.85%) ⬆️

@sergiught sergiught merged commit 47219be into v1 Sep 11, 2023
4 checks passed
@sergiught sergiught deleted the DXCDT-540-prevent-null-string-import-custom-text-prompts branch September 11, 2023 13:03
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.

4 participants