Skip to content

auth0 tf generate should use resource references rather than hard coded ids #1284

Closed

Description

@DavidJFowler

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

The generated Terraform should add references to other resources using a reference rather than a hard coded id.

For example, an action:

resource "auth0_action" "addmetadata" {
  code    = "..."
  # ...
}

Is included in a trigger with a hardcoded id reference:

resource "auth0_trigger_actions" "post_login" {
  trigger = "post-login"
  actions {
    display_name = "addMetadata"
    id           = "b71d0266-384c-0000-b3e2-b2c46b749b01"
  }
}

This pattern seems to be used throughout the generated code.

Expectation

It would be better if the resource shown above was generated with a reference to `auth0_action.addmetadata.id`:
```terraform
resource "auth0_trigger_actions" "post_login" {
  trigger = "post-login"
  actions {
    display_name = "addMetadata"
    id           = auth0_action.addmetadata.id
  }
}

Reproduction

run auth0 tf generate

Auth0 CLI version

auth0 version 1.16.0 5b84dc8

Activity

  1. added
    bugThis points to a verified bug in the code
    on Jul 24, 2025
  2. ramya18101 commented on Aug 1, 2025

    @ramya18101
    Contributor

    Thank you for your suggestion and for highlighting the benefits of using resource references in the generated Terraform code.

    The main goal of auth0 tf generate, as described in our documentation, is to produce a snapshot of your current Auth0 tenant configuration for backup, migration, or bootstrapping purposes. To keep the generated output simple and consistent with the actual tenant state, the tool outputs static resource IDs rather than Terraform references.

    At this time, we do not plan to add support for generating references, We appreciate your understanding and feedback.

  3. ramya18101 commented on Aug 7, 2025

    @ramya18101
    Contributor

    Moving to discussions to gather more feedback from the community about this requirement. If we see more interest or traction from other users, we’ll definitely revisit this and try to include it in our future planning.

  4. locked and limited conversation to collaborators on Aug 7, 2025
  5. converted this issue into a discussion #1297 on Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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