-
Notifications
You must be signed in to change notification settings - Fork 89
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
GH-853: Allow deleting branding resource even on free tenants #875
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,16 +166,10 @@ func updateBranding(ctx context.Context, data *schema.ResourceData, meta interfa | |
func deleteBranding(ctx context.Context, _ *schema.ResourceData, meta interface{}) diag.Diagnostics { | ||
api := meta.(*config.Config).GetAPI() | ||
|
||
if err := checkForCustomDomains(ctx, api); err != nil { | ||
if err == errNoCustomDomain { | ||
return nil | ||
if err := checkForCustomDomains(ctx, api); err == nil { | ||
if err := api.Branding.DeleteUniversalLogin(ctx); err != nil { | ||
return diag.FromErr(err) | ||
} | ||
|
||
return diag.FromErr(err) | ||
} | ||
|
||
if err := api.Branding.DeleteUniversalLogin(ctx); err != nil { | ||
return diag.FromErr(err) | ||
} | ||
|
||
return nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you're inverting the if/else, shouldn't you be returning There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we get no error it means we're not a free tier tenant and we have the ability to delete the universal login template data, otherwise we can't, so we shouldn't return the error in that case but allow for a successful deletion of the resource. Please also check above: #875 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update: Ok with ignoring the errors for now because they would be unlikely and it is too difficult to identify the specific errors that we would want to keep or ignore. Especially provided that this is a deletion operation. |
||
|
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.
This is now aligned with the read logic found here
terraform-provider-auth0/internal/auth0/branding/resource.go
Line 121 in 0a39d61