The Union.ai Terraform provider allows you to manage Union.ai resources using Infrastructure as Code.
terraform {
required_providers {
unionai = {
source = "unionai/unionai"
version = "~> 1.0"
}
}
}
provider "unionai" {
# API key for authentication - can also be set via UNIONAI_API_KEY environment variable
api_key = var.unionai_api_key
# Optional: Restrict operations to specific organizations
allowed_orgs = ["your-org-name"]
}The provider requires authentication via API key. You can obtain an API key using the Union CLI:
union create api-key admin --name "terraform-api-key"The API key can be provided in two ways:
- Set the
api_keyattribute in the provider configuration - Set the
UNIONAI_API_KEYenvironment variable
Full documentation is available on the Terraform Registry.
To avoid unintended side effects by mixing credentials, you can specify the organizations in the provider configuration. The provider will only allow operations on resources in the allowed organizations.
unionai_project- Manage Union.ai projectsunionai_user- Manage usersunionai_role- Manage roles and permissionsunionai_policy- Manage access policiesunionai_api_key- Manage API keysunionai_application- Manage OAuth applicationsunionai_user_access- Assign policies to usersunionai_app_access- Assign policies to applications
unionai_project- Read project informationunionai_user- Read user informationunionai_role- Read role informationunionai_policy- Read policy informationunionai_api_key- Read API key informationunionai_application- Read application informationunionai_dataplane- Read dataplane informationunionai_dataplanes- List all dataplanesunionai_controlplane- Read controlplane information
-
Have a shared folder for repos
mkdir src cd src -
Clone this repository
git clone [email protected]:unionai/terraform-provider-enterprise.git cd terraform-provider-enterprise -
Clone the
cloudrepo as a sibling directory (required for local development)cd ../ git clone [email protected]:unionai/cloud.git
cd terraform-provider-enterprise
go build
When testing changes on the terraform provider you want to point to a local version of the provider instead of getting it from the offical terraform registry
-
Run
go buildin the root directory of this repo -> createsterraform-provider-enterprise -
Create a
.terraformrcfile in the examples dir or any directory:provider_installation { dev_overrides { "unionai/unionai" = "<path-to-the-binary-built>" } direct {} } -
Set the
TF_CLI_CONFIG_FILEenv var to this fileexport TF_CLI_CONFIG_FILE="<path-to-the-terraformrc>"/.terraformrc -
By unsetting this env var you can switch to getting it from the official registry again
See PUBLISHING.md for detailed instructions on publishing this provider to the Terraform Registry.
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests:
go test ./... - Submit a pull request
This project is licensed under the Mozilla Public License Version 2.0 - see the LICENSE file for details.