diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5e0e62c..b84d048 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.96.2 + rev: v1.99.4 hooks: - id: terraform_fmt - id: terraform_wrapper_module_for_each diff --git a/README.md b/README.md index 2177437..ef256f5 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,7 @@ No modules. | [tags](#input\_tags) | A map of tags to assign to the resource. | `map(string)` | `null` | no | | [viewer\_certificate](#input\_viewer\_certificate) | The SSL configuration for this distribution | `any` |
{| no | | [vpc\_origin](#input\_vpc\_origin) | Map of CloudFront VPC origin |
"cloudfront_default_certificate": true,
"minimum_protocol_version": "TLSv1"
}
map(object({| `{}` | no | +| [vpc\_origin\_timeouts](#input\_vpc\_origin\_timeouts) | Create, update, and delete timeout configurations for vpc origin | `map(string)` | `{}` | no | | [wait\_for\_deployment](#input\_wait\_for\_deployment) | If enabled, the resource will wait for the distribution status to change from InProgress to Deployed. Setting this to false will skip the process. | `bool` | `true` | no | | [web\_acl\_id](#input\_web\_acl\_id) | If you're using AWS WAF to filter CloudFront requests, the Id of the AWS WAF web ACL that is associated with the distribution. The WAF Web ACL must exist in the WAF Global (CloudFront) region and the credentials configuring this argument must have waf:GetWebACL permissions assigned. If using WAFv2, provide the ARN of the web ACL. | `string` | `null` | no | diff --git a/examples/complete/README.md b/examples/complete/README.md index 8ab22bd..d2b2039 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -27,7 +27,7 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.0 | +| [terraform](#requirement\_terraform) | >= 1.5.7 | | [aws](#requirement\_aws) | >= 5.83 | | [null](#requirement\_null) | >= 2.0 | | [random](#requirement\_random) | >= 2.0 | @@ -46,11 +46,11 @@ Note that this example may create resources which cost money. Run `terraform des |------|--------|---------| | [acm](#module\_acm) | terraform-aws-modules/acm/aws | ~> 4.0 | | [cloudfront](#module\_cloudfront) | ../../ | n/a | -| [ec2](#module\_ec2) | terraform-aws-modules/ec2-instance/aws | ~> 5.0 | -| [lambda\_function](#module\_lambda\_function) | terraform-aws-modules/lambda/aws | ~> 7.0 | -| [log\_bucket](#module\_log\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 4.0 | -| [records](#module\_records) | terraform-aws-modules/route53/aws//modules/records | ~> 2.0 | -| [s3\_one](#module\_s3\_one) | terraform-aws-modules/s3-bucket/aws | ~> 4.0 | +| [ec2](#module\_ec2) | terraform-aws-modules/ec2-instance/aws | ~> 6.0 | +| [lambda\_function](#module\_lambda\_function) | terraform-aws-modules/lambda/aws | ~> 8.0 | +| [log\_bucket](#module\_log\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 5.0 | +| [records](#module\_records) | terraform-aws-modules/route53/aws//modules/records | ~> 5.0 | +| [s3\_one](#module\_s3\_one) | terraform-aws-modules/s3-bucket/aws | ~> 5.0 | ## Resources @@ -60,7 +60,6 @@ Note that this example may create resources which cost money. Run `terraform des | [aws_s3_bucket_policy.bucket_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource | | [null_resource.download_package](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | [random_pet.this](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet) | resource | -| [aws_ami.al2023](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami) | data source | | [aws_canonical_user_id.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/canonical_user_id) | data source | | [aws_cloudfront_log_delivery_canonical_user_id.cloudfront](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/cloudfront_log_delivery_canonical_user_id) | data source | | [aws_iam_policy_document.s3_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 31bb43c..76bc588 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -68,6 +68,12 @@ module "cloudfront" { } } + vpc_origin_timeouts = { + create = "20m" + update = "20m" + delete = "20m" + } + logging_config = { bucket = module.log_bucket.s3_bucket_bucket_domain_name prefix = "cloudfront" @@ -253,17 +259,17 @@ data "aws_cloudfront_log_delivery_canonical_user_id" "cloudfront" {} module "s3_one" { source = "terraform-aws-modules/s3-bucket/aws" - version = "~> 4.0" + version = "~> 5.0" - bucket = "s3-one-${random_pet.this.id}" + bucket_prefix = "s3-one-" force_destroy = true } module "log_bucket" { source = "terraform-aws-modules/s3-bucket/aws" - version = "~> 4.0" + version = "~> 5.0" - bucket = "logs-${random_pet.this.id}" + bucket_prefix = "logs-" control_object_ownership = true object_ownership = "ObjectWriter" @@ -287,7 +293,7 @@ module "log_bucket" { ############################################# locals { - package_url = "https://raw.githubusercontent.com/terraform-aws-modules/terraform-aws-lambda/master/examples/fixtures/python3.8-zip/existing_package.zip" + package_url = "https://raw.githubusercontent.com/terraform-aws-modules/terraform-aws-lambda/master/examples/fixtures/python-zip/existing_package.zip" downloaded = "downloaded_package_${md5(local.package_url)}.zip" } @@ -303,12 +309,12 @@ resource "null_resource" "download_package" { module "lambda_function" { source = "terraform-aws-modules/lambda/aws" - version = "~> 7.0" + version = "~> 8.0" function_name = "${random_pet.this.id}-lambda" description = "My awesome lambda function" handler = "index.lambda_handler" - runtime = "python3.8" + runtime = "python3.11" publish = true lambda_at_edge = true @@ -332,7 +338,7 @@ module "lambda_function" { module "records" { source = "terraform-aws-modules/route53/aws//modules/records" - version = "~> 2.0" + version = "~> 5.0" zone_id = data.aws_route53_zone.this.zone_id @@ -401,21 +407,11 @@ resource "aws_cloudfront_function" "example" { # EC2 instance for CloudFront VPC origin ######################################### -data "aws_ami" "al2023" { - most_recent = true - owners = ["amazon"] - - filter { - name = "name" - values = ["al2023-ami-2023*-x86_64"] - } -} - module "ec2" { source = "terraform-aws-modules/ec2-instance/aws" - version = "~> 5.0" + version = "~> 6.0" - ami = data.aws_ami.al2023.id + name = "ec2-vpc-origin-${random_pet.this.id}" } ######## diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf index bd90e26..e69fcd0 100644 --- a/examples/complete/versions.tf +++ b/examples/complete/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 1.0" + required_version = ">= 1.5.7" required_providers { aws = { diff --git a/main.tf b/main.tf index c13b17a..1e03a3b 100644 --- a/main.tf +++ b/main.tf @@ -41,6 +41,12 @@ resource "aws_cloudfront_vpc_origin" "this" { } } + timeouts { + create = try(var.vpc_origin_timeouts.create, null) + update = try(var.vpc_origin_timeouts.update, null) + delete = try(var.vpc_origin_timeouts.delete, null) + } + tags = var.tags } diff --git a/variables.tf b/variables.tf index 13333c3..75a2c27 100644 --- a/variables.tf +++ b/variables.tf @@ -203,3 +203,9 @@ variable "vpc_origin" { })) default = {} } + +variable "vpc_origin_timeouts" { + description = "Create, update, and delete timeout configurations for vpc origin" + type = map(string) + default = {} +} diff --git a/wrappers/main.tf b/wrappers/main.tf index a60251c..750d27e 100644 --- a/wrappers/main.tf +++ b/wrappers/main.tf @@ -41,6 +41,7 @@ module "wrapper" { minimum_protocol_version = "TLSv1" }) vpc_origin = try(each.value.vpc_origin, var.defaults.vpc_origin, {}) + vpc_origin_timeouts = try(each.value.vpc_origin_timeouts, var.defaults.vpc_origin_timeouts, {}) 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) }
name = string
arn = string
http_port = number
https_port = number
origin_protocol_policy = string
origin_ssl_protocols = object({
items = list(string)
quantity = number
})
}))