Skip to content
This repository was archived by the owner on Nov 17, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
406db94
document ecs_instance_ebs_optimize input var
tomdavidson Jul 22, 2016
7bdb4ae
Merge pull request #36 from tomdavidson/patch-1
achille-roussel Jul 22, 2016
5572b3b
[hot fix] update description
Jul 22, 2016
3ce318f
Refactor to support Terraform 0.7
likwid Aug 9, 2016
b8744f4
Update terraform version to 0.7.0
likwid Aug 9, 2016
36856c6
vpc: add rtb outputs
calvinfo Sep 14, 2016
bf0ea36
docs: updating
calvinfo Sep 14, 2016
f555181
Merge pull request #44 from segmentio/add-rtb-outputs
Sep 14, 2016
27f87fc
adding all route tables
calvinfo Sep 14, 2016
4f68487
Merge branch 'master' of ssh://github.com/segmentio/stack
calvinfo Sep 14, 2016
c421134
vpc: split routes
calvinfo Sep 14, 2016
dda722c
Merge pull request #45 from segmentio/split-routes
Sep 15, 2016
6d343be
use pip3 instead of pip in Makefile
rakeshnair Sep 26, 2016
b338f56
Merge pull request #47 from segmentio/pip3
rakeshnair Sep 26, 2016
e59fc4e
expose route table ids to root stack module
Oct 1, 2016
59a275d
updating docs with route tables outputs
Oct 3, 2016
e602fc3
fixed description for external ELB security group
filiptepper Oct 4, 2016
b411232
Merge pull request #52 from filiptepper/patch-1
achille-roussel Oct 5, 2016
3d3ced9
use plural for consistency
Oct 5, 2016
84fcba8
Merge pull request #51 from BuildDirect/expose-route-tables
achille-roussel Oct 5, 2016
3c0c47d
Merge pull request #40 from likwid/refactor/terraform07
yields Oct 9, 2016
60509da
ecs-cluster,s3-logs: use data sources
yields Oct 9, 2016
ca1663a
ecs-cluster,s3-logs: typo
yields Oct 9, 2016
1c68f62
vpc: fix string -> list
yields Oct 9, 2016
2bcbf45
ecs-cluster: remove redundant lifecycle from template_file
yields Oct 9, 2016
3144449
rds-cluster: use lists
yields Oct 9, 2016
392f44c
circle: use terraform v0.7.5
yields Oct 9, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ endif

ifeq (${platform},Darwin)
install-python-dependencies:
sudo -H pip install --upgrade ${pydeps}
sudo -H pip3 install --upgrade ${pydeps}
else
install-python-dependencies:
pip install --upgrade pyyaml boto3
pip3 install --upgrade pyyaml boto3
endif

install-tools: $(tools)
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

dependencies:
override:
- sudo curl -L# https://releases.hashicorp.com/terraform/0.6.16/terraform_0.6.16_linux_amd64.zip -o /usr/local/bin/tf.zip
- sudo curl -L# https://releases.hashicorp.com/terraform/0.7.5/terraform_0.7.5_linux_amd64.zip -o /usr/local/bin/tf.zip
- cd /usr/local/bin && sudo unzip tf.zip

test:
Expand Down
6 changes: 5 additions & 1 deletion docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
| external_subnets | a comma-separated list of CIDRs for external subnets in your VPC, must be set if the cidr variable is defined, needs to have as many elements as there are availability zones | `"10.30.32.0/20,10.30.96.0/20,10.30.160.0/20"` | no |
| availability_zones | a comma-separated list of availability zones, defaults to all AZ of the region, if set to something other than the defaults, both internal_subnets and external_subnets have to be defined as well | `"us-west-2a,us-west-2b,us-west-2c"` | no |
| ecs_instance_type | the instance type to use for your default ecs cluster | `"m4.large"` | no |
| ecs_instance_ebs_optimized | use EBS - not all instance types support EBS | `"true"` | no |
| ecs_min_size | the minimum number of instances to use in the default ecs cluster | `3` | no |
| ecs_max_size | the maximum number of instances to use in the default ecs cluster | `100` | no |
| ecs_desired_capacity | the desired number of instances to use in the default ecs cluster | `3` | no |
Expand All @@ -51,6 +52,8 @@
| external_elb | Security group for external ELBs. |
| internal_subnets | Comma separated list of internal subnet IDs. |
| external_subnets | Comma separated list of external subnet IDs. |
| internal_route_tables | Comma separated list of internal route table IDs. |
| external_route_tables | The external route table ID. |
| iam_role | ECS Service IAM role. |
| log_bucket_id | S3 bucket ID for ELB logs. |
| domain_name | The internal domain name, e.g "stack.local". |
Expand Down Expand Up @@ -484,6 +487,8 @@
| internal_subnets | A comma-separated list of subnet IDs. |
| security_group | The default VPC security group ID. |
| availability_zones | The list of availability zones of the VPC. |
| internal_rtb_id | The internal route table ID. |
| external_rtb_id | The external route table ID. |

# web-service

Expand Down Expand Up @@ -569,4 +574,3 @@
| desired_count | The desired count | `1` | no |
| memory | The number of MiB of memory to reserve for the container | `512` | no |
| cpu | The number of cpu units to reserve for the container | `512` | no |

22 changes: 10 additions & 12 deletions ecs-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* name = "cdn"
* vpc_id = "vpc-id"
* image_id = "ami-id"
* subnet_ids = "1,2"
* subnet_ids = ["1" ,"2"]
* key_name = "ssh-key"
* security_groups = "1,2"
* iam_instance_profile = "id"
* region = "us-west-2"
* availability_zones = "a,b"
* availability_zones = ["a", "b"]
* instance_type = "t2.small"
* }
*
Expand All @@ -42,7 +42,8 @@ variable "image_id" {
}

variable "subnet_ids" {
description = "Comma separated list of subnet IDs"
description = "List of subnet IDs"
type = "list"
}

variable "key_name" {
Expand All @@ -62,7 +63,8 @@ variable "region" {
}

variable "availability_zones" {
description = "Comma separated list of AZs"
description = "List of AZs"
type = "list"
}

variable "instance_type" {
Expand Down Expand Up @@ -151,7 +153,7 @@ resource "aws_ecs_cluster" "main" {
}
}

resource "template_file" "cloud_config" {
data "template_file" "cloud_config" {
template = "${file("${path.module}/files/cloud-config.yml.tpl")}"

vars {
Expand All @@ -161,10 +163,6 @@ resource "template_file" "cloud_config" {
docker_auth_type = "${var.docker_auth_type}"
docker_auth_data = "${var.docker_auth_data}"
}

lifecycle {
create_before_destroy = true
}
}

resource "aws_launch_configuration" "main" {
Expand All @@ -176,7 +174,7 @@ resource "aws_launch_configuration" "main" {
iam_instance_profile = "${var.iam_instance_profile}"
key_name = "${var.key_name}"
security_groups = ["${aws_security_group.cluster.id}"]
user_data = "${template_file.cloud_config.rendered}"
user_data = "${data.template_file.cloud_config.rendered}"
associate_public_ip_address = "${var.associate_public_ip_address}"

# root
Expand All @@ -200,8 +198,8 @@ resource "aws_launch_configuration" "main" {
resource "aws_autoscaling_group" "main" {
name = "${var.name}"

availability_zones = ["${split(",", var.availability_zones)}"]
vpc_zone_identifier = ["${split(",", var.subnet_ids)}"]
availability_zones = ["${var.availability_zones}"]
vpc_zone_identifier = ["${var.subnet_ids}"]
launch_configuration = "${aws_launch_configuration.main.id}"
min_size = "${var.min_size}"
max_size = "${var.max_size}"
Expand Down
24 changes: 17 additions & 7 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ variable "cidr" {
}

variable "internal_subnets" {
description = "a comma-separated list of CIDRs for internal subnets in your VPC, must be set if the cidr variable is defined, needs to have as many elements as there are availability zones"
default = "10.30.0.0/19,10.30.64.0/19,10.30.128.0/19"
description = "a list of CIDRs for internal subnets in your VPC, must be set if the cidr variable is defined, needs to have as many elements as there are availability zones"
default = ["10.30.0.0/19" ,"10.30.64.0/19", "10.30.128.0/19"]
}

variable "external_subnets" {
description = "a comma-separated list of CIDRs for external subnets in your VPC, must be set if the cidr variable is defined, needs to have as many elements as there are availability zones"
default = "10.30.32.0/20,10.30.96.0/20,10.30.160.0/20"
description = "a list of CIDRs for external subnets in your VPC, must be set if the cidr variable is defined, needs to have as many elements as there are availability zones"
default = ["10.30.32.0/20", "10.30.96.0/20", "10.30.160.0/20"]
}

variable "availability_zones" {
description = "a comma-separated list of availability zones, defaults to all AZ of the region, if set to something other than the defaults, both internal_subnets and external_subnets have to be defined as well"
default = "us-west-2a,us-west-2b,us-west-2c"
default = ["us-west-2a", "us-west-2b", "us-west-2c"]
}

variable "bastion_instance_type" {
Expand All @@ -76,7 +76,7 @@ variable "ecs_instance_type" {
}

variable "ecs_instance_ebs_optimized" {
description = "ebs optimize or not cluster instances"
description = "use EBS - not all instance types support EBS"
default = true
}

Expand Down Expand Up @@ -159,7 +159,7 @@ module "bastion" {
instance_type = "${var.bastion_instance_type}"
security_groups = "${module.security_groups.external_ssh},${module.security_groups.internal_ssh}"
vpc_id = "${module.vpc.id}"
subnet_id = "${element(split(",",module.vpc.external_subnets), 0)}"
subnet_id = "${element(module.vpc.external_subnets, 0)}"
key_name = "${var.key_name}"
environment = "${var.environment}"
}
Expand Down Expand Up @@ -292,3 +292,13 @@ output "vpc_id" {
output "ecs_cluster_security_group_id" {
value = "${module.ecs_cluster.security_group_id}"
}

// Comma separated list of internal route table IDs.
output "internal_route_tables" {
value = "${module.vpc.internal_rtb_id}"
}

// The external route table ID.
output "external_route_tables" {
value = "${module.vpc.external_rtb_id}"
}
15 changes: 9 additions & 6 deletions rds-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ variable "zone_id" {
}

variable "security_groups" {
description = "A comma-separated list of security group IDs"
description = "A list of security group IDs"
type = "list"
}

variable "subnet_ids" {
description = "A comma-separated list of subnet IDs"
description = "A list of subnet IDs"
type = "list"
}

variable "availability_zones" {
description = "A comma-separated list of availability zones"
description = "A list of availability zones"
type = "list"
}

variable "database_name" {
Expand Down Expand Up @@ -82,7 +85,7 @@ resource "aws_security_group" "main" {
from_port = "${var.port}"
to_port = "${var.port}"
protocol = "TCP"
security_groups = ["${split(",", var.security_groups)}"]
security_groups = ["${var.security_groups}"]
}

egress {
Expand All @@ -101,7 +104,7 @@ resource "aws_security_group" "main" {
resource "aws_db_subnet_group" "main" {
name = "${var.name}"
description = "RDS cluster subnet group"
subnet_ids = ["${split(",", var.subnet_ids)}"]
subnet_ids = ["${var.subnet_ids}"]
}

resource "aws_rds_cluster_instance" "cluster_instances" {
Expand All @@ -114,7 +117,7 @@ resource "aws_rds_cluster_instance" "cluster_instances" {

resource "aws_rds_cluster" "main" {
cluster_identifier = "${var.name}"
availability_zones = ["${split(",", var.availability_zones)}"]
availability_zones = ["${var.availability_zones}"]
database_name = "${var.database_name}"
master_username = "${var.master_username}"
master_password = "${var.master_password}"
Expand Down
4 changes: 2 additions & 2 deletions s3-logs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ variable "environment" {
variable "account_id" {
}

resource "template_file" "policy" {
data "template_file" "policy" {
template = "${file("${path.module}/policy.json")}"

vars = {
Expand All @@ -24,7 +24,7 @@ resource "aws_s3_bucket" "logs" {
Environment = "${var.environment}"
}

policy = "${template_file.policy.rendered}"
policy = "${data.template_file.policy.rendered}"
}

output "id" {
Expand Down
2 changes: 1 addition & 1 deletion security-groups/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ resource "aws_security_group" "internal_elb" {
resource "aws_security_group" "external_elb" {
name = "${format("%s-%s-external-elb", var.name, var.environment)}"
vpc_id = "${var.vpc_id}"
description = "Allows internal ELB traffic"
description = "Allows external ELB traffic"

ingress {
from_port = 80
Expand Down
Loading