英文:
Aws backup plan multiple selection_tags
问题
我有一个问题,我已经研究了几个小时,但仍然没有得到一个合适的答案。
我正在terraform中定义一个aws_backup_plan。
module "backup" {
count = var.backup_enabled ? 1 : 0
source = "somwthing/backup/aws"
enabled = var.backup_enabled
version = "0.13.1"
namespace = "sr"
stage = var.stage
name = "storage-backups"
tags = var.tags
schedule = "cron(0 10 ? * * *)" # At 10:00 AM, daily
iam_role_name = local.iam_role_name # unique role name per region as IAM resources are global
delete_after = 35 # cannot be bigger than 35 days
enable_continuous_backup = true
backup_resources = var.backup_resources
selection_tags = [
{ type = "STRINGEQUALS", key = "backup", value = "weekly" },
{ type = "STRINGEQUALS", key = "backup", value = "daily" }
]
}
我刚刚添加了 { type = "STRINGEQUALS", key = "backup", value = "daily" }
到 selection_tags
。我的问题是,如果我对一个资源打上数组中的一个标签,它会被分配给备份计划吗?也就是说,这个数组是否像一个OR运算符一样工作?
英文:
I have a question that I have been researching for a few hours now but still didn't manage to get a proper answer.
I'm defining an aws_backup_plan in terraform.
module "backup" {
count = var.backup_enabled ? 1 : 0
source = "somwthing/backup/aws"
enabled = var.backup_enabled
version = "0.13.1"
namespace = "sr"
stage = var.stage
name = "storage-backups"
tags = var.tags
schedule = "cron(0 10 ? * * *)" # At 10:00 AM, daily
iam_role_name = local.iam_role_name # unique role name per region as IAM resources are global
delete_after = 35 # cannot be bigger than 35 days
enable_continuous_backup = true
backup_resources = var.backup_resources
selection_tags = [
{ type = "STRINGEQUALS", key = "backup", value = "weekly" },
{ type = "STRINGEQUALS", key = "backup", value = "daily" }
]
}
I have just added { type = "STRINGEQUALS", key = "backup", value = "daily" }
to the selection_tags
. My question is, if I tag one resource with one of the tags in the array does it get assigned the backup plan? I.e. does this array behave like an OR operator?
答案1
得分: 2
这取决于条件的编写方式,在这个特定示例中,它的行为类似于“AND”语句而不是“OR”语句。这是为了在创建计划时提供精细的定位机制而设计的。
请查看来自AWS备份的这个图像:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论