Beta access
The Runlayer Terraform provider is currently in beta. To get access:- Reach out to us in Slack
- Or email support@runlayer.com
- Private network access if your Runlayer API is not public
- Access to the provider release
- The right base URL for your environment
What you need
- Terraform installed
- Network access to your Runlayer API
- A Runlayer user API key
- A provider binary from the GitHub releases page for
runlayer/terraform-provider-runlayer
Setup
Get private access first
If your Runlayer API is only reachable over VPN or another private network, make sure that is working before you start Terraform.
Download the provider release
Download the correct release artifact for your OS from the GitHub releases page for The binary should end up named
runlayer/terraform-provider-runlayer.Example:terraform-provider-runlayer.Tell Terraform to use the local provider
Create a Terraform CLI config file:Then point Terraform at it:
Export your Runlayer credentials
Use a user API key here.Organization API keys are not sufficient for Terraform resource management endpoints such as policy creation.
RUNLAYER_BASE_URL should be the API base URL for your environment. If you are not sure which URL to use, ask us.Optional: set the base URL in the provider block
If you prefer explicit provider configuration instead of environment variables, use the provider’s If you use this form, the variable name can be
base_url and api_key arguments:runlayer_base_url, but the provider argument itself is base_url.Run Terraform
When you use
dev_overrides, go straight to terraform plan or terraform apply. Terraform may warn or fail if you run terraform init first.Using variables for users, groups, and roles
If you want stable references in Terraform, declare variables like this:How the CLI can help
If your CLI version includesrunlayer terraform export, you can generate a tfvars file with stable names for users, groups, and roles.
Example:
Policy examples
These examples are based on the provider e2e coverage and show common policy shapes.Allow one group full access to one server
Allow one group read-only access to a server
Deny one group access to one server
Deny tools by name prefix
Deny access outside a private IP range
Deny inactive users globally
Deny everything except a small read-only tool set
Troubleshooting
terraform initfails underdev_overrides: skipinitand runterraform plandirectly- Terraform cannot find the provider: check
TF_CLI_CONFIG_FILEand thedev_overridespath terraform applyreturns403 Forbidden: make sure you are using a user API key, not an organization API key- The provider binary does not run: make sure it is executable
- API calls fail: verify
RUNLAYER_API_KEY - API calls hit the wrong environment: verify
RUNLAYER_BASE_URL - Requests time out or refuse to connect: confirm private network access first