Skip to content

MrRaph/terraform-aws-website-serverless

 
 

Repository files navigation

AWS Serverless Infrastructure for Static Website based on Hugo

Creates a static website Infrastructure on a domain hosted on S3 and delivered by CloudFront over HTTPS with Route53 managing DNS.

Terraform Registry: https://registry.terraform.io/modules/dannylinden/website-serverless/aws/

Features

  • Redirects the following to https://www.example.com

    • https://example.com
    • http://www.example.com
    • http://example.com
  • Push to CodeCommit Repository on master branch triggers a CodePipeline / CodeBuild run

Used Ressources:

Overview Infrastructure

Requirements:

Domain

To validate the SSL certificate you need to be able to recieve Emails to:

Email-Adress

Module Example Usage:

variable "aws_access_key" {}
variable "aws_secret_key" {}

provider "aws" {
  access_key = "${var.aws_access_key}"
  secret_key = "${var.aws_secret_key}"
  region = "eu-central-1"
}

provider "aws" {
  access_key = "${var.aws_access_key}"
  secret_key = "${var.aws_secret_key}"
  region = "us-east-1"
  alias = "us-east-1"
}

module "hugo-site" {
  source = "dannylinden/website-serverless/aws"
  www_domain   = "www.example.com" /* Your domain here */
  root_domain = "example.com" /* Your root domain here */
  ssl-validation = "EMAIL" /* How to validate */
  ssh_pub_key = "~/.ssh/id_rsa.pub" /* Path to the SSH Pub key for CodeCommit authentification */
  bucket_prefix = "" /* Prefix for S3 Buckets */
}

output "nameservers" {
  value = "${module.hugo-site.nameservers}"
}

output "git_remote_url" {
  value = "${module.hugo-site.git_remote_url}"
}

Output

The Output if the Module contains:

  • Git remote URL of the Repository to push the website code
  • Nameserver for the Domain

Authors

Module managed by Danny Linden.

License

MIT License. See LICENSE for full details.

About

Infrastructure for Hugo bases static websites with AWS CDN, Route53, S3, CodePipeline, CodeBuild

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HCL 100.0%