# Managing Union with Terraform

> **📝 Note**
>
> An LLM-optimized bundle of this entire section is available at [`section.md`](https://www.union.ai/docs/v2/union/deployment/terraform/section.md).
> This single file contains all pages in this section, optimized for AI coding agent context.

Union provides a Terraform provider that enables infrastructure-as-code management of your Union deployment. With the Union Terraform provider, you can define, deploy, and manage Union resources using declarative configuration files.

## Overview

The Union Terraform provider allows you to manage Union resources programmatically, including:

- **Projects**: Create and manage Union projects
- **Access Control**: Configure users, roles, and policies
- **API Keys**: Generate and manage API keys for automation
- **OAuth Applications**: Set up OAuth applications for external integrations
- **Access Assignments**: Assign users and applications to resources

## Why use Terraform?

Using Terraform to manage Union provides several benefits:

- **Version Control**: Track changes to your Union configuration over time
- **Reproducibility**: Easily replicate configurations across environments
- **Automation**: Integrate Union management into your CI/CD pipelines
- **Consistency**: Ensure consistent configuration across your organization
- **Documentation**: Your Terraform files serve as living documentation

## Getting Started

To get started with the Union Terraform provider:

1. **Installation**: Set up the Terraform provider in your environment
2. **Management**: Learn about the available resources and data sources for managing Union

### [Installation](https://www.union.ai/docs/v2/union/deployment/terraform/installation/page.md)

Install and configure the Union Terraform provider

### [Resource Management](https://www.union.ai/docs/v2/union/deployment/terraform/management/page.md)

Learn about available resources and data sources

### [Security Best Practices](https://www.union.ai/docs/v2/union/deployment/terraform/security/page.md)

Securely manage API keys and credentials

## Requirements

- Terraform >= 1.0
- Union API key (generated using the [Flyte CLI](https://www.union.ai/docs/v2/union/api-reference/flyte-cli/page.md#flyte-create-config))
- Access to a Union deployment

## Subpages

- [Installation](https://www.union.ai/docs/v2/union/deployment/terraform/installation/page.md)
  - Quick Start
  - Versioning
- [Resource Management](https://www.union.ai/docs/v2/union/deployment/terraform/management/page.md)
  - Provider Configuration
  - Basic Configuration
  - Configuration Parameters
  - Authentication
  - 1. Provider Configuration
  - 2. Environment Variable
  - Generating an API Key
  - Available Resources
  - Projects
  - Users
  - Roles
  - Policies
  - API Keys
  - OAuth Applications
  - Access Assignments
  - Available Data Sources
  - Projects
  - Users
  - Roles
  - Policies
  - API Keys
  - Applications
  - Data Plane Information
  - Control Plane Information
  - Data Plane Listings
  - Best Practices
  - Use Variables for Sensitive Data
  - Organize Resources with Modules
  - Use Organization Restrictions
  - Version Control Your Configuration
  - Use Remote State
  - Example: Complete Setup
  - Additional Resources
  - Requirements
  - Support and Contributions
- [Security Best Practices](https://www.union.ai/docs/v2/union/deployment/terraform/security/page.md)
  - Recommended Approaches
  - 1. Use Cloud Secret Managers
  - 2. Use HashiCorp Vault
  - 3. Use Environment Variables
  - 4. Use Terraform Variables with `.tfvars` Files
  - Additional Security Measures
  - Encrypt Terraform State
  - Use State Locking
  - Rotate API Keys Regularly
  - Restrict Provider Permissions
  - Use Separate API Keys per Environment
  - Security Checklist
  - CI/CD Pipeline Security
  - GitHub Actions
  - GitLab CI
  - Best Practices for CI/CD
  - Additional Resources

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/deployment/terraform/_index.md
**HTML**: https://www.union.ai/docs/v2/union/deployment/terraform/
