Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added backup selection by resource #13

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ resource "aws_backup_selection" "backup_selection" {

name = "selection-${var.name}-backup"
iam_role_arn = aws_iam_role.backup_role[0].arn

plan_id = aws_backup_plan.backup_plan[0].id

resources = [var.resources]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An input variable with the name "resources" has not been declared


selection_tag {
type = var.selection_tag_type
key = var.selection_tag_key
Expand All @@ -82,4 +83,16 @@ resource "aws_backup_vault_notifications" "default" {
backup_vault_name = aws_backup_vault.backup_vault.name
sns_topic_arn = var.vault_notification_sns_topic_arn
backup_vault_events = var.backup_vault_events
}

# AWS Backup selection - selection resources
resource "aws_backup_selection" "backup_selection_resources" {
count = var.account_type == local.account_type.workload ? 1 : 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add the resource selection by ARN to the same backup selection block that already works with tags? https://github.com/DNXLabs/terraform-aws-backup/blob/master/main.tf#L62


name = "resources-${var.name}-backup"
iam_role_arn = aws_iam_role.backup_role[0].arn
plan_id = aws_backup_plan.backup_plan[0].id
resources = var.selection_resources

condition {}
}