From 70adea638c9c5929f509e1e271026e1882bec3d8 Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Sat, 13 Jan 2024 11:03:05 -0500 Subject: [PATCH 1/2] fix routing rule condition --- main.tf | 2 +- wrappers/main.tf | 74 +++++++++++++++++------------------ wrappers/notification/main.tf | 6 +-- wrappers/object/main.tf | 22 +++++------ 4 files changed, 52 insertions(+), 52 deletions(-) diff --git a/main.tf b/main.tf index 60f4e308..677c1be4 100644 --- a/main.tf +++ b/main.tf @@ -117,7 +117,7 @@ resource "aws_s3_bucket_website_configuration" "this" { content { dynamic "condition" { - for_each = [try([routing_rule.value.condition], [])] + for_each = try([routing_rule.value.condition], []) content { http_error_code_returned_equals = try(routing_rule.value.condition["http_error_code_returned_equals"], null) diff --git a/wrappers/main.tf b/wrappers/main.tf index 4c0f9bc5..6372a857 100644 --- a/wrappers/main.tf +++ b/wrappers/main.tf @@ -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, {}) } diff --git a/wrappers/notification/main.tf b/wrappers/notification/main.tf index ddd2cbba..794e2686 100644 --- a/wrappers/notification/main.tf +++ b/wrappers/notification/main.tf @@ -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, {}) } diff --git a/wrappers/object/main.tf b/wrappers/object/main.tf index d6e592a6..e9fb896d 100644 --- a/wrappers/object/main.tf +++ b/wrappers/object/main.tf @@ -3,29 +3,29 @@ module "wrapper" { for_each = var.items - create = try(each.value.create, var.defaults.create, true) + acl = try(each.value.acl, var.defaults.acl, null) bucket = try(each.value.bucket, var.defaults.bucket, "") - key = try(each.value.key, var.defaults.key, "") - file_source = try(each.value.file_source, var.defaults.file_source, null) + bucket_key_enabled = try(each.value.bucket_key_enabled, var.defaults.bucket_key_enabled, null) + cache_control = try(each.value.cache_control, var.defaults.cache_control, null) content = try(each.value.content, var.defaults.content, null) content_base64 = try(each.value.content_base64, var.defaults.content_base64, null) - acl = try(each.value.acl, var.defaults.acl, null) - cache_control = try(each.value.cache_control, var.defaults.cache_control, null) content_disposition = try(each.value.content_disposition, var.defaults.content_disposition, null) content_encoding = try(each.value.content_encoding, var.defaults.content_encoding, null) content_language = try(each.value.content_language, var.defaults.content_language, null) content_type = try(each.value.content_type, var.defaults.content_type, null) - website_redirect = try(each.value.website_redirect, var.defaults.website_redirect, null) - storage_class = try(each.value.storage_class, var.defaults.storage_class, null) + create = try(each.value.create, var.defaults.create, true) etag = try(each.value.etag, var.defaults.etag, null) - server_side_encryption = try(each.value.server_side_encryption, var.defaults.server_side_encryption, null) + file_source = try(each.value.file_source, var.defaults.file_source, null) + force_destroy = try(each.value.force_destroy, var.defaults.force_destroy, false) + key = try(each.value.key, var.defaults.key, "") kms_key_id = try(each.value.kms_key_id, var.defaults.kms_key_id, null) - bucket_key_enabled = try(each.value.bucket_key_enabled, var.defaults.bucket_key_enabled, null) metadata = try(each.value.metadata, var.defaults.metadata, {}) - tags = try(each.value.tags, var.defaults.tags, {}) - force_destroy = try(each.value.force_destroy, var.defaults.force_destroy, false) object_lock_legal_hold_status = try(each.value.object_lock_legal_hold_status, var.defaults.object_lock_legal_hold_status, null) object_lock_mode = try(each.value.object_lock_mode, var.defaults.object_lock_mode, null) object_lock_retain_until_date = try(each.value.object_lock_retain_until_date, var.defaults.object_lock_retain_until_date, null) + server_side_encryption = try(each.value.server_side_encryption, var.defaults.server_side_encryption, null) source_hash = try(each.value.source_hash, var.defaults.source_hash, null) + storage_class = try(each.value.storage_class, var.defaults.storage_class, null) + tags = try(each.value.tags, var.defaults.tags, {}) + website_redirect = try(each.value.website_redirect, var.defaults.website_redirect, null) } From 334dd83a50c15dc360e04d42bb0471533bb41c6b Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Sat, 13 Jan 2024 11:32:24 -0500 Subject: [PATCH 2/2] fix ci by increasing min tf version --- README.md | 2 +- examples/complete-legacy/README.md | 2 +- examples/complete-legacy/versions.tf | 2 +- examples/complete/README.md | 2 +- examples/complete/versions.tf | 2 +- examples/notification/README.md | 2 +- examples/notification/versions.tf | 2 +- examples/object/README.md | 2 +- examples/object/versions.tf | 2 +- examples/s3-analytics/README.md | 2 +- examples/s3-analytics/versions.tf | 2 +- examples/s3-inventory/README.md | 2 +- examples/s3-inventory/versions.tf | 2 +- examples/s3-replication/README.md | 2 +- examples/s3-replication/versions.tf | 2 +- modules/notification/README.md | 2 +- modules/notification/versions.tf | 2 +- modules/object/README.md | 2 +- modules/object/versions.tf | 2 +- versions.tf | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 3a9e5ed6..aacb529b 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,7 @@ Users of Terragrunt can achieve similar results by using modules provided in the | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.9 | ## Providers diff --git a/examples/complete-legacy/README.md b/examples/complete-legacy/README.md index 24e69dd6..de3e39bf 100644 --- a/examples/complete-legacy/README.md +++ b/examples/complete-legacy/README.md @@ -13,7 +13,7 @@ Once this configuration is created, you need to use the newer version of this mo | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | ~> 3.69.0 | | [random](#requirement\_random) | >= 2.0 | diff --git a/examples/complete-legacy/versions.tf b/examples/complete-legacy/versions.tf index 25ef87e2..5172cdf7 100644 --- a/examples/complete-legacy/versions.tf +++ b/examples/complete-legacy/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/examples/complete/README.md b/examples/complete/README.md index 31f7af37..a9a37eb3 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -29,7 +29,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.9 | | [random](#requirement\_random) | >= 2.0 | diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf index 629d346a..011e2dbe 100644 --- a/examples/complete/versions.tf +++ b/examples/complete/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/examples/notification/README.md b/examples/notification/README.md index 653ab5f9..3ecc28a9 100644 --- a/examples/notification/README.md +++ b/examples/notification/README.md @@ -19,7 +19,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.9 | | [null](#requirement\_null) | >= 2.0 | | [random](#requirement\_random) | >= 2.0 | diff --git a/examples/notification/versions.tf b/examples/notification/versions.tf index f1a31086..9972020e 100644 --- a/examples/notification/versions.tf +++ b/examples/notification/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/examples/object/README.md b/examples/object/README.md index 12356578..edeb690b 100644 --- a/examples/object/README.md +++ b/examples/object/README.md @@ -19,7 +19,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.9 | | [random](#requirement\_random) | >= 2.0 | diff --git a/examples/object/versions.tf b/examples/object/versions.tf index 629d346a..011e2dbe 100644 --- a/examples/object/versions.tf +++ b/examples/object/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/examples/s3-analytics/README.md b/examples/s3-analytics/README.md index c94725be..38b2b829 100644 --- a/examples/s3-analytics/README.md +++ b/examples/s3-analytics/README.md @@ -9,7 +9,7 @@ Please check [complete example](https://github.com/terraform-aws-modules/terrafo | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.9 | | [random](#requirement\_random) | >= 2.0 | diff --git a/examples/s3-analytics/versions.tf b/examples/s3-analytics/versions.tf index 629d346a..011e2dbe 100644 --- a/examples/s3-analytics/versions.tf +++ b/examples/s3-analytics/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/examples/s3-inventory/README.md b/examples/s3-inventory/README.md index 7b9ad1f9..9bab8e69 100644 --- a/examples/s3-inventory/README.md +++ b/examples/s3-inventory/README.md @@ -9,7 +9,7 @@ Please check [complete example](https://github.com/terraform-aws-modules/terrafo | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.9 | | [random](#requirement\_random) | >= 2.0 | diff --git a/examples/s3-inventory/versions.tf b/examples/s3-inventory/versions.tf index 629d346a..011e2dbe 100644 --- a/examples/s3-inventory/versions.tf +++ b/examples/s3-inventory/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/examples/s3-replication/README.md b/examples/s3-replication/README.md index c29d107e..228262ad 100644 --- a/examples/s3-replication/README.md +++ b/examples/s3-replication/README.md @@ -21,7 +21,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.9 | | [random](#requirement\_random) | >= 2.0 | diff --git a/examples/s3-replication/versions.tf b/examples/s3-replication/versions.tf index 629d346a..011e2dbe 100644 --- a/examples/s3-replication/versions.tf +++ b/examples/s3-replication/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/modules/notification/README.md b/modules/notification/README.md index d93f19ac..fb8b7aa6 100644 --- a/modules/notification/README.md +++ b/modules/notification/README.md @@ -7,7 +7,7 @@ Creates S3 bucket notification resource with all supported types of deliveries: | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 3.74 | ## Providers diff --git a/modules/notification/versions.tf b/modules/notification/versions.tf index 538b9152..ff97a040 100644 --- a/modules/notification/versions.tf +++ b/modules/notification/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/modules/object/README.md b/modules/object/README.md index ea2405c8..4f02b571 100644 --- a/modules/object/README.md +++ b/modules/object/README.md @@ -7,7 +7,7 @@ Creates S3 bucket objects with different configurations. | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 3.75 | ## Providers diff --git a/modules/object/versions.tf b/modules/object/versions.tf index 8a65df68..3ff49692 100644 --- a/modules/object/versions.tf +++ b/modules/object/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/versions.tf b/versions.tf index affc11e7..dbc484ad 100644 --- a/versions.tf +++ b/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = {