https://github.com/opalsecurity/terraform-provider-opal
A terraform provider for managing Opal resources
https://github.com/opalsecurity/terraform-provider-opal
Last synced: 4 months ago
JSON representation
A terraform provider for managing Opal resources
- Host: GitHub
- URL: https://github.com/opalsecurity/terraform-provider-opal
- Owner: opalsecurity
- License: mit
- Created: 2022-09-15T18:27:43.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2026-03-11T00:23:23.000Z (5 months ago)
- Last Synced: 2026-03-11T06:06:14.656Z (5 months ago)
- Language: Go
- Size: 15.1 MB
- Stars: 4
- Watchers: 0
- Forks: 6
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Terraform provider for Opal
## SDK Generation
Generate the new SDK using `speakeasy run`. This pulls the remote spec specified in `.speakeasy/workflow.yaml#6` and applies the overrides in `terraform_overlay.yaml`. Note the Makefile is only useful if you want to do development with a local OpenAPI spec and update the Speakeasy workflow config to reference that OpenAPI spec.
## Summary
Opal API: The Opal API is a RESTful API that allows you to interact with the Opal Security platform programmatically.
## Table of Contents
* [Terraform provider for Opal](#terraform-provider-for-opal)
* [SDK Generation](#sdk-generation)
* [Installation](#installation)
* [Authentication](#authentication)
* [Available Resources and Data Sources](#available-resources-and-data-sources)
* [Testing the provider locally](#testing-the-provider-locally)
## Installation
To install this provider, copy and paste this code into your Terraform configuration. Then, run `terraform init`.
```hcl
terraform {
required_providers {
opal = {
source = "opalsecurity/opal"
version = "3.4.4"
}
}
}
provider "opal" {
server_url = "..." # Optional
}
```
## Authentication
This provider supports authentication configuration via environment variables and provider configuration.
The configuration precedence is:
- Provider configuration
- Environment variables
Available configuration:
| Provider Attribute | Description |
|---|---|
| `bearer_auth` | HTTP Bearer. Configurable via environment variable `OPAL_AUTH_TOKEN`. |
## Available Resources and Data Sources
### Managed Resources
* [opal_access_rule](docs/resources/access_rule.md)
* [opal_bundle](docs/resources/bundle.md)
* [opal_bundle_group](docs/resources/bundle_group.md)
* [opal_bundle_resource](docs/resources/bundle_resource.md)
* [opal_configuration_template](docs/resources/configuration_template.md)
* [opal_delegation](docs/resources/delegation.md)
* [opal_group](docs/resources/group.md)
* [opal_group_catalog_mapping](docs/resources/group_catalog_mapping.md)
* [opal_group_containing_group](docs/resources/group_containing_group.md)
* [opal_group_resource_list](docs/resources/group_resource_list.md)
* [opal_group_tag](docs/resources/group_tag.md)
* [opal_group_user](docs/resources/group_user.md)
* [opal_idp_group_mappings](docs/resources/idp_group_mappings.md)
* [opal_message_channel](docs/resources/message_channel.md)
* [opal_on_call_schedule](docs/resources/on_call_schedule.md)
* [opal_owner](docs/resources/owner.md)
* [opal_resource](docs/resources/resource.md)
* [opal_resource_tag](docs/resources/resource_tag.md)
* [opal_scoped_role_permission_list](docs/resources/scoped_role_permission_list.md)
* [opal_tag](docs/resources/tag.md)
* [opal_tag_user](docs/resources/tag_user.md)
### Data Sources
* [opal_access_rule](docs/data-sources/access_rule.md)
* [opal_app](docs/data-sources/app.md)
* [opal_apps](docs/data-sources/apps.md)
* [opal_bundle](docs/data-sources/bundle.md)
* [opal_bundle_visibility](docs/data-sources/bundle_visibility.md)
* [opal_configuration_template_list](docs/data-sources/configuration_template_list.md)
* [opal_delegation](docs/data-sources/delegation.md)
* [opal_delegations](docs/data-sources/delegations.md)
* [opal_events](docs/data-sources/events.md)
* [opal_group](docs/data-sources/group.md)
* [opal_group_catalog_mapping](docs/data-sources/group_catalog_mapping.md)
* [opal_group_containing_group](docs/data-sources/group_containing_group.md)
* [opal_group_resource_list](docs/data-sources/group_resource_list.md)
* [opal_group_reviewers_stages_list](docs/data-sources/group_reviewers_stages_list.md)
* [opal_group_tags](docs/data-sources/group_tags.md)
* [opal_group_users](docs/data-sources/group_users.md)
* [opal_group_list](docs/data-sources/group_list.md)
* [opal_idp_group_mappings](docs/data-sources/idp_group_mappings.md)
* [opal_message_channel](docs/data-sources/message_channel.md)
* [opal_message_channel_list](docs/data-sources/message_channel_list.md)
* [opal_on_call_schedule](docs/data-sources/on_call_schedule.md)
* [opal_on_call_schedule_list](docs/data-sources/on_call_schedule_list.md)
* [opal_owner](docs/data-sources/owner.md)
* [opal_owner_from_name](docs/data-sources/owner_from_name.md)
* [opal_owners](docs/data-sources/owners.md)
* [opal_paginated_bundle_group_list](docs/data-sources/paginated_bundle_group_list.md)
* [opal_paginated_bundle_list](docs/data-sources/paginated_bundle_list.md)
* [opal_paginated_bundle_resource_list](docs/data-sources/paginated_bundle_resource_list.md)
* [opal_requests](docs/data-sources/requests.md)
* [opal_resource](docs/data-sources/resource.md)
* [opal_resource_message_channel_list](docs/data-sources/resource_message_channel_list.md)
* [opal_resource_reviewers_list](docs/data-sources/resource_reviewers_list.md)
* [opal_resource_tags](docs/data-sources/resource_tags.md)
* [opal_resource_visibility](docs/data-sources/resource_visibility.md)
* [opal_resources_access_status](docs/data-sources/resources_access_status.md)
* [opal_resources_users_list](docs/data-sources/resources_users_list.md)
* [opal_resources_list](docs/data-sources/resources_list.md)
* [opal_scoped_role_permission_list](docs/data-sources/scoped_role_permission_list.md)
* [opal_sessions](docs/data-sources/sessions.md)
* [opal_tag](docs/data-sources/tag.md)
* [opal_tags_list](docs/data-sources/tags_list.md)
* [opal_uar](docs/data-sources/uar.md)
* [opal_uars_list](docs/data-sources/uars_list.md)
* [opal_user](docs/data-sources/user.md)
* [opal_user_tags](docs/data-sources/user_tags.md)
* [opal_users](docs/data-sources/users.md)
## Testing the provider locally
#### Local Provider
Should you want to validate a change locally, the `--debug` flag allows you to execute the provider against a terraform instance locally.
This also allows for debuggers (e.g. delve) to be attached to the provider.
```sh
go run main.go --debug
# Copy the TF_REATTACH_PROVIDERS env var
# In a new terminal
cd examples/your-example
TF_REATTACH_PROVIDERS=... terraform init
TF_REATTACH_PROVIDERS=... terraform apply
```
#### Compiled Provider
Terraform allows you to use local provider builds by setting a `dev_overrides` block in a configuration file called `.terraformrc`. This block overrides all other configured installation methods.
1. Execute `go build` to construct a binary called `terraform-provider-opal`
2. Ensure that the `.terraformrc` file is configured with a `dev_overrides` section such that your local copy of terraform can see the provider binary
Terraform searches for the `.terraformrc` file in your home directory and applies any configuration settings you set.
```
provider_installation {
dev_overrides {
"registry.terraform.io/opalsecurity/opal" = ""
}
# For all other providers, install them directly from their origin provider
# registries as normal. If you omit this, Terraform will _only_ use
# the dev_overrides block, and so no other providers will be available.
direct {}
}
```