Skip to content

naviat/cloudfront-tf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This Terraform configuration defines an AWS CloudFront distribution for multiple EKS clusters specified in a variable called var.eks_clusters. Here's what each part of the code does:

1. Provider Configuration:

  • Specifies that AWS is the cloud provider.
  • Sets the AWS region to us-west-2 where the resources will be provisioned.

2. Resource "aws_cloudfront_distribution":

  • Defines a CloudFront distribution for each entry in the var.eks_clusters map, which presumably contains information about different EKS clusters.
  • for_each is used to create a distribution for each EKS cluster defined in the var.eks_clusters.

3. Origin Configuration:

  • Sets the domain name and origin ID for the CloudFront distribution based on values from each.value.domain_name and each.key respectively. Here, each.key might represent a unique identifier for each cluster.

4. Distribution Settings:

  • Enables the distribution and IPv6 support.
  • Defines the default cache behavior, allowing various HTTP methods and specifying which methods should be cached (GET and HEAD).
  • Sets up the policy for forwarding requests to the origin, including not forwarding query strings and not forwarding cookies.

5. Viewer Protocol Policy:

  • Enforces HTTPS by redirecting all HTTP requests to HTTPS.

6. Restrictions:

  • Applies geographic restrictions to limit access to the distribution. It uses a whitelist approach where only specified locations (defined in each.value.locations) are allowed to access the distribution.

7. Viewer Certificate:

  • Uses the default CloudFront SSL/TLS certificate to serve content over HTTPS.

Overall, this code configures a series of CloudFront distributions tailored to multiple EKS clusters, each with specific caching rules, security settings, and access restrictions based on geographic location.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages