-
Notifications
You must be signed in to change notification settings - Fork 0
/
inventory.tf
32 lines (25 loc) · 923 Bytes
/
inventory.tf
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_s3_bucket_inventory" "inventory_prefix" {
count = var.inventory_config != null ? 1 : 0
bucket = aws_s3_bucket.bucket.id
name = var.inventory_config.destination.bucket.name
enabled = var.inventory_config.enabled
included_object_versions = var.inventory_config.included_object_versions
schedule {
frequency = var.inventory_config.schedule.frequency
}
dynamic "filter" {
for_each = var.inventory_config.filter != null ? [var.inventory_config.filter] : []
content {
prefix = filter.value.prefix
}
}
optional_fields = var.inventory_config.optional_fields
destination {
bucket {
format = var.inventory_config.destination.bucket.format
bucket_arn = "arn:aws:s3:::${var.inventory_config.destination.bucket.name}"
prefix = local.inventory_bucket_prefix
account_id = var.inventory_config.destination.bucket.account_id
}
}
}