Skip to content

Instantly share code, notes, and snippets.

View li0nel's full-sized avatar

Lionel Martin li0nel

View GitHub Profile
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)
variable "stack_name" {
type = "string"
}
variable "aws_region" {
type = "string"
}
variable "aws_profile" {
type = "string"
aws_profile = "default"
aws_region = "eu-west-2"
stack_name = "myapp"
domain_name = "laravelaws.com"
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}"
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"
@li0nel
li0nel / master.tf
Created April 10, 2018 11:23
terraform S3 backend
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"
}
}
@li0nel
li0nel / docker-compose.yml
Created April 10, 2018 10:13
Docker Compose
version: '2'
networks:
network:
driver: bridge
services:
app:
build:
context: .
@li0nel
li0nel / vpc.tf
Created April 10, 2018 09:11
The beauty of Terraform
# "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)}"
}
@li0nel
li0nel / terraform.tfvars
Last active April 10, 2018 08:09
terraform.tfvars
# 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
@li0nel
li0nel / Dockerfile-nginx
Created March 6, 2018 11:41
Nginx Dockerfile with SSL
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