keenauth_permission
The keenauth_permission resource defines a permission (an OAuth scope) of an API, with the texts the consent screen shows. The provider does not manage the API itself: pass the ID of an existing API as api_id. Put the permission into a role with keenauth_role.
resource "keenauth_permission" "invoices_read" {
api_id = "api_01j9zq3v8c5m2x7k4t6r1n0b3d"
value = "invoices:read"
display_name = "Read invoices"
description = "See the invoices of the account."
sensitivity = "normal"
consent_text_i18n = {
de = "Rechnungen ansehen"
tr = "Faturaları görüntüle"
}
}
Lifecycle
valuehas the formresource:actionand appears in thepermissionsclaim of access tokens. It is unique in the API and cannot be changed: a new value replaces the permission. Theidp_prefix belongs to the system API.display_name,descriptionand the texts inconsent_text_i18nare plain text: no control characters, no line or paragraph separators, no bidirectional override characters, and, fordisplay_nameanddescription, no leading or trailing whitespace (the API trims those two). A text inconsent_text_i18nis stored as written, but it must not be blank. An empty text is not allowed; remove the attribute instead.consent_text_i18nis replaced as a whole map. The keys are language tags such asdeorpt-BR; at most 30 languages. Remove the attribute to clear it.sensitivityisnormalorsensitive; a sensitive permission is highlighted on the consent screen.- A permission row has no version, so the API offers no
If-Matchcheck for it. The provider reads the API's permission list on every plan, shows any change made elsewhere as drift and sends only the changed fields. - Removing the resource deletes the permission and removes it from every role and from application permission lists. The next refresh of those roles shows the change.
- The system API accepts no new permissions and its permissions cannot be deleted (
409 conflict). An API holds at most 1,000 permissions. - A permission deleted outside the provider is removed from state and planned again.
Import
Import by API ID and permission ID, or by API ID and value:
tofu import keenauth_permission.invoices_read api_01j9zq3v8c5m2x7k4t6r1n0b3d/perm_01j9zq3v8c5m2x7k4t6r1n0b3e
tofu import keenauth_permission.invoices_read api_01j9zq3v8c5m2x7k4t6r1n0b3d/invoices:read