forked from PinSpace-Org/GistPin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackup.tf
More file actions
32 lines (27 loc) 路 749 Bytes
/
Copy pathbackup.tf
File metadata and controls
32 lines (27 loc) 路 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
resource "aws_backup_plan" "main" {
name = "${var.project_name}-${var.environment}-backup-plan"
rule {
rule_name = "daily_backup"
target_vault_name = aws_backup_vault.main.name
schedule = "cron(0 2 * * ? *)"
start_window = 60
completion_window = 180
lifecycle {
delete_after = var.backup_retention_days
}
}
tags = {
Environment = var.environment
Project = var.project_name
}
}
resource "aws_backup_selection" "main" {
name = "${var.project_name}-${var.environment}-backup-selection"
plan_id = aws_backup_plan.main.id
iam_role_arn = aws_iam_role.backup.arn
selection_tag {
type = "STRINGEQUALS"
key = "Backup"
value = "true"
}
}