This repository has been archived by the owner on Jul 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tyler Kellen
committed
Mar 6, 2017
0 parents
commit 65ad192
Showing
11 changed files
with
831 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.terraform | ||
*.tfstate.backup |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Bocoup Foundation Inc | ||
> our infrastructure, as code | ||
## Setup | ||
1. Install [AWSCLI] & [Terraform] | ||
2. Log into AWS EC2 console, create a key pair titled "default". | ||
Download the key and add to your ssh-agent: `ssh-add /path/to/key.pem` | ||
3. Ensure `~/.aws/credentials` has a profile with administrative | ||
access keys that match `name` in `terraform.tfvars` | ||
4. Provision your infrastructure: `terraform apply` | ||
|
||
[AWSCLI]: http://docs.aws.amazon.com/cli/latest/userguide/installing.html | ||
[Terraform]: https://www.terraform.io/downloads.html |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
variable "name" { } | ||
variable "domain" { } | ||
variable "aws_region" { } | ||
variable "vpc_cidr" { } | ||
variable "azs" { type = "list" } | ||
variable "key_name" { } | ||
variable "subnet_cidrs" { type = "list" } | ||
|
||
## | ||
# Provide credentials for AWS from ~/.aws/credentials | ||
# with the correct profile name. | ||
# | ||
provider "aws" { | ||
profile = "${var.name}" | ||
region = "${var.aws_region}" | ||
} | ||
|
||
## | ||
# AMI for Ubuntu 16 | ||
# | ||
data "aws_ami" "ubuntu" { | ||
most_recent = true | ||
filter { | ||
name = "name" | ||
values = ["ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20170303"] | ||
} | ||
filter { | ||
name = "virtualization-type" | ||
values = ["hvm"] | ||
} | ||
# Canonical | ||
owners = ["099720109477"] | ||
} | ||
|
||
## | ||
# Network for our entire infrastructure. | ||
# | ||
module "vpc" { | ||
source = "./terraform/modules/aws/vpc" | ||
name = "${var.name}" | ||
cidr = "${var.vpc_cidr}" | ||
} | ||
|
||
## | ||
# Subnets within our network. | ||
# | ||
module "subnet" { | ||
source = "./terraform/modules/aws/subnet" | ||
name = "${var.name}-public" | ||
azs = "${var.azs}" | ||
vpc_id = "${module.vpc.id}" | ||
cidrs = "${var.subnet_cidrs}" | ||
} | ||
|
||
## | ||
# DNS zone for primary domain. | ||
# | ||
resource "aws_route53_zone" "main" { | ||
name = "${var.domain}" | ||
lifecycle { | ||
prevent_destroy = true | ||
} | ||
} | ||
|
||
## | ||
# All Bocoup Foundation Inc webites. | ||
# | ||
module "websites" { | ||
source = "./terraform/websites" | ||
domain = "${var.domain}" | ||
domain_zone_id = "${aws_route53_zone.main.id}" | ||
} | ||
|
||
## | ||
# All Bocoup Foundation Inc services. | ||
# | ||
module "services" { | ||
source = "./terraform/services" | ||
domain = "${var.domain}" | ||
domain_zone_id = "${aws_route53_zone.main.id}" | ||
} |
Oops, something went wrong.