This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path') | |
exports.handler = (evt, ctx, cb) => { | |
const {request} = evt.Records[0].cf | |
if (!path.extname(request.uri)) { | |
request.uri = '/index.html' | |
} | |
cb(null, request) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "stack_name" { | |
type = "string" | |
} | |
variable "aws_region" { | |
type = "string" | |
} | |
variable "aws_profile" { | |
type = "string" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws_profile = "default" | |
aws_region = "eu-west-2" | |
stack_name = "myapp" | |
domain_name = "laravelaws.com" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
output "aws_codecommit_repository_url" { | |
value = "${module.single-page-application.aws_codecommit_repository_url}" | |
} | |
output "s3_bucket_website" { | |
value = "${module.single-page-application.s3_bucket_website}" | |
} | |
output "cloudfront_domain_name" { | |
value = "${module.single-page-application.cloudfront_domain_name}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "aws" { | |
region = "${var.aws_region}" | |
profile = "${var.aws_profile}" | |
version = "~> 1.9" | |
} | |
provider "aws" { | |
region = "us-east-1" | |
profile = "${var.aws_profile}" | |
alias = "us-east-1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
terraform { | |
backend "s3" { | |
# Make sure to use your own bucket name here | |
bucket = "laravelaws-tf-state" | |
key = "main.tfstate" | |
region = "eu-west-2" | |
profile = "default" | |
workspace_key_prefix = "workspaces" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
networks: | |
network: | |
driver: bridge | |
services: | |
app: | |
build: | |
context: . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# "data" keyword allow you to pull existing resources from your AWS account | |
# In this case, we pull the list of availability zones from the current AWS region | |
data "aws_availability_zones" "available" {} | |
# Local values assign names to expressions so you can re-use them | |
# multiple times in the current module (here the number of AZs for the current region) | |
locals { | |
nb_azs = "${length(data.aws_availability_zones.available.names)}" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Your AWS CLI profile | |
aws_profile = "default" | |
# The default region for your Terraform infrastructure | |
aws_region = "eu-west-2" | |
# Your project's name | |
stack_name = "laravelaws" | |
# Optional Elastic IPs you want to use |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nginx | |
ADD deploy/nginx/nginx.conf /etc/nginx/ | |
ADD deploy/nginx/default.conf /etc/nginx/conf.d/ | |
ADD public /usr/share/nginx/html | |
ADD deploy/nginx/ssl/ssl.cert /etc/ssl/certs/ssl.cert | |
ADD deploy/nginx/ssl/ssl.key /etc/ssl/private/ssl.key | |
WORKDIR /usr/share/nginx/html |