Skip to content

0.26.0: feat: Allow specifing custom origins (#78)

Compare
Choose a tag to compare
@Gowiem Gowiem released this 27 Jun 18:15
a1ad726

what

  • allow specifing/creating (additional) custom origins

why

  • This module is really useful for front-end website deployments but sometimes it is required to use the same domain for front-end and back-end (different paths) or add some back-end functionality to front-end website without creating real back-end
  • To configure API Gateway easily
  • We already have the ability to configure ordered_cache_behaviour so we technically support multiple strategies for different paths

references

example usage

module "cloudfront-s3" {
# ...
  ordered_cache = [{
    target_origin_id            = "api-gateway-with-lambda"
    path_pattern                = "/v1/lambda"
    allowed_methods             = ["HEAD", "GET"]
    cached_methods              = ["HEAD", "GET"]
    compress                    = true
    viewer_protocol_policy      = "redirect-to-https"
    min_ttl                     = 0
    default_ttl                 = 60
    max_ttl                     = 3600
    forward_header_values       = []
    forward_query_string        = true
    forward_cookies             = "none"
    lambda_function_association = []
  }]

  custom_origins = [{
    domain_name = "xxxxxxxxxx.execute-api.us-east-1.amazonaws.com"
    origin_id   = "api-gateway-with-lambda"
    origin_path = null
    custom_origin_config = {
      http_port                = 80
      https_port               = 443
      origin_protocol_policy   = "https-only"
      origin_ssl_protocols     = ["TLSv1.2"]
      origin_keepalive_timeout = 5
      origin_read_timeout      = 30
    }
  }]
}