Terraform Aws Hugo S3 Cloudfront

screenshot of Terraform Aws Hugo S3 Cloudfront

Terraform module to create S3 bucket and CloudFront distribution for hosting a Hugo site

Overview

The Terraform module for hosting Hugo sites on S3 and CloudFront provides an efficient way to manage your static websites with ease. By leveraging Amazon's S3 and CloudFront services, this module streamlines the setup, ensuring that your Hugo-generated outputs are served quickly and reliably. This is particularly useful if you're managing multiple Hugo sites, as it helps maintain consistent configurations across all deployments.

With this module, you gain the ability to serve your Hugo sites with friendly URLs and robust error handling, while also optimizing your content delivery with CloudFront. Overall, it's a powerful tool for anyone looking to host static websites on AWS.

Features

  • Flexible URL Handling: Supports Hugo's friendly URLs and provides options for S3 redirects, ensuring a seamless user experience.
  • Custom Caching Settings: Allows configuration of minimum, maximum, and default caching TTL for CloudFront, optimizing content delivery based on your needs.
  • Custom Error Responses: Enables the use of custom error documents, such as a 200 OK response for Single Page Apps, preventing unwanted 404 errors.
  • CORS Configuration: Fully configurable CORS settings to control cross-origin requests, enhancing security and flexibility for your sites.
  • Viewer Protocol Policy: Offers options for viewer protocol policies, ensuring secure connections with settings for allow-all, https-only, or redirect-to-https.
  • Route Management: Features predefined routing rules to manage redirect behavior, helping users land on the correct content effortlessly.
  • SSL Protocols: Customizable SSL protocols for CloudFront, with defaults set for stringent security using TLSv1.2.
  • Easy Input Configuration: Simple required inputs like bucket name, domain, and user permissions make the setup straightforward and user-friendly.