Skip to content

feat: Add timeouts block for vpc origin resource #165

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .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.96.2
rev: v1.99.1
hooks:
- id: terraform_fmt
- id: terraform_wrapper_module_for_each
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,17 @@ No modules.
| <a name="input_logging_config"></a> [logging\_config](#input\_logging\_config) | The logging configuration that controls how logs are written to your distribution (maximum one). | `any` | `{}` | no |
| <a name="input_ordered_cache_behavior"></a> [ordered\_cache\_behavior](#input\_ordered\_cache\_behavior) | An ordered list of cache behaviors resource for this distribution. List from top to bottom in order of precedence. The topmost cache behavior will have precedence 0. | `any` | `[]` | no |
| <a name="input_origin"></a> [origin](#input\_origin) | One or more origins for this distribution (multiples allowed). | `any` | `null` | no |
| <a name="input_origin_access_control"></a> [origin\_access\_control](#input\_origin\_access\_control) | Map of CloudFront origin access control | <pre>map(object({<br/> description = string<br/> origin_type = string<br/> signing_behavior = string<br/> signing_protocol = string<br/> }))</pre> | <pre>{<br/> "s3": {<br/> "description": "",<br/> "origin_type": "s3",<br/> "signing_behavior": "always",<br/> "signing_protocol": "sigv4"<br/> }<br/>}</pre> | no |
| <a name="input_origin_access_control"></a> [origin\_access\_control](#input\_origin\_access\_control) | Map of CloudFront origin access control | <pre>map(object({<br> description = string<br> origin_type = string<br> signing_behavior = string<br> signing_protocol = string<br> }))</pre> | <pre>{<br> "s3": {<br> "description": "",<br> "origin_type": "s3",<br> "signing_behavior": "always",<br> "signing_protocol": "sigv4"<br> }<br>}</pre> | no |
| <a name="input_origin_access_identities"></a> [origin\_access\_identities](#input\_origin\_access\_identities) | Map of CloudFront origin access identities (value as a comment) | `map(string)` | `{}` | no |
| <a name="input_origin_group"></a> [origin\_group](#input\_origin\_group) | One or more origin\_group for this distribution (multiples allowed). | `any` | `{}` | no |
| <a name="input_price_class"></a> [price\_class](#input\_price\_class) | The price class for this distribution. One of PriceClass\_All, PriceClass\_200, PriceClass\_100 | `string` | `null` | no |
| <a name="input_realtime_metrics_subscription_status"></a> [realtime\_metrics\_subscription\_status](#input\_realtime\_metrics\_subscription\_status) | A flag that indicates whether additional CloudWatch metrics are enabled for a given CloudFront distribution. Valid values are `Enabled` and `Disabled`. | `string` | `"Enabled"` | no |
| <a name="input_retain_on_delete"></a> [retain\_on\_delete](#input\_retain\_on\_delete) | Disables the distribution instead of deleting it when destroying the resource through Terraform. If this is set, the distribution needs to be deleted manually afterwards. | `bool` | `false` | no |
| <a name="input_staging"></a> [staging](#input\_staging) | Whether the distribution is a staging distribution. | `bool` | `false` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to assign to the resource. | `map(string)` | `null` | no |
| <a name="input_viewer_certificate"></a> [viewer\_certificate](#input\_viewer\_certificate) | The SSL configuration for this distribution | `any` | <pre>{<br/> "cloudfront_default_certificate": true,<br/> "minimum_protocol_version": "TLSv1"<br/>}</pre> | no |
| <a name="input_vpc_origin"></a> [vpc\_origin](#input\_vpc\_origin) | Map of CloudFront VPC origin | <pre>map(object({<br/> name = string<br/> arn = string<br/> http_port = number<br/> https_port = number<br/> origin_protocol_policy = string<br/> origin_ssl_protocols = object({<br/> items = list(string)<br/> quantity = number<br/> })<br/> }))</pre> | `{}` | no |
| <a name="input_viewer_certificate"></a> [viewer\_certificate](#input\_viewer\_certificate) | The SSL configuration for this distribution | `any` | <pre>{<br> "cloudfront_default_certificate": true,<br> "minimum_protocol_version": "TLSv1"<br>}</pre> | no |
| <a name="input_vpc_origin"></a> [vpc\_origin](#input\_vpc\_origin) | Map of CloudFront VPC origin | <pre>map(object({<br> name = string<br> arn = string<br> http_port = number<br> https_port = number<br> origin_protocol_policy = string<br> origin_ssl_protocols = object({<br> items = list(string)<br> quantity = number<br> })<br> }))</pre> | `{}` | no |
| <a name="input_vpc_origin_timeouts"></a> [vpc\_origin\_timeouts](#input\_vpc\_origin\_timeouts) | Create, update, and delete timeout configurations for vpc origin | `map(string)` | `{}` | no |
| <a name="input_wait_for_deployment"></a> [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 |
| <a name="input_web_acl_id"></a> [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 |

Expand Down
6 changes: 6 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
}
1 change: 1 addition & 0 deletions wrappers/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Loading