Skip to content

auth0_connection (sms strategy): expose options.use_phone_provider to manage the per-connection Unified Phone Experience flag #1549

Description

@vr

Checklist

Describe the problem you'd like to have solved

When migrating an existing tenant from a legacy SMS gateway to the Unified Phone Experience (UPE) for Passwordless via the custom-phone-provider Action, the dashboard exposes a toggle:

Authentication > Passwordless > SMS > Use Tenant-Level Messaging Provider

Enabling this toggle writes a hidden field options.use_phone_provider: true (the string "unified" is also accepted) on the SMS connection. Without it, Passwordless requests on legacy tenants continue to be routed through the connection's provider: "sms_gateway" settings, bypassing the configured tenant phone provider / Action — even when:

  • auth0_phone_provider is set to name = "custom" and disabled = false
  • A custom-phone-provider (v1) Action is deployed and bound via auth0_trigger_actions
  • auth0_tenant.flags.phone_consolidated_experience = true

This field is currently not exposed by the provider (any version up to and including v1.44.0) nor by the underlying auth0/go-auth0 SDK, so it's impossible to flip this toggle from Terraform. Tenants created after UPE became default appear to route Passwordless via the tenant phone provider without this flag, which is why the gap is invisible until you migrate an older tenant.

Repro on a tenant created before UPE became default:

resource "auth0_connection" "sms" {
  strategy = "sms"
  options {
    provider               = "sms_gateway"
    gateway_url            = "https://example.com/otp"
    gateway_authentication { ... }
    # no way to set use_phone_provider = true here
  }
}

`terraform apply` succeeds, the Action is bound, the tenant phone provider is `custom`, but Passwordless SMS keeps hitting the legacy gateway

### Describe the ideal solution

Add support for `options.use_phone_provider` (boolean) on `auth0_connection` when `strategy = "sms"`:

```hcl
resource "auth0_connection" "sms" {
  strategy = "sms"
  options {
    use_phone_provider = true
    # ...
  }
}

It should map to the options.use_phone_provider field returned by GET /api/v2/connections/{id} and survive PATCH round-trips.

Alternatives and current workarounds

  1. Direct PATCH /connections/{id} via Management API. Works (HTTP 200), but PATCH on options is a full replace, not a merge — sending {"options":{"use_phone_provider":true}} wipes all other connection options (template, gateway settings, totp, brute_force_protection, etc.). The full options payload (including the write-only gateway_authentication.secret) must be re-sent each time. The dashboard itself fails on this with Payload validation error: 'Missing required property: secret' on property options.gateway_authentication because it doesn't know the masked secret.

  2. null_resource + local-exec curl triggered on sha256(jsonencode(auth0_connection.sms.options)) to re-PATCH the flag after every Terraform-driven update of the connection. Works but fragile and bypasses the provider's drift detection.

  3. Mastercard/restapi provider to manage just this field — adds a whole provider for a single attribute.

Additional context

Adding this single attribute would close the last gap preventing a fully Terraform-managed migration to the Unified Phone Experience for Passwordless on legacy tenants.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions