Entitle Terraform provider | Entitle
What is Terraform?
Terraform is an infrastructure orchestrator written in HashiCorp Configuration Language (HCL). It is a widely adopted Infrastructure-as-Code (IaC) tool that eliminates the need for manual configuration by enabling declarative management of infrastructure resources.
How is the Entitle Terraform provider useful?
The Entitle Terraform provider enables you to manage Entitle resources and configurations using Terraform. It supports the automated management of integrations, workflows, and access policies within your Entitle environment, allowing for consistent and repeatable infrastructure management.
For additional examples beyond those provided in this guide, refer to Entitle's Terraform registry.
This guide assumes familiarity with HashiCorp Terraform. If you're new to Terraform, refer to the official Terraform guides and tutorials for foundational knowledge.
Supported API endpoints
The Entitle Terraform provider currently supports the following:
- Access Request Forward
- Access Review Forward
- Agent Token
- Bundle
- Integration
- Policy
- Resource
- Role
- User
- Workflow
Prerequisites
Before using the Entitle Terraform provider, ensure the following:
- Terraform CLI is installed on your system.
- You have an Entitle API token.
Install the Entitle Terraform provider
Copy and paste this code into your Terraform configuration to install the latest Entitle provider.
terraform {
required_providers {
entitle = {
source = "entitleio/entitle"
}
}
}
Configure the provider
The provider accepts the following optional arguments:
endpoint
(String) - Entitle API server address, set by default to https://api.entitle.io.api_key
(String, sensitive) - Entitle API bearer authorizations (http, Bearer).
Example
The following example shows the Entitle provider configuration, including the optional arguments:
terraform {
required_providers {
entitle = {
source = "entitleio/entitle"
}
}
}
provider "entitle" {
endpoint = "https://api.entitle.io"
api_key = "PUT_YOUR_TOKEN"
}
In case optional arguments are not used, the provider will use environment variables instead:
ENTITLE_API_KEY
ENTITLE_API_ENDPOINT
The configuration would look like this:
terraform {
required_providers {
entitle = {
source = "entitleio/entitle"
}
}
}
provider "entitle" {}
Example
The following example shows how to define a workflow and then create an integration using this workflow:
terraform {
required_providers {
entitle = {
source = "entitleio/entitle"
}
}
}
provider "entitle" {
endpoint = "https://api.entitle.io"
api_key = var.entitle_api_key
}
data "entitle_user" "my_user" {
email = "[email protected]"
}
resource "entitle_workflow" "my_workflow" {
name = "example workflow name"
rules = [
{
any_schedule = true
approval_flow = {
steps = [
{
approval_entities = [
{
type = "Automatic"
}
]
notified_entities = []
operator = "or"
sort_order = 1
}
]
}
in_groups = []
in_schedules = []
sort_order = 1
under_duration = 3600
}
]
}
resource "entitle_integration" "my_gitlab" {
name = var.integration_name
requestable = true
requestable_by_default = true
application = {
name = "Gitlab"
}
allowed_durations = [-1]
auto_assign_recommended_maintainers = false
auto_assign_recommended_owners = false
allow_creating_accounts = false
connection_json = jsonencode({
domain = "https://gitlab.com"
private_token = var.gitlab_access_token
configurationSchemaName = "Configuration "
})
notify_about_external_permission_changes = true
readonly = false
workflow = {
id = entitle_workflow.my_workflow.id
}
maintainers = []
owner = {
id = data.entitle_user.my_user.id
}
}
Updated about 3 hours ago