Skip to content

auth0 tf generate fails when connection name contains only digits #1293

@Ga13Ou

Description

@Ga13Ou

Checklist

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

Description

Hi team,

I encountered a bug when using the auth0 tf generate command when we have at least one connection whose name consists only of digits (e.g., "123456").

Fetching data from Auth0... done
 ▸    Output directory "./" is not empty. Proceeding will overwrite the auth0_main.tf, auth0_import.tf and auth0_generated.tf files.
Generating Terraform configuration... failed
 ▸    Terraform resource config generated successfully but there was an error with terraform plan.


 ▸    Run ./terraform plan to troubleshoot


 ▸    Once the plan succeeds, run ./terraform apply to complete the import.


 ▸    The terraform binary and auth0_import.tf files can be deleted afterwards.

What I noticed:

When a Connection name start with a digit and contains other characters (e.g., "123aabbcc"). The generated terraform resource will be auth0_connection.aabbcc which is a valid resource name.
However, when the connection name only contains digits (e.g., "123456") the generation fails to generate the auth0_generated.tf file with the message Generating Terraform configuration... failed. And the auth0_import.tf file will contain an invalid import block as follows

import {
  id = "con_<redacted>"
  to = auth0_connection.
}

import {
  id = "con_con_<redacted>"
  to = auth0_connection_clients.
}

Actual result:

Only the following files are generated:

  • auth0_import.tf
  • auth0_main.tf
  • terraform

Expectation

Terraform resources are generated successfully, including all the following files:

  • auth0_import.tf
  • auth0_main.tf
  • auth0_generated.tf
  • terraform

Reproduction

  1. Create a Entreprise Saml connection in Auth0 with a name that contains only numbers (e.g., 123456).
  2. Run auth0 tf generate to generate the Terraform configuration.

Auth0 CLI version

1.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis points to a verified bug in the code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions