-
Notifications
You must be signed in to change notification settings - Fork 91
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-462: Adding optional display_name
field to auth0_trigger_action
resource
#621
Conversation
if d.GetRawConfig().GetAttr("display_name").IsNull() { | ||
action, err := api.Action.Read(actionID) | ||
if err != nil { | ||
return diag.FromErr(err) | ||
} | ||
return diag.FromErr(err) | ||
displayName = action.GetName() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is the most effective way of detecting an undefined display name. Open to suggestions on how to improve.
@@ -55,6 +65,15 @@ func TestAccTriggerAction(t *testing.T) { | |||
Check: resource.ComposeTestCheckFunc( | |||
resource.TestCheckResourceAttr("auth0_trigger_action.my_action_post_login", "trigger", "post-login"), | |||
resource.TestCheckResourceAttrSet("auth0_trigger_action.my_action_post_login", "action_id"), | |||
resource.TestCheckNoResourceAttr("auth0_trigger_action.my_action_post_login", "display_name"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if there's a way to check the computed value here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well we know that it will take the name of the action by default, so we can check for that one: Test Action {{.testName}}
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's in direct conflict with TestCheckNoResourceAttr
.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #621 +/- ##
==========================================
- Coverage 86.38% 86.33% -0.05%
==========================================
Files 79 79
Lines 12207 12259 +52
==========================================
+ Hits 10545 10584 +39
- Misses 1278 1287 +9
- Partials 384 388 +4
|
if mErr, ok := err.(management.Error); ok && mErr.Status() == http.StatusNotFound { | ||
d.SetId("") | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't ignore the 404 here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you be more specific? This is consistent across the entire codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's consistent across the entire codebase for resources that get created and get deleted. The set of triggers is static and is not something a customer can create or delete.
err = d.Set("display_name", binding.GetDisplayName()) | ||
if err != nil { | ||
return diag.FromErr(err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err = d.Set("display_name", binding.GetDisplayName()) | |
if err != nil { | |
return diag.FromErr(err) | |
} | |
return diag.FromErr(d.Set("display_name", binding.GetDisplayName())) |
@@ -55,6 +65,15 @@ func TestAccTriggerAction(t *testing.T) { | |||
Check: resource.ComposeTestCheckFunc( | |||
resource.TestCheckResourceAttr("auth0_trigger_action.my_action_post_login", "trigger", "post-login"), | |||
resource.TestCheckResourceAttrSet("auth0_trigger_action.my_action_post_login", "action_id"), | |||
resource.TestCheckNoResourceAttr("auth0_trigger_action.my_action_post_login", "display_name"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well we know that it will take the name of the action by default, so we can check for that one: Test Action {{.testName}}
.
Co-authored-by: Sergiu Ghitea <[email protected]>
…/github.com/auth0/terraform-provider-auth0 into DXCDT-462-auth0-action-trigger-display-name
…/github.com/auth0/terraform-provider-auth0 into DXCDT-462-auth0-action-trigger-display-name
Type: schema.TypeString, | ||
Optional: true, | ||
Computed: true, | ||
Description: "The name for this action within the trigger. This can be useful for distinguishing between multiple instances of the same action bound to a trigger.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great to specify that this defaults to the action name if not set.
return nil | ||
if displayName == "" { | ||
action, err := api.Action.Read(actionID) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…/github.com/auth0/terraform-provider-auth0 into DXCDT-462-auth0-action-trigger-display-name
🔧 Changes
The initial iteration of the
auth0_trigger_action
resource (#612) did not include a display name field. This field is used to assign a distinguishable name to a specific instance of an action within a flow. This can be useful in cases where there are multiple instances of the same action with a flow, albeit configured differently. Theauth0_trigger_actions
resource does include this property so for API consistency, this PR adds thedisplay_name
property too.📚 References
auth0_trigger_action
DXCDT0-425:auth0_trigger_action
#612🔬 Testing
Adding new test cases.
📝 Checklist