Manage your OneLogin resources with Terraform! This official provider allows you to configure users, groups, roles, applications, and more using infrastructure as code.
The OneLogin provider is available on the Terraform Registry. Terraform will automatically download it when you run terraform init.
Add the provider to your Terraform configuration:
terraform {
required_providers {
onelogin = {
source = "onelogin/onelogin"
version = "~> 1.0" # Use the latest version from the Terraform Registry
}
}
}
provider "onelogin" {
# Configuration options
}The provider requires OneLogin API credentials. You can configure these via environment variables or provider configuration.
export ONELOGIN_CLIENT_ID="your_client_id"
export ONELOGIN_CLIENT_SECRET="your_client_secret"
export ONELOGIN_API_URL="https://your-subdomain.onelogin.com"provider "onelogin" {
client_id = "your_client_id"
client_secret = "your_client_secret"
url = "https://your-subdomain.onelogin.com"
}- Log in to your OneLogin admin portal
- Go to Developers → API Credentials
- Create a new API credential with appropriate permissions
- Save the Client ID and Client Secret
Here's a simple example that creates a user and assigns them to a role:
# Create a role
resource "onelogin_roles" "developers" {
name = "Developers"
}
# Create a user
resource "onelogin_users" "john_doe" {
username = "john.doe@example.com"
email = "john.doe@example.com"
firstname = "John"
lastname = "Doe"
}
# Create a group
resource "onelogin_groups" "engineering" {
name = "Engineering"
}The provider supports the following OneLogin resources:
onelogin_users- Manage usersonelogin_groups- Manage groupsonelogin_roles- Manage rolesonelogin_apps- Manage applicationsonelogin_saml_apps- Manage SAML applicationsonelogin_oidc_apps- Manage OIDC applicationsonelogin_app_rules- Manage application provisioning rulesonelogin_app_role_attachments- Attach roles to applicationsonelogin_auth_servers- Manage OAuth authorization serversonelogin_privileges- Manage custom privilegesonelogin_user_mappings- Manage user attribute mappingsonelogin_user_custom_attributes- Manage custom user attributesonelogin_smarthooks- Manage SmartHooksonelogin_smarthook_environment_variables- Manage SmartHook environment variablesonelogin_self_registration_profiles- Manage self-registration profiles
Use data sources to reference existing OneLogin resources:
onelogin_user- Look up a single useronelogin_users- Query multiple usersonelogin_group- Look up a single grouponelogin_groups- Query multiple groups
For detailed documentation on each resource and data source, see:
- Terraform Registry Documentation
- Examples - Example configurations for common use cases
- Issues: Report bugs or request features via GitHub Issues
- Questions: For questions about using the provider, please use GitHub Discussions or OneLogin support channels
We welcome contributions! Please see CONTRIBUTING.md for details on:
- Setting up your development environment
- Running tests
- Submitting pull requests
- Release process
This project is licensed under the MIT License - see the LICENSE file for details.