Skip to content

mnsanfilippo/terraform-cloud-backup

Repository files navigation

Terraform Cloud Backup

This module creates the last terraform state in S3 of the given workspaces every time a Terraform state changes.

Author

Mariano Sanfilippo

Usage

This module needs the lambda build in S3, first you should build this lambda and upload it to S3 go-tools-tfc-backup

module "example" {
  source = "https://github.com/mnsanfilippo/terraform-cloud-backup.git?ref=main"
  bucket_builds  = var.bucket_builds
  bucket_name    = var.bucket_name
  lambda_s3_key  = var.lambda_s3_key
  tf_token       = var.tf_token
  workspaces_ids = var.workspaces_ids
}

Requirements

Name Version
aws 3.42.0
tfe 0.25.3

Providers

Name Version
aws 3.42.0
template n/a
tfe 0.25.3
time n/a

Modules

Name Source Version
api_gateway terraform-aws-modules/apigateway-v2/aws
s3-bucket terraform-aws-modules/s3-bucket/aws 2.2.0

Resources

Name Type
aws_iam_policy.tfc-backup-lambda-policy resource
aws_iam_role.tfc-workspaces-backup resource
aws_kms_key.tfc-workspace-backup resource
aws_lambda_function.tfc-workspaces-backup resource
aws_lambda_permission.apigw_lambda resource
tfe_notification_configuration.tfc-workspaces-backup resource
time_sleep.wait_120_seconds resource
aws_iam_policy_document.aws_lambda_trust_policy data source
aws_lambda_function.tfc-backup data source
aws_s3_bucket_object.build data source
template_file.tfe-backup-lambda-policy data source

Inputs

Name Description Type Default Required
apigw_name n/a string "tfc-workspaces-backup" no
bucket_builds Lambda Builds Bucket string n/a yes
bucket_name Bucket to save the backups string n/a yes
lambda_name n/a string "tfc-workspaces-backup" no
lambda_s3_key Lambda Build Key string n/a yes
notification_name n/a string "tfc-workspaces-backup" no
tf_token Terraform Cloud Token string n/a yes
workspaces_ids List of the workspaces IDs to back up. list(string) n/a yes

Outputs

Name Description
apigw_invoke_url n/a
bucket_id n/a

About

Terraform Cloud Backup

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published