lumos_entitlement and lumos_workflow resources
This example uses version 1.x of the Lumos Terraform Provider to add a manual entitlement to an app and require approval from a group before anyone gets it. You keep who can approve access in version-controlled code instead of in the Lumos UI.
Version 1.x of the provider is built on the Lumos v1 API. It replaces
lumos_requestable_permission with lumos_entitlement and lumos_entitlement_appstore_settings, and moves approvals into workflows. If your configuration still uses 0.x, read the Terraform section of Migrate from v0 before you upgrade. To stay on 0.x for now, pin version = "~> 0.12". 0.x uses the v0 API, which is deprecated and stops working in May 2027.To manage app integrations themselves as code with the lumos_app resource, see Managing Integrations with Terraform.- Authenticates the provider with an API token from a Terraform variable or the
LUMOS_ACCESS_TOKENenvironment variable. - Looks up the app by its exact label and the approver group by its exact name.
- Creates a manual entitlement on the app with
lumos_entitlement. - Creates an approval chain with one stage assigned to the group, and an approval template that sends every request through that chain.
- Binds the template to the entitlement with
lumos_entitlement_approval_workflow. This overrides the app’s approval process for this entitlement only. - Outputs the IDs you need to check the result.
terraform.tfvars
main.tf
Require manager approval first
To have the requester’s manager approve before the group, make the manager the first stage of the chain and move the group to stage 2. The manager stage is assigned to your organization’sManager custom attribute, so that attribute needs to exist, usually mapped from your identity source. If it doesn’t, Lumos rejects the workflow.
Terraform commands to run/test
-
Initialize the Terraform configuration:
bash
-
(Optional) Validate the configuration:
bash
-
(Optional) Preview what changes will be made:
bash
-
Apply the configuration to create resources:
bash
-
(Optional) View the output values after apply:
bash
-
Destroy the resources when you’re done testing:
bash
lumos_api_token, approver_group_name, and app_name in each command, supply them in a terraform.tfvars file.
terraform destroy deletes the entitlement and the approval template. Lumos never deletes an approval chain, so the chain stays in Lumos after Terraform stops managing it. Destroy fails while anyone holds the entitlement, while it has pending access requests or time-based access scheduled for removal, or while an access policy references it.
Remove entitlements left behind by 0.x
In 0.x, destroying alumos_requestable_permission removed its AppStore settings but left its entitlement on the app. Each time you deleted and recreated a permission, the app gained another manual entitlement. The 1.x provider doesn’t do this, because destroying a lumos_entitlement deletes it.
To find the leftovers, list the app’s entitlements with List App Entitlements and expand=appstore_settings. A leftover has source set to manual and no appstore_settings. To remove one, call Delete Entitlement with its id. Lumos deletes only manual entitlements that nobody holds, and Creating, updating, and deleting lists the error each blocked delete returns.