Module library

CloudFront

Terraform module to create AWS CloudFront resources

Version
Submodules
trust_store

Inputs

40 / 41
default_cache_behaviorrequiredobject({ allowed_methods = optional(list(string), ["GET", "HEAD", "OPTIONS"]) ca…

The default cache behavior for this distribution

aliasesoptionallist(string)

Extra CNAMEs (alternate domain names), if any, for this distribution

Defaultnull
anycast_ip_list_idoptionalstring

ID of the Anycast static IP list that is associated with the distribution

Defaultnull
cache_policiesoptionalmap(object({ name = optional(string) comment = optional(string) default_ttl = op…

Map of CloudFront cache policies

Defaultnull
cache_tag_configoptionalobject({ header_name = string })

Cache tag configuration block for cache tag extraction from origin responses (maximum one). See the [AWS documentation](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/invalidation-by-tags.html) for more information about cache tags

Defaultnull
cloudfront_functionsoptionalmap(object({ name = optional(string) runtime = optional(string, "cloudfront-js-2…

Map of CloudFront Function configurations. Key is used as default function name if 'name' not specified

Defaultnull
commentoptionalstring

Any comments you want to include about the distribution

Defaultnull
connection_function_association_idoptionalstring

Identifier of the connection function to associate with the distribution

Defaultnull
connection_function_codeoptionalstring

The code of the CloudFront connection function

Defaultnull
connection_function_configoptionalobject({ comment = string runtime = string key_value_store_association = optiona…

Configuration block for the CloudFront connection function

Defaultnull
connection_function_nameoptionalstring

The name of the CloudFront connection function

Defaultnull
connection_function_publishoptionalbool

Whether to publish the function to the LIVE stage after creation or update. Defaults to false

Defaultnull
continuous_deployment_policy_idoptionalstring

Identifier of a continuous deployment policy. This argument should only be set on a production distribution

Defaultnull
createoptionalbool

Controls if resources should be created (affects nearly all resources)

Defaulttrue
create_connection_functionoptionalbool

Controls whether to create a CloudFront connection function

Defaultfalse
create_monitoring_subscriptionoptionalbool

If enabled, the resource for monitoring subscription will created

Defaultfalse
custom_error_responseoptionallist(object({ error_caching_min_ttl = optional(number) error_code = number respo…

One or more custom error response elements

Defaultnull
default_root_objectoptionalstring

The object that you want CloudFront to return (for example, index.html) when an end user requests the root URL

Defaultnull
enable_v2_loggingoptionalbool

Whether to enable v2 logging for the CloudFront distribution

Defaultfalse
enabledoptionalbool

Whether the distribution is enabled to accept end user requests for content

Defaulttrue
http_versionoptionalstring

The maximum HTTP version to support on the distribution. Allowed values are http1.1, http2, http2and3, and http3. The default is http2

Defaulthttp2
is_ipv6_enabledoptionalbool

Whether the IPv6 is enabled for the distribution

Defaulttrue
logging_configoptionalobject({ bucket = optional(string) include_cookies = optional(bool) prefix = opt…

The logging configuration that controls how logs are written to your distribution (maximum one)

Defaultnull
ordered_cache_behavioroptionallist(object({ allowed_methods = optional(list(string), ["GET", "HEAD", "OPTIONS"…

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

Default[]
originoptionalmap(object({ connection_attempts = optional(number) connection_timeout = optiona…

One or more origins for this distribution (multiples allowed)

Default{}
origin_access_controloptionalmap(object({ description = optional(string) name = optional(string) origin_type …

Map of CloudFront origin access control

Default{…}
origin_groupoptionalmap(object({ failover_criteria = object({ status_codes = list(number) }) member …

One or more origin_group for this distribution (multiples allowed)

Defaultnull
origin_request_policiesoptionalmap(object({ name = optional(string) comment = optional(string) cookies_config =…

Map of CloudFront origin request policies

Defaultnull
price_classoptionalstring

The price class for this distribution. One of `PriceClass_All`, `PriceClass_200`, `PriceClass_100`

Defaultnull
realtime_metrics_subscription_statusoptionalstring

A flag that indicates whether additional CloudWatch metrics are enabled for a given CloudFront distribution. Valid values are `Enabled` and `Disabled`

DefaultEnabled
response_headers_policiesoptionalmap(object({ name = optional(string) comment = optional(string) cors_config = op…

Map of CloudFront response headers policies with their configurations

Defaultnull
restrictionsoptionalobject({ geo_restriction = object({ locations = optional(list(string)) restricti…

The restrictions configuration for this distribution

Default{…}
retain_on_deleteoptionalbool

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

Defaultnull
stagingoptionalbool

Whether the distribution is a staging distribution

Defaultnull
tagsoptionalmap(string)

A map of tags to add to all resources

Default{}
v2_loggingoptionalobject({ # Destination delivery_destination_configuration = optional(object({ de…

Configuration block for v2 logging destination

Defaultnull
viewer_certificateoptionalobject({ acm_certificate_arn = optional(string) cloudfront_default_certificate =…

The SSL configuration for this distribution

Default{}
viewer_mtls_configoptionalobject({ mode = optional(string) trust_store_config = optional(object({ trust_st…

The viewer mTLS configuration for this distribution

Defaultnull
vpc_originoptionalmap(object({ arn = string http_port = number https_port = number name = optional…

Map of CloudFront VPC origins

Defaultnull
wait_for_deploymentoptionalbool

If enabled, the resource will wait for the distribution status to change from InProgress to Deployed. Setting this to false will skip the process

Defaultnull

1 of 41 must be supplied; the rest have defaults. Showing 40, so the site stays a static download — the remaining 1 are in the source.

Outputs

22
cloudfront_cache_policies

The cache policies created

cloudfront_distribution_arn

The ARN (Amazon Resource Name) for the distribution.

cloudfront_distribution_caller_reference

Internal value used by CloudFront to allow future updates to the distribution configuration.

cloudfront_distribution_domain_name

The domain name corresponding to the distribution.

cloudfront_distribution_etag

The current version of the distribution's information.

cloudfront_distribution_hosted_zone_id

The CloudFront Route 53 zone ID that can be used to route an Alias Resource Record Set to.

cloudfront_distribution_id

The identifier for the distribution.

cloudfront_distribution_in_progress_validation_batches

The number of invalidation batches currently in progress.

cloudfront_distribution_last_modified_time

The date and time the distribution was last modified.

cloudfront_distribution_status

The current status of the distribution. Deployed if the distribution's information is fully propagated throughout the Amazon CloudFront system.

cloudfront_distribution_trusted_signers

List of nested attributes for active trusted signers, if the distribution is set up to serve private content with signed URLs

cloudfront_functions

The CloudFront Functions created

cloudfront_monitoring_subscription_id

The ID of the CloudFront monitoring subscription, which corresponds to the `distribution_id`.

cloudfront_origin_access_controls

The origin access controls created

cloudfront_origin_request_policies

The origin request policies created

cloudfront_response_headers_policies

The response headers policies created

cloudfront_vpc_origins

The IDS of the VPC origin created

connection_function_arn

ARN of the connection function

connection_function_etag

ETag of the connection function

connection_function_id

ID of the connection function

connection_function_live_stage_etag

ETag of the function's LIVE stage. Will be empty if the function has not been published

connection_function_status

Status of the connection function

What the agent wires into the next module. An edge on the architecture diagram is one of these consumed by something else.