Updating auth0-guardian resource with Terraform returns "Error: 400 Bad Request: Payload validation error."

Problem statement

We recently integrated Twilio Verify for MFA SMS messages but ran into a problem. When adding the code in Terraform, I noticed I get a failure when making Terraform applies where it complains that under the auth0_guardian resource is missing the provider property, but that property does indeed exist. I believe this is only happening when setting the provider to phone-message-hook . I have noticed that when I revert the provider to twilio , do a Terraform apply, then change the provider to phone-message-hook , and then do an apply, it actually works successfully. However, any subsequent applies using phone-message-hook as the provider will fail with the below error message until I repeat the previous steps of reverting to Twilio and back. In addition, the Auth0 logs showed the following relevant message:

Guardian - ExtensibilityLogicError on send-phone-message-hook: Authenticate

Any insight or workarounds?

╷
│ Error: 400 Bad Request: Payload validation error: 'Missing required property: provider'.
│
│ with module.auth0-sandbox.auth0_guardian.default,
│ on ../../modules/auth0/[main.tf](http://main.tf/) line 1471, in resource "auth0_guardian" "default":
│ 1471: resource "auth0_guardian" "default" {
│

Troubleshooting

Example resource:

resource "auth0_guardian" "default" {
  policy = "never"
  phone {
    provider = "phone-message-hook"
    message_types = ["sms"]
    options {
      sid = var.twilio_sid
      auth_token = var.twilio_auth_token
      messaging_service_sid = var.twilio_verify_sid
      enrollment_message = "test"
      verification_message = "test"
    }
  }
}

Cause

There was a version change in the payload requirement for the auth0-guardian resource. Upgrading to at least v0.31.0 was enough to get things working for this customer.

Solution

We recommend upgrading the Terraform provider to at least v0.31.0.