Skip to content

Instantly share code, notes, and snippets.

View jlouns's full-sized avatar

Jonathan Lounsbury jlouns

View GitHub Profile
@jlouns
jlouns / multi-coud-vpn-main.tf
Created January 27, 2020 17:05
Multi-Cloud VPN Main Infrastructure File
module "aws_vpc" {
source = "./aws/vpc"
vpc_name = "aws-test"
cidr_block = "10.0.0.0/16"
subnet_count = 1
}
module "dns" {
source = "./aws/dns"
@jlouns
jlouns / vpn-azure.tf
Created January 27, 2020 16:51
Multi-Cloud VPN Azure VPN Resources
resource "azurerm_subnet" "gateway" {
# azure requires this to be named 'GatewaySubnet'
name = "GatewaySubnet"
resource_group_name = var.azure_resource_group_name
virtual_network_name = var.azure_network_name
address_prefix = var.azure_gateway_cidr
}
resource "azurerm_public_ip" "gateway" {
name = "aws-vpn-gateway-ip"
@jlouns
jlouns / vpn-google.tf
Created January 27, 2020 16:50
Multi-Cloud VPN Google VPN Resources
locals {
google_connection_name = "aws-vpn"
}
data "google_compute_network" "main" {
project = var.google_project_id
name = var.google_network_name
}
data "google_compute_subnetwork" "subnet" {
@jlouns
jlouns / vpn-aws.tf
Created January 27, 2020 16:49
Multi-Cloud VPN AWS VPN Resources
data "aws_vpc" "main" {
id = var.aws_vpc_id
}
resource "aws_vpn_gateway" "main" {
vpc_id = data.aws_vpc.main.id
tags = {
Name = "vpn-gateway"
}
@jlouns
jlouns / azure-vnet-main.tf
Created January 27, 2020 16:48
Multi-Cloud VPN Azure Virtual Network Module
resource "azurerm_virtual_network" "network" {
name = var.network_name
location = var.location
resource_group_name = var.resource_group_name
address_space = [var.cidr_block]
dns_servers = var.dns_servers
}
resource "azurerm_subnet" "private" {
count = var.subnet_count
@jlouns
jlouns / google-network-main.tf
Created January 27, 2020 16:47
Multi-Cloud VPN Google Network Module
resource "google_project_service" "compute" {
project = var.project_id
service = "compute.googleapis.com"
}
resource "google_compute_network" "main" {
project = google_project_service.compute.project
name = var.network_name
routing_mode = "GLOBAL"
@jlouns
jlouns / aws-dns-main.tf
Created January 27, 2020 16:46
Multi-Cloud VPN AWS DNS Module
data "aws_vpc" "main" {
id = var.vpc_id
}
data "aws_availability_zones" "available" {
state = "available"
}
locals {
dns_subnet_availability_zones = slice(data.aws_availability_zones.available.names, 0, 2)
@jlouns
jlouns / aws-vpn-main.tf
Last active January 27, 2020 17:08
Multi-Cloud VPN AWS VPC Module
resource "aws_vpc" "main" {
cidr_block = var.cidr_block
tags = {
Name = var.vpc_name
}
}
resource "aws_subnet" "private" {
count = var.subnet_count
@jlouns
jlouns / providers.tf
Created January 27, 2020 16:43
Multi-Cloud VPN providers file
terraform {
required_providers {
aws = "~> 2.39.0"
google = "~> 2.18.0"
google-beta = "~> 2.18.0"
azurerm = "~> 1.41.0"
}
}
@jlouns
jlouns / postgres_restart.sh
Created April 25, 2019 17:44
Allow homebrew installed postgres to restart after a system malfunction/restart
rm /usr/local/var/postgres/postmaster.pid
brew services restart postgres