keenauth_management_client

The keenauth_management_client resource sets the management API access of an application with app_type = "management": the permissions and the IP allowlist with which the application's machine-to-machine client may call the management API. An application has at most one record, and the record is identified by the application ID.

Least privilege

This resource grants access to the management API. Keep it narrow:

The API key that applies the configuration can grant only permissions and networks that it has itself.

resource "keenauth_application" "ops" {
  key      = "ops-automation"
  name     = "Ops automation"
  app_type = "management"
  party    = "first_party"
}

resource "keenauth_management_client" "ops" {
  application_id = keenauth_application.ops.id
  permissions    = ["users:read", "applications:read"]
  allowed_cidrs  = ["203.0.113.0/24"]
}

Signing keys

The resource holds no secret and no key. Register the application's public key with POST /v1/applications/{application_id}/credentials (type: public_key) in the CLI or the dashboard. The API rejects jwks_uri and public_keys on this resource.

allowed_cidrs in the plan

Errors

Error Meaning
403 insufficient_permissions Only an API key can manage these records; use a provider configured with api_key, not client_id + private_key. With an API key, a restricted key is missing management-clients:read or management-clients:write.
403 permission_escalation The record would have permissions or networks that the API key does not have.
404 on create The application does not exist in the environment of the API key.
409 The application already has a record. Import it.
422 on application_id The application is not of type management.
412 The record changed after the plan. Nothing was changed; run plan again.

Import

Import by application ID:

tofu import keenauth_management_client.ops app_01j9zq3v8c5m2x7k4t6r1n0b3d