Skip to content

Deprecate enabled_clients in auth0_connection and update API endpoints #1272

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

duedares-rvj
Copy link
Member

@duedares-rvj duedares-rvj commented Jun 6, 2025

🔧 Changes

EnabledClients attribute is now deprecated from Connections schema.
Provider currently supports two resources auth0_connection_client and auth0_connection_clients to manage 1:1 and 1:many mapping between Connection and Client/s.

The underlying CRUD logic has been updated to ensure the behaviour of the resources and data-source remains exactly the same, even with the newly introduced endpoints : ReadEnabledClients and UpdateEnabledClients

📚 References

Go-sdk changes: auth0/go-auth0#556

🔬 Testing

All the old test cases passed - ensuring the changes works in harmony with the pre-exiting resource/data-source.
Test recordings have been updated.

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

@duedares-rvj duedares-rvj requested a review from a team as a code owner June 6, 2025 10:25
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 64.81481% with 38 lines in your changes missing coverage. Please review.

Project coverage is 88.52%. Comparing base (66f3810) to head (581a5e7).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
internal/auth0/connection/resource_clients.go 59.32% 16 Missing and 8 partials ⚠️
internal/auth0/connection/resource_client.go 70.37% 5 Missing and 3 partials ⚠️
internal/auth0/connection/data_source.go 40.00% 4 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1272      +/-   ##
==========================================
- Coverage   88.52%   88.52%   -0.01%     
==========================================
  Files         141      142       +1     
  Lines       19536    19865     +329     
==========================================
+ Hits        17295    17586     +291     
- Misses       1615     1643      +28     
- Partials      626      636      +10     
Files with missing lines Coverage Δ
internal/auth0/connection/flatten.go 80.63% <100.00%> (+0.38%) ⬆️
internal/auth0/connection/data_source.go 81.94% <40.00%> (-7.29%) ⬇️
internal/auth0/connection/resource_client.go 83.33% <70.37%> (+1.96%) ⬆️
internal/auth0/connection/resource_clients.go 73.75% <59.32%> (-10.46%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@kushalshit27 kushalshit27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a breaking change for existing users if they update the provider? Is there any behaviour change ?

@kushalshit27 kushalshit27 requested a review from Copilot June 12, 2025 07:24
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the deprecated enabled_clients field on the main auth0_connection resource and updates all CRUD operations and data sources to use the new ReadEnabledClients/UpdateEnabledClients endpoints.

  • Test recordings updated to reflect new client IDs, endpoint URLs, and response formats
  • Refactored resource_clients.go and resource_client.go to call ReadEnabledClients/UpdateEnabledClients instead of embedding EnabledClients on the Connection object
  • Adjusted flatten helpers and data source logic to consume the new client‐list responses

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/data/recordings/TestAccConnectionClientsPreventErasingEnabledClientsOnCreate.yaml Updated HTTP interactions to use new client IDs, /clients paths, and adjusted durations
test/data/recordings/TestAccConnectionClientsImport.yaml Updated import recordings with new connection/client IDs and endpoint URLs
internal/auth0/connection/resource_clients_test.go Bumped ImportStateId values to the new IDs
internal/auth0/connection/resource_clients.go Switched from Connection.Update to UpdateEnabledClients, added guard vs. wiping clients
internal/auth0/connection/resource_client.go Refactored single‐client resource to use UpdateEnabledClients
internal/auth0/connection/flatten.go Extended flatten functions to accept ConnectionEnabledClientList
internal/auth0/connection/data_source_test.go Renamed data source blocks to distinct IDs in tests
internal/auth0/connection/data_source.go Added ReadEnabledClients calls and updated flattenConnectionForDataSource invocation
Comments suppressed due to low confidence (1)

internal/auth0/connection/resource_clients.go:61

  • Potential nil pointer dereference: GetRawConfig().GetAttr("enabled_clients") may return nil if the attribute isn't explicitly set. Consider checking for nil or falling back to an empty slice before dereferencing rawEnabledClients.
rawEnabledClients := value.Strings(data.GetRawConfig().GetAttr("enabled_clients"))

if err := api.Connection.Update(ctx, connectionID, connectionWithEnabledClients); err != nil {
return diag.FromErr(internalError.HandleAPIError(data, err))
if err := api.Connection.UpdateEnabledClients(ctx, connectionID, payload); err != nil {
return diag.FromErr(err)
Copy link
Preview

Copilot AI Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Error handling here returns the raw error; for consistency with other operations, wrap this with internalError.HandleAPIError(data, err) to produce uniform diagnostics.

Suggested change
return diag.FromErr(err)
return diag.FromErr(internalError.HandleAPIError(data, err))

Copilot uses AI. Check for mistakes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@duedares-rvj please check

@duedares-rvj
Copy link
Member Author

Is it a breaking change for existing users if they update the provider? Is there any behaviour change ?

No, we have ensured that this is not a breaking change. The schema of the resource and data-source are left untouched. Only the underlying CRUD logic has been updated to accommodate the exact same behaviour of the provider. All existing test cases have passed.

kushalshit27
kushalshit27 previously approved these changes Jun 13, 2025
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