Get id of email providers

Hi!

I hope this is the right place to ask this question.

I’m trying to use terraform to configure an existing auth0 tenant so I can store the e-mail templates. I’m using the community Auth0 provider created by alexkappa .

This provider works great and it is possible to create and configure email templates and email providers for new tenants / domains.

But, because I have an existing domain, I need to import these resources into terraform. It’s possible to do so by using their id.

For example, if you would like to import an existing connection you can retrieve the id of the connection by running this:

https://{domain}/api/v2/connections?fields=id

And by using that id you can import the resources to terraform:

terraform import auth0_connection.my_connection con_000000000000000

To do the same for the email provider, I need its id. But I struggling to retrieve this id and in the documentation I can’t find anything.

Perhaps it’s a silly question, but does the email template have an id? And if so, how can I retrieve it?

Thanks in advance,

Bart

Hi @bart4,

I’m not too familiar with terraform, but I might be able to help you find the data you need :slight_smile:. Unlike connections, email templates are identified by their name instead of an ID.

GET/api/v2/email-templates/{templateName}

Example:

https://tenant-domain/api/v2/email-templates/verify_email

There is only one email provider per tenant, so no identifier is used.
GET/api/v2/emails/provider

Example:

https://tenant-domain/api/v2/emails/provider

It might be helpful to look at the source code of the project you linked and take a look at the data its expecting:

2 Likes

Hi @stephanie.chamblee

Thanks for your reply and your explanation. Unfortunately your reply confirms what I was afraid of, the terraform provider is not yet capable of importing these resources.

I tried importing the email provider resource by name but it does not work. I will try to dive in the provider source code to see if I missed something there. I will open a request at the provider and perhaps I might be able to contribute this myself.

But thank you for your answer.

Bart

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.