Skip to content

Commit

Permalink
Merge pull request #29 from lgallard/feature/enable-continuous-backup
Browse files Browse the repository at this point in the history
Add support for enable_continuous_backup
  • Loading branch information
lgallard authored Apr 10, 2021
2 parents c290f59 + a27b05b commit 83e772b
Show file tree
Hide file tree
Showing 13 changed files with 81 additions and 30 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.11.0 (April 10, 2021)

ENHANCEMENTS:

* Add support for `enable_continuous_backup`
* Update examples
* Update README

## 0.10.0 (April 7, 2021)

FIXES:
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ module "aws_backup_example" {
# Multiple rules using a list of maps
rules = [
{
name = "rule-1"
schedule = "cron(0 12 * * ? *)"
target_vault_name = null
start_window = 120
completion_window = 360
name = "rule-1"
schedule = "cron(0 12 * * ? *)"
target_vault_name = null
start_window = 120
completion_window = 360
enable_continuous_backup = true
lifecycle = {
cold_storage_after = 0
delete_after = 90
Expand Down
11 changes: 6 additions & 5 deletions examples/complete_plan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ module "aws_backup_example" {
# Multiple rules using a list of maps
rules = [
{
name = "rule-1"
schedule = "cron(0 12 * * ? *)"
target_vault_name = null
start_window = 120
completion_window = 360
name = "rule-1"
schedule = "cron(0 12 * * ? *)"
target_vault_name = null
start_window = 120
completion_window = 360
enable_continuous_backup = true
lifecycle = {
cold_storage_after = 0
delete_after = 90
Expand Down
11 changes: 6 additions & 5 deletions examples/complete_plan/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ module "aws_backup_example" {
# Multiple rules using a list of maps
rules = [
{
name = "rule-1"
schedule = "cron(0 12 * * ? *)"
target_vault_name = null
start_window = 120
completion_window = 360
name = "rule-1"
schedule = "cron(0 12 * * ? *)"
target_vault_name = null
start_window = 120
completion_window = 360
enable_continuous_backup = true
lifecycle = {
cold_storage_after = 0
delete_after = 90
Expand Down
9 changes: 9 additions & 0 deletions examples/complete_plan/provider.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
}
}
}

provider "aws" {
region = var.env["region"]
profile = var.env["profile"]
Expand Down
9 changes: 5 additions & 4 deletions examples/simple_plan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ module "aws_backup_example" {
# One rule using a list of maps
rules = [
{
name = "rule-1"
schedule = "cron(0 12 * * ? *)"
start_window = 120
completion_window = 360
name = "rule-1"
schedule = "cron(0 12 * * ? *)"
start_window = 120
completion_window = 360
enable_continuous_backup = true
lifecycle = {
cold_storage_after = 0
delete_after = 90
Expand Down
9 changes: 5 additions & 4 deletions examples/simple_plan/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ module "aws_backup_example" {
# One rule using a list of maps
rules = [
{
name = "rule-1"
schedule = "cron(0 12 * * ? *)"
start_window = 120
completion_window = 360
name = "rule-1"
schedule = "cron(0 12 * * ? *)"
start_window = 120
completion_window = 360
enable_continuous_backup = true
lifecycle = {
cold_storage_after = 0
delete_after = 90
Expand Down
9 changes: 9 additions & 0 deletions examples/simple_plan/provider.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
}
}
}

provider "aws" {
region = var.env["region"]
profile = var.env["profile"]
Expand Down
2 changes: 2 additions & 0 deletions examples/simple_plan_using_variables/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ module "aws_backup_example" {
rule_completion_window = 360
rule_lifecycle_cold_storage_after = 30
rule_lifecycle_delete_after = 120
rule_enable_continuous_backup = true
# One selection
selection_name = "selection-1"
Expand Down
1 change: 1 addition & 0 deletions examples/simple_plan_using_variables/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module "aws_backup_example" {
rule_completion_window = 360
rule_lifecycle_cold_storage_after = 30
rule_lifecycle_delete_after = 120
rule_enable_continuous_backup = true

# One selection
selection_name = "selection-1"
Expand Down
9 changes: 9 additions & 0 deletions examples/simple_plan_using_variables/provider.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
}
}
}

provider "aws" {
region = var.env["region"]
profile = var.env["profile"]
Expand Down
16 changes: 9 additions & 7 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ resource "aws_backup_plan" "ab_plan" {
dynamic "rule" {
for_each = local.rules
content {
rule_name = lookup(rule.value, "name", null)
target_vault_name = lookup(rule.value, "target_vault_name", null) == null ? var.vault_name : lookup(rule.value, "target_vault_name", "Default")
schedule = lookup(rule.value, "schedule", null)
start_window = lookup(rule.value, "start_window", null)
completion_window = lookup(rule.value, "completion_window", null)
recovery_point_tags = length(lookup(rule.value, "recovery_point_tags")) == 0 ? var.tags : lookup(rule.value, "recovery_point_tags")
rule_name = lookup(rule.value, "name", null)
target_vault_name = lookup(rule.value, "target_vault_name", null) == null ? var.vault_name : lookup(rule.value, "target_vault_name", "Default")
schedule = lookup(rule.value, "schedule", null)
start_window = lookup(rule.value, "start_window", null)
completion_window = lookup(rule.value, "completion_window", null)
enable_continuous_backup = lookup(rule.value, "enable_continuous_backup", null)
recovery_point_tags = length(lookup(rule.value, "recovery_point_tags")) == 0 ? var.tags : lookup(rule.value, "recovery_point_tags")

# Lifecycle
dynamic "lifecycle" {
Expand Down Expand Up @@ -83,7 +84,8 @@ locals {
cold_storage_after = var.rule_lifecycle_cold_storage_after
delete_after = var.rule_lifecycle_delete_after
}
recovery_point_tags = var.rule_recovery_point_tags
enable_continuous_backup = var.rule_enable_continuous_backup
recovery_point_tags = var.rule_recovery_point_tags
}
]

Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ variable "rule_copy_action_destination_vault_arn" {
default = null
}

variable "rule_enable_continuous_backup" {
description = " Enable continuous backups for supported resources."
type = bool
default = false
}


# Rules
variable "rules" {
Expand Down

0 comments on commit 83e772b

Please sign in to comment.