Overview
This article will discuss the following Terraform error when attempting to create a Custom Email Provider:
409 Conflict: No deployed action of type custom-email-provider was found
Applies To
- Terraform
- Custom email provider
- Actions
Cause
In Terraform, both an Action and email provider resource to configure this custom email provider option. For example:
resource "auth0_email_provider" "custom_email_provider" {
default_from_address = "sample@test.com"
enabled = true
name = "custom"
credentials {}
}
resource "auth0_action" "custom-email-provider-1" {
code = <<-EOT
/**
* Handler that will be called during the execution of a PostLogin flow.
*
* @param {Event} event - Details about the user and the context in which they are logging in.
* @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
*/
exports.onExecutePostLogin = async (event, api) => {
console.log(event);
};
EOT
name = "Custom Email Provider"
runtime = "node18"
deploy = true
supported_triggers {
id = "custom-email-provider"
version = "v1"
}
dependencies {}
}
The above resources, as configured, will produce the error in question. This is due to a race condition since the Action needs to exist before the custom email provider can be created by Terraform.
Solution
Update the custom email provider resource with the depends_on
attribute to avoid this race condition. The resource should look something like this:
resource "auth0_email_provider" "custom_email_provider" {
depends_on = [auth0_action.custom-email-provider-1]
default_from_address = "sample@test.com"
enabled = true
name = "custom"
credentials {}
}
Related References
- More on the
depends_on
attribute can be read about in Terraform documentation: The depends_on Meta-Argument