HTTP Backend (Pro)
The Semaphore UI HTTP backend for Terraform securely stores and manages Terraform state files directly within Semaphore. Available in the Pro plan, it offers several key advantages.
Features
- Secure State Storage: State files are stored securely within Semaphore.
- State Locking: Prevents concurrent modifications to the same state file.
- Version History: Track changes to your infrastructure state over time.
- UI Integration: Manage state files directly through the Semaphore interface.
Configuration
To use the Semaphore UI HTTP backend, add the following configuration to your Terraform configuration:
terraform {
backend "http" {
address = "https://<your-semaphore-instance>/api/terraform/state/<project-id>"
lock_address = "https://<your-semaphore-instance>/api/terraform/state/<project-id>/lock"
unlock_address = "https://<your-semaphore-instance>/api/terraform/state/<project-id>/lock"
username = "semaphore"
password = "<your-api-token>"
}
}
Replace the following placeholders:
<your-semaphore-instance>
: Your Semaphore instance URL<project-id>
: Your Semaphore project ID<your-api-token>
: Your Semaphore API token
Accessing State Files
You can access and manage your Terraform state files through the Semaphore UI:
- Navigate to your project in Semaphore
- Go to the "Terraform" section
- Select "States" from the sidebar
- View, download, or manage your state files
Best Practices
- Always use state locking when working in team environments
- Regularly backup your state files
- Use meaningful names for your state files
- Keep your API tokens secure and rotate them periodically