auth0/terraform-provider-auth0

auth0 cli not importing email templates, hooks and rules

tranceporter opened this issue · 2 comments

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 provider 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

Hello,

I am using latest cli (1.4.0) and latest tf provider version (1.2.0). I am using TF version 1.6.x. I have generated an M2M app for Terraform import with full access (All scopes checked) to Auth0 Management API. From what I can see, I have one "auth0_connection" of type email that has a default template (lots of flattened and escaped html), but there are no auth0_email_template resources or hooks or rules. I ran the cli command to list email templates, and I can see all of them.

image

Rules

image

I cannot seem to find cli command for showing hooks, so unsure how to list them. I have instead taken screenshots from UI.

image image

We are using SNS for SMS MFA, and none of that configuration seems to have been imported. I have tried adding the --debug flag to auth0 tf generate command, and I do not get any errors (in fact there is no debug output)

image

Can you please guide me?

Thanks,
Shreyas

Expectation

All resources should be imported into terraform by Auth0 CLI. Since hooks and rules will not be deprecated by Nov 2024, we should still have time to migrate them over.

Reproduction

Given that auth0 cli has full access to Auth0 Management API, auth0 tf generate should import all resources in tf configuration.

Auth0 Terraform Provider version

1.2.0

Terraform version

1.6.4

To add to the above, I just checked the auth0 cli page, and none of the missing resources above seem to be listed in auth0 tf generate docs

--force Skip confirmation.
-o, --output-dir string Output directory for the generated Terraform config files. If not provided, the files will be saved in the current working directory. (default "./")
-r, --resources strings Resource types to generate Terraform config for. If not provided, config files for all available resources will be generated. (default [auth0_action,auth0_attack_protection,auth0_branding,auth0_client,auth0_client_grant,auth0_connection,auth0_custom_domain,auth0_email_provider,auth0_guardian,auth0_organization,auth0_pages,auth0_prompt,auth0_prompt_custom_text,auth0_resource_server,auth0_role,auth0_tenant,auth0_trigger_actions])

Does this mean I cannot import them? Or maybe I need an older version of cli?

@tranceporter Hello. Apologies for a delayed response on this.
Your understanding is correct that we presently only support a limited number of resources while exporting from auth0 cli.

Ideally, adding a new fetcher on the below file should allow an import of hooks/rules.
https://github.com/auth0/auth0-cli/blob/main/internal/cli/terraform.go

Having said that, since we have plans on deprecating hooks and rules and moving to actions, I cannot provide a certainty or a timeline if we'd extend the CLI's functionality to support a near deprecating resource.

Also, if you're at a point where you must need this feature, you may refer to this small PR which highlights how we can add a new resource:
https://github.com/auth0/auth0-cli/pull/833/files

Once the changes are made, you can install that version of the cli by running make install and then go on to import hooks/rules etc.

I hope this is helpful to you.
Appreciate your understanding.