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

fix: Fixed logging in the example code #129

Merged
merged 1 commit into from
Feb 9, 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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.76.0
rev: v1.86.0
hooks:
- id: terraform_fmt
- id: terraform_wrapper_module_for_each
Expand All @@ -24,7 +24,7 @@ repos:
- '--args=--only=terraform_standard_module_structure'
- '--args=--only=terraform_workspace_remote'
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
6 changes: 3 additions & 3 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ Note that this example may create resources which cost money. Run `terraform des
|------|--------|---------|
| <a name="module_acm"></a> [acm](#module\_acm) | terraform-aws-modules/acm/aws | ~> 4.0 |
| <a name="module_cloudfront"></a> [cloudfront](#module\_cloudfront) | ../../ | n/a |
| <a name="module_lambda_function"></a> [lambda\_function](#module\_lambda\_function) | terraform-aws-modules/lambda/aws | ~> 4.0 |
| <a name="module_log_bucket"></a> [log\_bucket](#module\_log\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 3.0 |
| <a name="module_lambda_function"></a> [lambda\_function](#module\_lambda\_function) | terraform-aws-modules/lambda/aws | ~> 7.0 |
| <a name="module_log_bucket"></a> [log\_bucket](#module\_log\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 4.0 |
| <a name="module_records"></a> [records](#module\_records) | terraform-aws-modules/route53/aws//modules/records | ~> 2.0 |
| <a name="module_s3_one"></a> [s3\_one](#module\_s3\_one) | terraform-aws-modules/s3-bucket/aws | ~> 3.0 |
| <a name="module_s3_one"></a> [s3\_one](#module\_s3\_one) | terraform-aws-modules/s3-bucket/aws | ~> 4.0 |

## Resources

Expand Down
11 changes: 7 additions & 4 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -199,18 +199,21 @@ data "aws_cloudfront_log_delivery_canonical_user_id" "cloudfront" {}

module "s3_one" {
source = "terraform-aws-modules/s3-bucket/aws"
version = "~> 3.0"
version = "~> 4.0"

bucket = "s3-one-${random_pet.this.id}"
force_destroy = true
}

module "log_bucket" {
source = "terraform-aws-modules/s3-bucket/aws"
version = "~> 3.0"
version = "~> 4.0"

bucket = "logs-${random_pet.this.id}"
acl = null

control_object_ownership = true
object_ownership = "ObjectWriter"

grant = [{
type = "CanonicalUser"
permission = "FULL_CONTROL"
Expand Down Expand Up @@ -246,7 +249,7 @@ resource "null_resource" "download_package" {

module "lambda_function" {
source = "terraform-aws-modules/lambda/aws"
version = "~> 4.0"
version = "~> 7.0"

function_name = "${random_pet.this.id}-lambda"
description = "My awesome lambda function"
Expand Down
48 changes: 24 additions & 24 deletions wrappers/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,22 @@ module "wrapper" {

for_each = var.items

create_distribution = try(each.value.create_distribution, var.defaults.create_distribution, true)
create_origin_access_identity = try(each.value.create_origin_access_identity, var.defaults.create_origin_access_identity, false)
origin_access_identities = try(each.value.origin_access_identities, var.defaults.origin_access_identities, {})
create_origin_access_control = try(each.value.create_origin_access_control, var.defaults.create_origin_access_control, false)
aliases = try(each.value.aliases, var.defaults.aliases, null)
comment = try(each.value.comment, var.defaults.comment, null)
create_distribution = try(each.value.create_distribution, var.defaults.create_distribution, true)
create_monitoring_subscription = try(each.value.create_monitoring_subscription, var.defaults.create_monitoring_subscription, false)
create_origin_access_control = try(each.value.create_origin_access_control, var.defaults.create_origin_access_control, false)
create_origin_access_identity = try(each.value.create_origin_access_identity, var.defaults.create_origin_access_identity, false)
custom_error_response = try(each.value.custom_error_response, var.defaults.custom_error_response, {})
default_cache_behavior = try(each.value.default_cache_behavior, var.defaults.default_cache_behavior, null)
default_root_object = try(each.value.default_root_object, var.defaults.default_root_object, null)
enabled = try(each.value.enabled, var.defaults.enabled, true)
geo_restriction = try(each.value.geo_restriction, var.defaults.geo_restriction, {})
http_version = try(each.value.http_version, var.defaults.http_version, "http2")
is_ipv6_enabled = try(each.value.is_ipv6_enabled, var.defaults.is_ipv6_enabled, null)
logging_config = try(each.value.logging_config, var.defaults.logging_config, {})
ordered_cache_behavior = try(each.value.ordered_cache_behavior, var.defaults.ordered_cache_behavior, [])
origin = try(each.value.origin, var.defaults.origin, null)
origin_access_control = try(each.value.origin_access_control, var.defaults.origin_access_control, {
s3 = {
description = "",
Expand All @@ -15,28 +27,16 @@ module "wrapper" {
signing_protocol = "sigv4"
}
})
aliases = try(each.value.aliases, var.defaults.aliases, null)
comment = try(each.value.comment, var.defaults.comment, null)
default_root_object = try(each.value.default_root_object, var.defaults.default_root_object, null)
enabled = try(each.value.enabled, var.defaults.enabled, true)
http_version = try(each.value.http_version, var.defaults.http_version, "http2")
is_ipv6_enabled = try(each.value.is_ipv6_enabled, var.defaults.is_ipv6_enabled, null)
price_class = try(each.value.price_class, var.defaults.price_class, null)
retain_on_delete = try(each.value.retain_on_delete, var.defaults.retain_on_delete, false)
wait_for_deployment = try(each.value.wait_for_deployment, var.defaults.wait_for_deployment, true)
web_acl_id = try(each.value.web_acl_id, var.defaults.web_acl_id, null)
tags = try(each.value.tags, var.defaults.tags, null)
origin = try(each.value.origin, var.defaults.origin, null)
origin_group = try(each.value.origin_group, var.defaults.origin_group, {})
origin_access_identities = try(each.value.origin_access_identities, var.defaults.origin_access_identities, {})
origin_group = try(each.value.origin_group, var.defaults.origin_group, {})
price_class = try(each.value.price_class, var.defaults.price_class, null)
realtime_metrics_subscription_status = try(each.value.realtime_metrics_subscription_status, var.defaults.realtime_metrics_subscription_status, "Enabled")
retain_on_delete = try(each.value.retain_on_delete, var.defaults.retain_on_delete, false)
tags = try(each.value.tags, var.defaults.tags, null)
viewer_certificate = try(each.value.viewer_certificate, var.defaults.viewer_certificate, {
cloudfront_default_certificate = true
minimum_protocol_version = "TLSv1"
})
geo_restriction = try(each.value.geo_restriction, var.defaults.geo_restriction, {})
logging_config = try(each.value.logging_config, var.defaults.logging_config, {})
custom_error_response = try(each.value.custom_error_response, var.defaults.custom_error_response, {})
default_cache_behavior = try(each.value.default_cache_behavior, var.defaults.default_cache_behavior, null)
ordered_cache_behavior = try(each.value.ordered_cache_behavior, var.defaults.ordered_cache_behavior, [])
create_monitoring_subscription = try(each.value.create_monitoring_subscription, var.defaults.create_monitoring_subscription, false)
realtime_metrics_subscription_status = try(each.value.realtime_metrics_subscription_status, var.defaults.realtime_metrics_subscription_status, "Enabled")
wait_for_deployment = try(each.value.wait_for_deployment, var.defaults.wait_for_deployment, true)
web_acl_id = try(each.value.web_acl_id, var.defaults.web_acl_id, null)
}
2 changes: 1 addition & 1 deletion wrappers/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
output "wrapper" {
description = "Map of outputs of a wrapper."
value = module.wrapper
# sensitive = false # No sensitive module output found
# sensitive = false # No sensitive module output found
}
Loading