Terraform Provider
Explore the Cloudback Terraform Provider, an Infrastructure as Code (IaC) tool that enables automated management of backup configurations through Terraform.
AutomationThe Cloudback Terraform Provider (terraform-provider-cloudback) is an Infrastructure as Code (IaC) tool that enables automated management of Cloudback backup configurations through Terraform.
Overview
This provider allows users to manage backup definitions for all supported platforms using Cloudback's Operations API through Terraform configurations. It provides a smooth integration between Terraform and the Cloudback platform.
Features
- Automated backup definition configuration for repositories
- Infrastructure as Code approach to backup management
- Multi-platform support
- Support for Terraform-based workflow automation
Prerequisites
Before you begin, ensure that you have the following:
- Terraform Installed: Version 1.0 or later is recommended.
- Cloudback Account: An active account with appropriate permissions to create and manage backup resources.
- API Key: Your API key for Cloudback's API. You can create one at the API Keys page in the Cloudback dashboard.
- Network Access: Ensure that your environment can reach Cloudback's endpoints:
https://app.cloudback.it/ops/
Usage
Provider Configuration
terraform {
required_providers {
cloudback = {
source = "cloudback/cloudback"
}
}
}
provider "cloudback" {
api_key = "your-api-key" # Replace with your API key, see https://app.cloudback.it/apikeys
}Note: You can provide your API key either directly in the configuration or through the CLOUDBACK_API_KEY environment variable:
export CLOUDBACK_API_KEY="your-api-key"Resource: Backup Definition
Backup definitions are the primary resources managed by Cloudback. They represent the configuration for a specific backup subject (repository, project, or workspace).
GitHub Example
resource "cloudback_backup_definition" "github_demo" {
platform = "GitHub"
account = "cloudback"
subject_name = "demo-repository"
subject_type = "Repository"
settings = {
enabled = true
schedule = "Daily at 9 pm"
storage = "Cloudback EU"
retention = "Last 30 days"
}
}Azure DevOps Repository Example
resource "cloudback_backup_definition" "azure_devops_repo" {
platform = "AzureDevOps"
account = "my-organization"
subject_name = "my-project/demo-repository"
subject_type = "Repository"
settings = {
enabled = true
schedule = "Daily at 9 pm"
storage = "Cloudback EU"
retention = "Last 30 days"
}
}Azure DevOps Project Example
resource "cloudback_backup_definition" "azure_devops_project" {
platform = "AzureDevOps"
account = "my-organization"
subject_name = "my-project"
subject_type = "Project"
settings = {
enabled = true
schedule = "Daily at 9 pm"
storage = "Cloudback EU"
retention = "Last 30 days"
}
}GitLab Example
resource "cloudback_backup_definition" "gitlab_demo" {
platform = "GitLab"
account = "my-group"
subject_name = "my-project"
subject_type = "Project"
settings = {
enabled = true
schedule = "Daily at 9 pm"
storage = "Cloudback EU"
retention = "Last 30 days"
}
}Linear Example
resource "cloudback_backup_definition" "linear_demo" {
platform = "Linear"
account = "my-workspace"
subject_name = "my-workspace"
subject_type = "Workspace"
settings = {
enabled = true
schedule = "Daily at 9 pm"
storage = "Cloudback EU"
retention = "Last 30 days"
}
}Attributes
| Attribute | Type | Required | Description |
|---|---|---|---|
platform | string | Yes | The platform. Values: GitHub, AzureDevOps, GitLab, Linear |
account | string | Yes | The account or organization name |
subject_name | string | Yes | The backup subject name (see format below) |
subject_type | string | Yes | The backup subject type: Repository, Project, or Workspace |
settings | object | Yes | The backup configuration settings |
Subject Name Format
| Platform | Subject Type | Format | Example |
|---|---|---|---|
| GitHub | Repository | repository-name | demo-repository |
| Azure DevOps | Repository | project-name/repository-name | my-project/demo-repo |
| Azure DevOps | Project | project-name | my-project |
| GitLab | Project | project-name | my-project |
| Linear | Workspace | workspace-name | my-workspace |
Settings Object
Backwards Compatibility
The repository attribute is still supported as an alias for subject_name with subject_type defaulting to Repository. However, using subject_name and subject_type is recommended for clarity, especially when working with Azure DevOps projects.
# Legacy format (still supported for repositories)
resource "cloudback_backup_definition" "legacy_example" {
platform = "GitHub"
account = "cloudback"
repository = "demo-repository" # Alias for subject_name with subject_type="Repository"
settings = {
enabled = true
}
}Documentation
For detailed documentation and examples, visit the official repository.