
terraform-aws-arc-backup¶
Module:
sourcefuse/arc-backup/awsRegistry: https://registry.terraform.io/modules/sourcefuse/arc-backup/aws
Category: Storage / Data Protection
Source: https://github.com/sourcefuse/terraform-aws-arc-backup
Overview¶
Centralizes AWS Backup configuration — vaults, plans, schedules, and resource selections — with optional vault lock and KMS encryption.
What It Does¶
- Backup vault with optional KMS encryption
- Backup plans with cron schedules and lifecycle policies
- Resource selection by ARN or tag-based filters
- Vault lock in governance or compliance mode
- Cross-region copy actions
- IAM role for backup and restore
For more information about this repository and its usage, please see Terraform AWS Backup Usage Guide.
Quickstart¶
SourceFuse's AWS Reference Architecture (ARC) Terraform module centralizes and automates the backup of data across AWS services such as Amazon RDS, EBS, DynamoDB, EFS, and more. It allows you to schedule automated backups, and manage and monitor backup activity from a single console, ensuring compliance and data protection. AWS Backup also supports cross-region and cross-account backup capabilities for enhanced data durability and disaster recovery.
Prerequisites¶
Before using this module, ensure you have the following:
- AWS credentials configured.
- Terraform installed.
- A working knowledge of Terraform.
Getting Started¶
- Define the Module
Initially, it's essential to define a Terraform module, which is organized as a distinct directory encompassing Terraform configuration files. Within this module directory, input variables and output values must be defined in the variables.tf and outputs.tf files, respectively. The following illustrates an example directory structure:
- Define Input Variables
Inside the variables.tf or in *.tfvars file, you should define values for the variables that the module requires.
- Use the Module in Your Main Configuration In your main Terraform configuration file (e.g., main.tf), you can use the module. Specify the source of the module, and version, For Example
Required Inputs¶
| Name | Type | Description |
|---|---|---|
tags |
map(string) |
Tags applied to all backup resources |
| ## Key Outputs |
| Name | Description |
|---|---|
backup_plan_id |
AWS Backup plan ID |
vault_arn |
ARN of the backup vault |
| ## Full Variable & Output Reference |
The complete inputs/outputs reference is auto-generated below.
- .tfvars
Inside the .tfvars file of the module, you can provide desired values that can be referenced in the main configuration. For example:
Edit the locals.tf file and provide desired values.
backup_plan - variable is used to define Backup plan and lifecycle policies.
backup_vault_data - Defines where backup has to be stored
backup_selection_data - Which all resources needs backup
First Time Usage¶
uncomment the backend block in main.tf
terraform init should be fine
Create a dev workspace
Plan Terraform
Apply Terraform
Production Setup¶
Create a prod workspace
Plan Terraform
Apply Terraform
Cleanup¶
Destroy Terraform
Requirements¶
| Name | Version |
|---|---|
| terraform | >= 1.4, < 2.0.0 |
| aws | >= 5.0, < 6.0 |
Providers¶
| Name | Version |
|---|---|
| aws | 5.49.0 |
Modules¶
| Name | Source | Version |
|---|---|---|
| backup_vault | ./modules/backup-vault | n/a |
Resources¶
| Name | Type |
|---|---|
| aws_backup_plan.this | resource |
| aws_backup_selection.this | resource |
| aws_backup_vault_lock_configuration.this | resource |
| aws_iam_role.this | resource |
| aws_iam_role_policy_attachment.aws_backup_policy_backup_attachment | resource |
| aws_iam_role_policy_attachment.aws_backup_policy_restore_attachment | resource |
| aws_iam_role.this | data source |
Inputs¶
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| backup_plan | Rules for AWS backup plan, null act as flag to enable or disable backup plan | object({ |
null |
no |
| backup_selection_data | (optional) Backup selection criteria to select resources | object({ |
null |
no |
| backup_vault_data | Details to create backup vault, null act as flag to enable or disable | object({ |
null |
no |
| create_role | (optional) Role Required for taking backup and restore | bool |
true |
no |
| role_name | IAM role name | string |
null |
no |
| tags | Tags for AWS backup service | map(string) |
n/a | yes |
| vault_lock_configuration | (optional) Vault lock configuration , changeable_for_days > 0 , then its governance else compliance mode |
object({ |
null |
no |
Outputs¶
| Name | Description |
|---|---|
| backup_plan_id | AWS backups plan ID |
| backup_role_arn | n/a |
| backup_role_name | n/a |
| vault_arn | ARN of Vault |
Versioning¶
This project uses a .version file at the root of the repo which the pipeline reads from and does a git tag.
When you intend to commit to main, you will need to increment this version. Once the project is merged,
the pipeline will kick off and tag the latest git commit.
Development¶
Prerequisites¶
Configurations¶
- Configure pre-commit hooks
Versioning¶
while Contributing or doing git commit please specify the breaking change in your commit message whether its major,minor or patch
For Example
Tests¶
- Tests are available in
testdirectory - Configure the dependencies
- Now execute the test
Contributing¶
See CONTRIBUTING.md for commit conventions and development setup.
Authors¶
This project is authored by: - SourceFuse ARC Team