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

Conversation

Ichigo97438
Copy link

@Ichigo97438 Ichigo97438 commented Jun 4, 2025

Description

Adds timeouts configuration for vpc origin resource.

resource "aws_cloudfront_vpc_origin" "this" {
  for_each = local.create_vpc_origin ? var.vpc_origin : {}

  vpc_origin_endpoint_config {
    name                   = each.value["name"]
    arn                    = each.value["arn"]
    http_port              = each.value["http_port"]
    https_port             = each.value["https_port"]
    origin_protocol_policy = each.value["origin_protocol_policy"]

    origin_ssl_protocols {
      items    = each.value.origin_ssl_protocols.items
      quantity = each.value.origin_ssl_protocols.quantity
    }
  }

  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
}

Motivation and Context

Solves #163
VPC Origin creation can be longer than default terraform timeout, which stops deployments and forces to manually untaint resource before continuing deployment.
This PR adds an optional timeout configuration in the vpc_origin variable and uses this configuration in the aws_cloudfront_vpc_origin resource.

Breaking Changes

N/A

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

@Ichigo97438 Ichigo97438 changed the title feat: add timeouts block for vpc origin resource Add timeouts block for vpc origin resource Jun 4, 2025
@Ichigo97438 Ichigo97438 changed the title Add timeouts block for vpc origin resource feat: add timeouts block for vpc origin resource Jun 4, 2025
@Ichigo97438 Ichigo97438 changed the title feat: add timeouts block for vpc origin resource feat: Add timeouts block for vpc origin resource Jun 4, 2025
@bryantbiggs
Copy link
Member

ah, this module still supports Terraform 0.13.x which means we won't be able to use variable optional attributes (1.3+)

we'll have to wait to take a breaking change to update

@Ichigo97438
Copy link
Author

@bryantbiggs
I created a new variable vpc_origin_timeouts instead so as to not use optional and avoid breaking changes.

@Ichigo97438
Copy link
Author

Hi @bryantbiggs!
The latest pipeline failed because of an issue in module ec2 (terraform-aws-modules/terraform-aws-ec2-instance#434).
It is not related to the changes in this pull request.

Can this pull request still be merged or should changes be made to versions.tf file to force the aws provider version following the quick fix mentioned in the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants