> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opal.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration templates

**Configuration templates** are groupings of settings you can reuse across multiple resources and groups. Streamlined configuration settings allows your team to move faster, and increases security by avoiding policy drift.

## Create templates

To create a template, go to **Templates**, then select **Configuration Templates**. Click **+ Configuration Template**.

![](https://mintcdn.com/opalsecurity/lt0M-hBs5yNe5ff5/images/docs/b70cfbde097a9e1d2ab20c9f1510216e1860bf653da34b007cac1c761be991be-create-configuration-template.png?fit=max\&auto=format\&n=lt0M-hBs5yNe5ff5\&q=85\&s=f0e121d1c941e29652cfd3f046f275fa)

You can provide a name, select an admin, optionally link a Slack channel, optionally add on-call members, optionally add break-glass users, require a reason when users forfeit access (**Require reason to forfeit**), prevent users from forfeiting access (**Disable forfeiting access**), and configure MFA settings, the same as you would in a resource-specific request configuration.

![](https://mintcdn.com/opalsecurity/lwwIeFbsleftxaXx/images/docs/cc01cea-Screenshot_2024-03-14_at_4.52.58_PM.png?fit=max\&auto=format\&n=lwwIeFbsleftxaXx\&q=85\&s=e44c83a373238a77802f68a41651cb55)

## Apply templates

To apply a template to a resource or group, edit the field on the resource or group page:

![](https://mintcdn.com/opalsecurity/KunPWigry5GIeB5g/images/docs/3b37c74-applyconfigtemp.png?fit=max\&auto=format\&n=KunPWigry5GIeB5g\&q=85\&s=10225c8989059d216dd737eb26eded67)

When a template is applied, **all its access management settings are configured by the values in the template**:

* If a configuration template is modified, all resources and groups linked to the template are also modified
* The settings cannot be directly edited except by unlinking the configuration template

Configuration templates can be set in bulk:

![](https://mintcdn.com/opalsecurity/TlQj9FwRe9HHNEYB/images/docs/0ca5f6dd3e0e27826bd03bcf6c64bd3d9d17801c2df582ac5217258ed4d6eaf7-select-resources-bulk.png?fit=max\&auto=format\&n=TlQj9FwRe9HHNEYB\&q=85\&s=71361db89cb2536855158164588c070a)

![](https://mintcdn.com/opalsecurity/odnvD_MsXBxTor9u/images/docs/7cae519-bulkeditresources_2.png?fit=max\&auto=format\&n=odnvD_MsXBxTor9u\&q=85\&s=c72818e281bf63b812174e8c46a27456)

## Set templates using tags

> [!NOTE]
>
> Importing based on tags is not supported for custom apps, so template mapping does not apply for custom apps.

You can also configure Opal to automatically set a configuration template using tags. Go to **Configuration > Templates > Template Mapping and Priority** and associate a tag with a template that you have configured.

When resources or groups are imported with certain tags, the set templates are automatically applied.

Note that templates are only applied on **import**, so you must first create and define the mapping, then import the resources. If you import a resource and later define a template or tag the resource, the template will not be applied. ![](https://mintcdn.com/opalsecurity/TlQj9FwRe9HHNEYB/images/docs/0ca34d352655b9ece6fc30d0e7936397ce6feaa00c244d45a148ba595cd3a264-template-mapping.png?fit=max\&auto=format\&n=TlQj9FwRe9HHNEYB\&q=85\&s=da45fda6f117ac1666ada2f2b0cd5002)

You can also reorder template mappings by selecting **Reorder**, so resources with multiple tags use the template with the highest priority.

## Manage templates programmatically

You can create, update, and attach configuration templates using the Opal REST API and Terraform provider:

* Use the `/configuration-templates` [API endpoints](https://docs.opal.dev/api-reference/configuration-templates/get-configuration-templates.md) or the [`opal_configuration_template`](https://registry.terraform.io/providers/opalsecurity/opal/latest/docs/resources/configuration_template) Terraform resource to manage templates. `requires_forfeit_reason` is available in the REST API only.
* Attach or unlink a template on a resource or group using `GET /resources/{resource_id}/configuration-template` and `PUT /resources/{resource_id}/configuration-template` or `GET /groups/{group_id}/configuration-template` and `PUT /groups/{group_id}/configuration-template` (or attach one with `configuration_template_id` on `opal_resource` / `opal_group` in Terraform; unlinking isn't supported in Terraform). Pass `null` for `configuration_template_id` to unlink the template and copy its current settings onto the resource or group. Setting `configuration_template_id` directly on `PUT /resources` and `PUT /groups` is deprecated in favor of the `/configuration-template` sub-resource endpoints.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.