Skip to content

Commit

Permalink
Utilize tf_subnets (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
SweetOps authored and const-bon committed Aug 31, 2017
1 parent 7775ce2 commit e1ad928
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 106 deletions.
13 changes: 12 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,20 @@ module "label" {
stage = "${var.stage}"
}

module "subnets" {
source = "git::https://github.com/cloudposse/tf_subnets.git?ref=tags/0.1.6"

availability_zones = "${var.availability_zones}"
namespace = "${var.namespace}"
name = "${var.name}"
stage = "${var.stage}"
region = "${var.region}"
vpc_id = "${aws_vpc.default.id}"
cidr_block = "${aws_vpc.default.cidr_block}"
}

resource "aws_vpc" "default" {
cidr_block = "${var.cidr}"
cidr_block = "${var.cidr_block}"
enable_dns_hostnames = true

tags {
Expand Down
8 changes: 4 additions & 4 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ output "vpc_id" {
value = "${aws_vpc.default.id}"
}

output "public_subnets" {
value = ["${aws_subnet.public.*.id}"]
output "public_subnet_ids" {
value = ["${module.subnets.public_subnet_ids}"]
}

output "private_subnets" {
value = ["${aws_subnet.private.*.id}"]
output "private_subnet_ids" {
value = ["${module.subnets.private_subnet_ids}"]
}
39 changes: 0 additions & 39 deletions private.tf

This file was deleted.

58 changes: 0 additions & 58 deletions public.tf

This file was deleted.

12 changes: 8 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
variable "namespace" {
default = "global"
default = ""
}

variable "stage" {
default = "default"
default = ""
}

variable "name" {
default = "vpc"
default = ""
}

variable "availability_zones" {
description = "Run the EC2 Instances in these Availability Zones"
type = "list"
}

variable "cidr" {
variable "cidr_block" {
description = "CIDR for the whole VPC"
default = "10.0.0.0/16"
}

variable "region" {
default = ""
}

0 comments on commit e1ad928

Please sign in to comment.