Skip to content

Commit 96ee655

Browse files
authored
Rename targets and restores_enabled deployment variables (#51)
* Rename `deployments.targets` to `deployments.backup_targets` - allows for the addition of `restore_targets` in future, which won't receive Backup Plans. * Rename `deployments.restores_enabled` to `deployments.allow_backup_targets_to_restore` * Default `allow_backup_targets_to_restore` to `false`
1 parent d9687aa commit 96ee655

File tree

6 files changed

+24
-26
lines changed

6 files changed

+24
-26
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ module "immutable_aws_backup" {
3131
3232
deployments = {
3333
"website-service" = {
34-
targets = ["ou-abcd-defghijk"]
34+
backup_targets = ["ou-abcd-defghijk"]
3535
min_retention_days = 7
3636
max_retention_days = 90
37-
restores_enabled = false
3837
backup_tag_key = "BackupPlan"
3938
plans = {
4039
"GFS-7-28-90" : {

docs/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ module "immutable_aws_backup" {
3131
3232
deployments = {
3333
"website-service" = {
34-
targets = ["ou-abcd-defghijk"]
34+
backup_targets = ["ou-abcd-defghijk"]
3535
min_retention_days = 7
3636
max_retention_days = 90
37-
restores_enabled = false
3837
backup_tag_key = "BackupPlan"
3938
plans = {
4039
"GFS-7-28-90" : {

docs/usage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ A deployment is an instance of the backup solution. Within the deployment accoun
3030
| Name | Description | Type | Default | Required |
3131
|------|-------------|------|---------|----------|
3232
| <a name="deployments_admin_role_names"></a> [admin\_role\_names](#deployments\_admin\_role\_names) | A list of role names that will have administrator abilities in member accounts. For example, administering the Backup Vaults. | `list(string)` | `[]` | no |
33+
| <a name="deployments_allow_backup_targets_to_restore"></a> [allow\_backup\_targets\_to\_restore](#deployments\_allow\_backup\_targets\_to\_restore) | Allow restores within the `backup_targets` workload accounts. This will share the LAG Vault back to workload accounts through AWS RAM. | `bool` | `false` | no |
3334
| <a name="deployments_backup_tag_key"></a> [backup\_tag\_key](#deployments\_backup\_tag\_key) | The tag key to query when `require_plan_name_resource_tag` is enabled within a plan. | `string` | `null` | no |
35+
| <a name="deployments_backup_targets"></a> [backup\_targets](#deployments\_backup\_targets) | A list of Organizational Unit IDs to deploy the backup solution to. The module will deploy to all accounts within these OUs. | `list(string)` | | yes |
3436
| <a name="deployments_max_retention_days"></a> [max\_retention\_days](#deployments\_max\_retention\_days) | The maximum retention to configure on the Backup Vaults. Required when a plan is using a LAG Vault. | `number` | `null` | no |
3537
| <a name="deployments_min_retention_days"></a> [min\_retention\_days](#deployments\_min\_retention\_days) | The minimum retention to configure on the Backup Vaults. Required when a plan is using a LAG Vault. | `number` | `null` | no |
3638
| <a name="deployments_plans"></a> [plans](#deployments\_plans) | A map of backup plans to implement, see [Plans](#plans). | `map(object)` | | yes |
37-
| <a name="deployments_restores_enabled"></a> [restores\_enabled](#deployments\_restores\_enabled) | Allow restores within workload accounts. This will share the LAG Vault back to workload accounts through AWS RAM. | `bool` | `false` | no |
3839
| <a name="deployments_retained_vaults"></a> [retained_vaults](#deployments\_retained\_vaults) | A list of previously deployed Backup Vault configurations. This is used to retain Vaults that were previously configured and are now locked, preventing deletion. This is useful when changing the configuration of a deployment, such as changing the minimum or maximum retention days. | `list(object({ min_retention_days = number, max_retention_days = number, use_logically_air_gapped_vault = optional(bool, false) }))` | `[]` | no |
39-
| <a name="deployments_targets"></a> [targets](#deployments\_targets) | A list of Organizational Unit IDs to deploy the backup solution to. The module will deploy to all accounts within these OUs. | `list(string)` | | yes |
4040
<!-- prettier-ignore-end -->
4141

4242
### Plans

examples/tags/main.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ module "aws_backup" {
88
terraform_state_bucket_name = var.terraform_state_bucket
99
deployments = {
1010
"ca-prod" = {
11-
targets = [module.ou_data_lookup.by_name_path["Workloads / Serverless / CA / RSA CA"].id]
12-
min_retention_days = 7
13-
max_retention_days = 12
14-
restores_enabled = true
15-
backup_tag_key = "BackupPolicy"
16-
plans = local.ca_default_plans
11+
backup_targets = [module.ou_data_lookup.by_name_path["Workloads / Serverless / CA / RSA CA"].id]
12+
min_retention_days = 7
13+
max_retention_days = 12
14+
allow_backup_targets_to_restore = true
15+
backup_tag_key = "BackupPolicy"
16+
plans = local.ca_default_plans
1717
}
1818
}
1919
}

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ module "deployment" {
3131
service_name = each.key
3232
admin_role_names = each.value.admin_role_names
3333
backup_tag_key = each.value.backup_tag_key
34-
deployment_targets = each.value.targets
34+
deployment_targets = each.value.backup_targets
3535
max_retention_days = each.value.max_retention_days
3636
min_retention_days = each.value.min_retention_days
3737
plans = each.value.plans
38-
restores_enabled = each.value.restores_enabled
38+
restores_enabled = each.value.allow_backup_targets_to_restore
3939
retained_vaults = each.value.retained_vaults
4040

4141
current = {

variables.tf

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@ variable "central_account_resource_name_prefix" {
55

66
variable "deployments" {
77
type = map(object({
8-
admin_role_names = optional(list(string), []) # Names of IAM roles that have admin access to the deployment. E.g. can manage the backup vaults in member accounts.
9-
backup_tag_key = optional(string)
10-
max_retention_days = optional(number)
11-
min_retention_days = optional(number)
8+
admin_role_names = optional(list(string), []) # Names of IAM roles that have admin access to the deployment. E.g. can manage the backup vaults in member accounts.
9+
allow_backup_targets_to_restore = optional(bool, false)
10+
backup_tag_key = optional(string)
11+
backup_targets = list(string)
12+
max_retention_days = optional(number)
13+
min_retention_days = optional(number)
1214
plans = map(object({
1315
complete_backup_window_minutes = optional(number)
1416
continuous_backup_schedule_expression = optional(string, "cron(0 0 ? * * *)") # Schedule for creating continuous backups, if enabled.
1517
create_continuous_backups = optional(bool, false) # Create continuous backups for resources that support it to enable local PITR, there is no copy action for these backups.
16-
intermediate_retention_days = optional(number), # Number of days to retain backups in the intermediate vault.
17-
local_retention_days = optional(number), # Number of days to retain backups in the member account vault. If not specified, defaults to delete_after_days.
18+
intermediate_retention_days = optional(number) # Number of days to retain backups in the intermediate vault.
19+
local_retention_days = optional(number) # Number of days to retain backups in the member account vault. If not specified, defaults to delete_after_days.
1820
require_plan_name_resource_tag = optional(bool, true)
19-
snapshot_from_continuous_backups = optional(bool, true), # Generate continuous backups for resources that support it and then snapshot from them. These backups do not copy but act as a source for the backup jobs created by the rules. Currently only S3 is supported.
21+
snapshot_from_continuous_backups = optional(bool, true) # Generate continuous backups for resources that support it and then snapshot from them. These backups do not copy but act as a source for the backup jobs created by the rules. Currently only S3 is supported.
2022
start_backup_window_minutes = optional(number)
2123
use_logically_air_gapped_vault = optional(bool, false)
2224
rules = list(object({
@@ -25,17 +27,15 @@ variable "deployments" {
2527
intermediate_retention_days = optional(number) # Number of days to retain backups in the intermediate vault, overrides the plan's intermediate_retention_days.
2628
local_retention_days = optional(number) # Number of days to retain backups in the member account vault. If not specified, defaults to delete_after_days.
2729
name = optional(string)
28-
schedule_expression = string,
30+
schedule_expression = string
2931
start_backup_window_minutes = optional(number)
3032
}))
3133
}))
32-
restores_enabled = bool,
3334
retained_vaults = optional(list(object({
34-
min_retention_days = number,
35-
max_retention_days = number,
35+
min_retention_days = number
36+
max_retention_days = number
3637
use_logically_air_gapped_vault = optional(bool, false)
3738
})), [])
38-
targets = list(string)
3939
}))
4040
}
4141

0 commit comments

Comments
 (0)