Skip to content

pbs-common/terraform-aws-cloudfront-cache-policy-module

Repository files navigation

PBS TF CloudFront Cache Policy Module

Installation

Using the Repo Source

Use this URL for the source of the module. See the usage examples below for more details.

github.com/pbs/terraform-aws-cloudfront-cache-policy-module?ref=1.0.0

Alternative Installation Methods

More information can be found on these install methods and more in the documentation here.

Usage

This module provisions a Cloudfront cache policy. By default, all cookies and query strings are sent through, but no headers are sent.

Integrate this module like so:

module "cache_policy" {
  source = "github.com/pbs/terraform-aws-cloudfront-cache-policy-module?ref=1.0.0"

  # Optional Parameters
  # name = "custom-name"
  # comment = "Custom cloudfront cache policy"

  # min_ttl = 5
  # default_ttl = 10
  # max_ttl = 300

  # enable_accept_encoding_brotli = false
  # enable_accept_encoding_gzip = false

  # cookie_behavior = "whitelist"
  # cookies         = ["example", "example2"]

  # header_behavior = "whitelist"
  # headers         = ["example", "example2"]

  # query_string_behavior = "whitelist"
  # query_strings         = ["example", "example2"]

  # Tagging Parameters
  product = var.product

  # Optional Parameters
}

Adding This Version of the Module

If this repo is added as a subtree, then the version of the module should be close to the version shown here:

1.0.0

Note, however that subtrees can be altered as desired within repositories.

Further documentation on usage can be found here.

Below is automatically generated documentation on this Terraform module using terraform-docs


Requirements

Name Version
terraform >= 1.13.0
aws >= 6.0.0

Providers

Name Version
aws 6.16.0

Modules

No modules.

Resources

Name Type
aws_cloudfront_cache_policy.cache_policy resource

Inputs

Name Description Type Default Required
product Tag used to group resources according to product string n/a yes
comment A comment to describe the cache policy. string null no
cookie_behavior Determines whether any cookies in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist, allExcept, all. string "all" no
cookies List of cookie names. See Items for more information. list(string) [] no
default_ttl The default amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated. number null no
enable_accept_encoding_brotli A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included in requests that CloudFront sends to the origin. bool true no
enable_accept_encoding_gzip A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included in requests that CloudFront sends to the origin. bool true no
header_behavior Determines whether any HTTP headers are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist. string "none" no
headers List of header names. See Items for more information. list(string) [] no
max_ttl The maximum amount of time, in seconds, that objects stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated. number null no
min_ttl The minimum amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated. number 0 no
name Name of the Cloudfront Cache Policy Module. If null, will default to product. string null no
query_string_behavior Determines whether any URL query strings in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist, allExcept, all. string "all" no
query_strings List of query string names. See Items for more information. list(string) [] no

Outputs

Name Description
id ID of the CloudFront Cache Policy
name Name of the CloudFront Cache Policy

About

Provisions a standard PBS CloudFront cache policy

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •