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

feat!: Added support for date-based partitioning. Bump AWS provider version to 5.x and Terraform to 1.0 #268

Merged
merged 6 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ Users of Terragrunt can achieve similar results by using modules provided in the
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.9 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.27 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.9 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.27 |

## Modules

Expand Down Expand Up @@ -218,7 +218,7 @@ No modules.
| <a name="input_inventory_source_account_id"></a> [inventory\_source\_account\_id](#input\_inventory\_source\_account\_id) | The inventory source account id. | `string` | `null` | no |
| <a name="input_inventory_source_bucket_arn"></a> [inventory\_source\_bucket\_arn](#input\_inventory\_source\_bucket\_arn) | The inventory source bucket ARN. | `string` | `null` | no |
| <a name="input_lifecycle_rule"></a> [lifecycle\_rule](#input\_lifecycle\_rule) | List of maps containing configuration of object lifecycle management. | `any` | `[]` | no |
| <a name="input_logging"></a> [logging](#input\_logging) | Map containing access bucket logging configuration. | `map(string)` | `{}` | no |
| <a name="input_logging"></a> [logging](#input\_logging) | Map containing access bucket logging configuration. | `any` | `{}` | no |
| <a name="input_metric_configuration"></a> [metric\_configuration](#input\_metric\_configuration) | Map containing bucket metric configuration. | `any` | `[]` | no |
| <a name="input_object_lock_configuration"></a> [object\_lock\_configuration](#input\_object\_lock\_configuration) | Map containing S3 object locking configuration. | `any` | `{}` | no |
| <a name="input_object_lock_enabled"></a> [object\_lock\_enabled](#input\_object\_lock\_enabled) | Whether S3 bucket should have an Object Lock configuration enabled. | `bool` | `false` | no |
Expand Down
4 changes: 2 additions & 2 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.9 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.27 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.9 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.27 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.0 |

## Modules
Expand Down
7 changes: 6 additions & 1 deletion examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ provider "aws" {
skip_metadata_api_check = true
skip_region_validation = true
skip_credentials_validation = true
skip_requesting_account_id = true
}

locals {
Expand Down Expand Up @@ -167,6 +166,12 @@ module "s3_bucket" {
logging = {
target_bucket = module.log_bucket.s3_bucket_id
target_prefix = "log/"
target_object_key_format = {
partitioned_prefix = {
partition_date_source = "DeliveryTime" # "EventTime"
}
# simple_prefix = {}
}
}

versioning = {
Expand Down
2 changes: 1 addition & 1 deletion examples/complete/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.9"
version = ">= 5.27"
}
random = {
source = "hashicorp/random"
Expand Down
4 changes: 2 additions & 2 deletions examples/s3-analytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ Please check [complete example](https://github.com/terraform-aws-modules/terrafo
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.9 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.27 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.9 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.27 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.0 |

## Modules
Expand Down
2 changes: 1 addition & 1 deletion examples/s3-analytics/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.9"
version = ">= 5.27"
}
random = {
source = "hashicorp/random"
Expand Down
4 changes: 2 additions & 2 deletions examples/s3-inventory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ Please check [complete example](https://github.com/terraform-aws-modules/terrafo
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.9 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.27 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.9 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.27 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.0 |

## Modules
Expand Down
2 changes: 1 addition & 1 deletion examples/s3-inventory/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.9"
version = ">= 5.27"
}
random = {
source = "hashicorp/random"
Expand Down
6 changes: 3 additions & 3 deletions examples/s3-replication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.9 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.27 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.9 |
| <a name="provider_aws.replica"></a> [aws.replica](#provider\_aws.replica) | >= 4.9 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.27 |
| <a name="provider_aws.replica"></a> [aws.replica](#provider\_aws.replica) | >= 5.27 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.0 |

## Modules
Expand Down
2 changes: 1 addition & 1 deletion examples/s3-replication/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.9"
version = ">= 5.27"
}
random = {
source = "hashicorp/random"
Expand Down
21 changes: 21 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,27 @@ resource "aws_s3_bucket_logging" "this" {

target_bucket = var.logging["target_bucket"]
target_prefix = try(var.logging["target_prefix"], null)


dynamic "target_object_key_format" {
for_each = try([var.logging["target_object_key_format"]], [])

content {
dynamic "partitioned_prefix" {
for_each = try(target_object_key_format.value["partitioned_prefix"], [])

content {
partition_date_source = try(partitioned_prefix.value, null)
}
}

dynamic "simple_prefix" {
for_each = contains(keys(target_object_key_format.value), "simple_prefix") ? [true] : []

content {}
}
}
}
}

resource "aws_s3_bucket_acl" "this" {
Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ variable "versioning" {

variable "logging" {
description = "Map containing access bucket logging configuration."
type = map(string)
type = any
default = {}
}

Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.9"
version = ">= 5.27"
}
}
}
74 changes: 37 additions & 37 deletions wrappers/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,57 @@ module "wrapper" {

for_each = var.items

create_bucket = try(each.value.create_bucket, var.defaults.create_bucket, true)
attach_elb_log_delivery_policy = try(each.value.attach_elb_log_delivery_policy, var.defaults.attach_elb_log_delivery_policy, false)
attach_lb_log_delivery_policy = try(each.value.attach_lb_log_delivery_policy, var.defaults.attach_lb_log_delivery_policy, false)
acceleration_status = try(each.value.acceleration_status, var.defaults.acceleration_status, null)
access_log_delivery_policy_source_accounts = try(each.value.access_log_delivery_policy_source_accounts, var.defaults.access_log_delivery_policy_source_accounts, [])
access_log_delivery_policy_source_buckets = try(each.value.access_log_delivery_policy_source_buckets, var.defaults.access_log_delivery_policy_source_buckets, [])
acl = try(each.value.acl, var.defaults.acl, null)
allowed_kms_key_arn = try(each.value.allowed_kms_key_arn, var.defaults.allowed_kms_key_arn, null)
analytics_configuration = try(each.value.analytics_configuration, var.defaults.analytics_configuration, {})
analytics_self_source_destination = try(each.value.analytics_self_source_destination, var.defaults.analytics_self_source_destination, false)
analytics_source_account_id = try(each.value.analytics_source_account_id, var.defaults.analytics_source_account_id, null)
analytics_source_bucket_arn = try(each.value.analytics_source_bucket_arn, var.defaults.analytics_source_bucket_arn, null)
attach_access_log_delivery_policy = try(each.value.attach_access_log_delivery_policy, var.defaults.attach_access_log_delivery_policy, false)
attach_deny_insecure_transport_policy = try(each.value.attach_deny_insecure_transport_policy, var.defaults.attach_deny_insecure_transport_policy, false)
attach_require_latest_tls_policy = try(each.value.attach_require_latest_tls_policy, var.defaults.attach_require_latest_tls_policy, false)
attach_policy = try(each.value.attach_policy, var.defaults.attach_policy, false)
attach_public_policy = try(each.value.attach_public_policy, var.defaults.attach_public_policy, true)
attach_inventory_destination_policy = try(each.value.attach_inventory_destination_policy, var.defaults.attach_inventory_destination_policy, false)
attach_analytics_destination_policy = try(each.value.attach_analytics_destination_policy, var.defaults.attach_analytics_destination_policy, false)
attach_deny_incorrect_encryption_headers = try(each.value.attach_deny_incorrect_encryption_headers, var.defaults.attach_deny_incorrect_encryption_headers, false)
attach_deny_incorrect_kms_key_sse = try(each.value.attach_deny_incorrect_kms_key_sse, var.defaults.attach_deny_incorrect_kms_key_sse, false)
allowed_kms_key_arn = try(each.value.allowed_kms_key_arn, var.defaults.allowed_kms_key_arn, null)
attach_deny_insecure_transport_policy = try(each.value.attach_deny_insecure_transport_policy, var.defaults.attach_deny_insecure_transport_policy, false)
attach_deny_unencrypted_object_uploads = try(each.value.attach_deny_unencrypted_object_uploads, var.defaults.attach_deny_unencrypted_object_uploads, false)
attach_elb_log_delivery_policy = try(each.value.attach_elb_log_delivery_policy, var.defaults.attach_elb_log_delivery_policy, false)
attach_inventory_destination_policy = try(each.value.attach_inventory_destination_policy, var.defaults.attach_inventory_destination_policy, false)
attach_lb_log_delivery_policy = try(each.value.attach_lb_log_delivery_policy, var.defaults.attach_lb_log_delivery_policy, false)
attach_policy = try(each.value.attach_policy, var.defaults.attach_policy, false)
attach_public_policy = try(each.value.attach_public_policy, var.defaults.attach_public_policy, true)
attach_require_latest_tls_policy = try(each.value.attach_require_latest_tls_policy, var.defaults.attach_require_latest_tls_policy, false)
block_public_acls = try(each.value.block_public_acls, var.defaults.block_public_acls, true)
block_public_policy = try(each.value.block_public_policy, var.defaults.block_public_policy, true)
bucket = try(each.value.bucket, var.defaults.bucket, null)
bucket_prefix = try(each.value.bucket_prefix, var.defaults.bucket_prefix, null)
acl = try(each.value.acl, var.defaults.acl, null)
policy = try(each.value.policy, var.defaults.policy, null)
tags = try(each.value.tags, var.defaults.tags, {})
force_destroy = try(each.value.force_destroy, var.defaults.force_destroy, false)
acceleration_status = try(each.value.acceleration_status, var.defaults.acceleration_status, null)
request_payer = try(each.value.request_payer, var.defaults.request_payer, null)
website = try(each.value.website, var.defaults.website, {})
control_object_ownership = try(each.value.control_object_ownership, var.defaults.control_object_ownership, false)
cors_rule = try(each.value.cors_rule, var.defaults.cors_rule, [])
versioning = try(each.value.versioning, var.defaults.versioning, {})
logging = try(each.value.logging, var.defaults.logging, {})
access_log_delivery_policy_source_buckets = try(each.value.access_log_delivery_policy_source_buckets, var.defaults.access_log_delivery_policy_source_buckets, [])
access_log_delivery_policy_source_accounts = try(each.value.access_log_delivery_policy_source_accounts, var.defaults.access_log_delivery_policy_source_accounts, [])
grant = try(each.value.grant, var.defaults.grant, [])
owner = try(each.value.owner, var.defaults.owner, {})
create_bucket = try(each.value.create_bucket, var.defaults.create_bucket, true)
expected_bucket_owner = try(each.value.expected_bucket_owner, var.defaults.expected_bucket_owner, null)
lifecycle_rule = try(each.value.lifecycle_rule, var.defaults.lifecycle_rule, [])
replication_configuration = try(each.value.replication_configuration, var.defaults.replication_configuration, {})
server_side_encryption_configuration = try(each.value.server_side_encryption_configuration, var.defaults.server_side_encryption_configuration, {})
force_destroy = try(each.value.force_destroy, var.defaults.force_destroy, false)
grant = try(each.value.grant, var.defaults.grant, [])
ignore_public_acls = try(each.value.ignore_public_acls, var.defaults.ignore_public_acls, true)
intelligent_tiering = try(each.value.intelligent_tiering, var.defaults.intelligent_tiering, {})
object_lock_configuration = try(each.value.object_lock_configuration, var.defaults.object_lock_configuration, {})
metric_configuration = try(each.value.metric_configuration, var.defaults.metric_configuration, [])
inventory_configuration = try(each.value.inventory_configuration, var.defaults.inventory_configuration, {})
inventory_self_source_destination = try(each.value.inventory_self_source_destination, var.defaults.inventory_self_source_destination, false)
inventory_source_account_id = try(each.value.inventory_source_account_id, var.defaults.inventory_source_account_id, null)
inventory_source_bucket_arn = try(each.value.inventory_source_bucket_arn, var.defaults.inventory_source_bucket_arn, null)
inventory_self_source_destination = try(each.value.inventory_self_source_destination, var.defaults.inventory_self_source_destination, false)
analytics_configuration = try(each.value.analytics_configuration, var.defaults.analytics_configuration, {})
analytics_source_account_id = try(each.value.analytics_source_account_id, var.defaults.analytics_source_account_id, null)
analytics_source_bucket_arn = try(each.value.analytics_source_bucket_arn, var.defaults.analytics_source_bucket_arn, null)
analytics_self_source_destination = try(each.value.analytics_self_source_destination, var.defaults.analytics_self_source_destination, false)
lifecycle_rule = try(each.value.lifecycle_rule, var.defaults.lifecycle_rule, [])
logging = try(each.value.logging, var.defaults.logging, {})
metric_configuration = try(each.value.metric_configuration, var.defaults.metric_configuration, [])
object_lock_configuration = try(each.value.object_lock_configuration, var.defaults.object_lock_configuration, {})
object_lock_enabled = try(each.value.object_lock_enabled, var.defaults.object_lock_enabled, false)
block_public_acls = try(each.value.block_public_acls, var.defaults.block_public_acls, true)
block_public_policy = try(each.value.block_public_policy, var.defaults.block_public_policy, true)
ignore_public_acls = try(each.value.ignore_public_acls, var.defaults.ignore_public_acls, true)
restrict_public_buckets = try(each.value.restrict_public_buckets, var.defaults.restrict_public_buckets, true)
control_object_ownership = try(each.value.control_object_ownership, var.defaults.control_object_ownership, false)
object_ownership = try(each.value.object_ownership, var.defaults.object_ownership, "BucketOwnerEnforced")
owner = try(each.value.owner, var.defaults.owner, {})
policy = try(each.value.policy, var.defaults.policy, null)
putin_khuylo = try(each.value.putin_khuylo, var.defaults.putin_khuylo, true)
replication_configuration = try(each.value.replication_configuration, var.defaults.replication_configuration, {})
request_payer = try(each.value.request_payer, var.defaults.request_payer, null)
restrict_public_buckets = try(each.value.restrict_public_buckets, var.defaults.restrict_public_buckets, true)
server_side_encryption_configuration = try(each.value.server_side_encryption_configuration, var.defaults.server_side_encryption_configuration, {})
tags = try(each.value.tags, var.defaults.tags, {})
versioning = try(each.value.versioning, var.defaults.versioning, {})
website = try(each.value.website, var.defaults.website, {})
}
6 changes: 3 additions & 3 deletions wrappers/notification/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ module "wrapper" {

for_each = var.items

bucket = try(each.value.bucket, var.defaults.bucket, "")
bucket_arn = try(each.value.bucket_arn, var.defaults.bucket_arn, null)
create = try(each.value.create, var.defaults.create, true)
create_sns_policy = try(each.value.create_sns_policy, var.defaults.create_sns_policy, true)
create_sqs_policy = try(each.value.create_sqs_policy, var.defaults.create_sqs_policy, true)
bucket = try(each.value.bucket, var.defaults.bucket, "")
bucket_arn = try(each.value.bucket_arn, var.defaults.bucket_arn, null)
eventbridge = try(each.value.eventbridge, var.defaults.eventbridge, null)
lambda_notifications = try(each.value.lambda_notifications, var.defaults.lambda_notifications, {})
sqs_notifications = try(each.value.sqs_notifications, var.defaults.sqs_notifications, {})
sns_notifications = try(each.value.sns_notifications, var.defaults.sns_notifications, {})
sqs_notifications = try(each.value.sqs_notifications, var.defaults.sqs_notifications, {})
}
Loading
Loading