Skip to content

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

@DavidJFowler

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

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