Skip to main content
Version: 1.25.9

GCP Velero

This terraform module provides an easy way to generate Velero required cloud resources (Bucket and Credentials) to backup Kubernetes objects and trigger volume snapshots.

Inputs

NameDescriptionTypeDefaultRequired
backup_bucket_nameBackup Bucket Namestringn/ayes
projectGCP Project where colocate the bucketstringn/ayes
gcp_service_account_nameName of the gcp service account to create for velerostring"velero-sa"yes
gcp_custom_role_nameName of the gcp custom role to assign to the gcp service accountstring"velero_role"yes
workload_identityFlag to specify if velero should use workload identity instead of credentialsboolfalseyes
tagsCustom tags to apply to resourcesmap(string){}no

Outputs

NameDescription
backup_storage_locationVelero Cloud BackupStorageLocation CRD
cloud_credentialsVelero service credentials in case workload identity is not used
volume_snapshot_locationVelero Cloud VolumeSnapshotLocation CRD
kubernetes_service_account_patchPatch for the Kubernetes service account to use workload identity
remove_velero_credentials_patchPatch to remove service account credentials in velero
remove_restic_credentials_patchPatch to remove service account credentials in velero restic

The presence of some outputs is conditional to the presence of workload_identity:

NameDefaultWorkload Identity
backup_storage_location
cloud_credentials
volume_snapshot_location
kubernetes_service_account_patch
remove_velero_credentials_patch
remove_restic_credentials_patch

To find out more about workload identity go to the official documentation.

Usage

Without workload identity:

module "velero" {
source = "../vendor/modules/gcp-velero"
backup_bucket_name = "my-cluster-staging-velero"
project = "sighup-staging"
tags = {
"my-key": "my-value"
}
}

To enable workload identity:

module "velero" {
source = "../vendor/modules/gcp-velero"
backup_bucket_name = "my-cluster-staging-velero"
project = "sighup-staging"
workload_identity = true
tags = {
"my-key": "my-value"
}
}