auth0-deploy-cli icon indicating copy to clipboard operation
auth0-deploy-cli copied to clipboard

Warn when resources have same names during import

Open darcien opened this issue 2 years ago • 3 comments

Checklist

  • [X] I have looked into the README and have not found a suitable solution or answer.
  • [X] I have looked into the documentation and have not found a suitable solution or answer.
  • [X] I have searched the issues and have not found a suitable solution or answer.
  • [X] I have upgraded to the latest version of this tool and the issue still persists.
  • [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • [X] I agree to the terms within the Auth0 Code of Conduct.

Description

TL;DR exporting tenant that has multiple clients with the same name with a0deploy export --format=directory will merge the config into a single JSON file without any warnings.

I've seen this issue https://github.com/auth0/auth0-deploy-cli/issues/98 that mention clients name must be unique.

But when exporting as directory, there was no warning and the CLI happily merged the clients with the same name name into one JSON file.

I just noticed this issue after doing a0deploy import and it failed to update the client connections. In the meantime, I can update the tenant to not use duplicate names.

Expectation

It would be nice if the a0deploy export --format=directory command logs a warning or just error out when duplicate client names are found.

Or this behavior/limitation could be mentioned in the docs.

Reproduction

  1. Given Auth0 tenant with duplicate client names
  2. When running a0deploy export --format=directory for that tenant
  3. It should warn or error telling the user that duplicate client names are found and is invalid.

Deploy CLI version

7.17.0

Node version

16.14.0

darcien avatar Mar 21 '23 06:03 darcien

Thanks for the suggestion, I agree that a warning or error would be beneficial in these cases. A core assumption of the Deploy CLI is that all resources have unique names for a single tenant, it is how the tenant-agnostic behavior is enabled. It is my opinion that resources with the same name is an anti-pattern for tenant management, but perhaps your use case is reasonable. For now, I advise to have separate names for your clients but will keep this request open because it is still a valid pain point that could be addressed.

willvedd avatar Mar 24 '23 15:03 willvedd

Hi all,

I've just hit this migrating a test domain to a prod one. The Management API and UX allow me to create as many clients/m2m clients etc. as I want with the same name. Obviously the client_id is the unique element.

At the creation stage these unique naming elements should be enforced.

I don't understand why this fails and why an export and import aren't EXACTLY the same. The export doesn't contain any secrets or client_ids. Why was that decision made as the domain is unique etc.

Thanks.

ghenry avatar Apr 25 '23 14:04 ghenry

Nevermind, I've enabled the export of these fields using INCLUDED_PROPS

Thanks!

ghenry avatar Apr 25 '23 15:04 ghenry