diff --git a/LICENSE b/LICENSE index 6b9d898e..8dada3ed 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2017 Cloud Posse, LLC + Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index a6c9ea91..7087878a 100644 --- a/README.md +++ b/README.md @@ -1,34 +1 @@ -# tf_subnets - -## Module Usage - -### Argument Reference - -Note: this module is intended for use with existing VPC and existing -Internet Gateway. -You should use [tf_vpc](https://github.com/cloudposse/tf_vpc) module if -you plan to use new (separate) VPC. - -* `availability_zones`: (Required) List of AZ. -* `name`: (Required) Name of these resources -* `region`: (Required) AWS region. Used to find remote state. -* `stage`: (Required) Stage associated with these resources -* `namespace`: (Required) Namespace associated with these resources -* `vpc_id`: (Required) AWS Virtual Private Cloud ID. -* `igw_id`: (Required) AWS Internet Gateway for public subnets. Only one igw can be attached to a VPC. -* `vpc_default_route_table_id`: A default route table for public subnets. Provides access to Internet. If not set here - will be created. - -``` -module "tf_subnets" { - source = "git::https://github.com/cloudposse/tf_subnets.git?ref=master" - - availability_zones = "${var.availability_zones}" - namespace = "${var.namespace}" - name = "${var.name}" - stage = "${var.stage}" - region = "${var.region}" - vpc_id = "${var.vpc_id}" - igw_id = "${var.igw_id}" - vpc_default_route_table_id = "${var.vpc_default_route_table_id}" -} -``` +# tf_subnets \ No newline at end of file diff --git a/gws.tf b/gws.tf deleted file mode 100644 index a972c071..00000000 --- a/gws.tf +++ /dev/null @@ -1,18 +0,0 @@ -resource "aws_eip" "default" { - count = "${length(var.availability_zones)}" - vpc = true - - lifecycle { - create_before_destroy = true - } -} - -resource "aws_nat_gateway" "default" { - count = "${length(var.availability_zones)}" - allocation_id = "${element(aws_eip.default.*.id, count.index)}" - subnet_id = "${element(aws_subnet.private.*.id, count.index)}" - - lifecycle { - create_before_destroy = true - } -} diff --git a/main.tf b/main.tf deleted file mode 100644 index a73699ca..00000000 --- a/main.tf +++ /dev/null @@ -1,24 +0,0 @@ -terraform { - required_version = "~> 0.9.1" -} - -provider "aws" { - region = "${var.region}" -} - -module "tf_label" { - source = "git::https://github.com/cloudposse/tf_label.git?ref=tags/0.1.0" - namespace = "${var.namespace}" - stage = "${var.stage}" - name = "${var.name}" -} - -# Get object aws_vpc by vpc_id -data "aws_vpc" "default" { - id = "${var.vpc_id}" -} - -# Get all subnets from the necessary vpc -data "aws_subnet_ids" "all" { - vpc_id = "${data.aws_vpc.default.id}" -} diff --git a/private.tf b/private.tf deleted file mode 100644 index 0f1d3b3b..00000000 --- a/private.tf +++ /dev/null @@ -1,27 +0,0 @@ -resource "aws_subnet" "private" { - count = "${length(var.availability_zones)}" - - vpc_id = "${data.aws_vpc.default.id}" - availability_zone = "${element(var.availability_zones, count.index)}" - cidr_block = "${cidrsubnet(data.aws_vpc.default.cidr_block, length(var.availability_zones), length(var.availability_zones) + count.index)}" - tags = "${module.tf_label.tags}" -} - -resource "aws_route_table" "private" { - count = "${length(var.availability_zones)}" - vpc_id = "${data.aws_vpc.default.id}" - - route { - cidr_block = "0.0.0.0/0" - nat_gateway_id = "${element(aws_nat_gateway.default.*.id, count.index)}" - } - - tags = "${module.tf_label.tags}" -} - -resource "aws_route_table_association" "private" { - count = "${length(var.availability_zones)}" - - subnet_id = "${element(aws_subnet.private.*.id, count.index)}" - route_table_id = "${element(aws_route_table.private.*.id, count.index)}" -} diff --git a/public.tf b/public.tf deleted file mode 100644 index bbe3400d..00000000 --- a/public.tf +++ /dev/null @@ -1,32 +0,0 @@ -resource "aws_subnet" "public" { - count = "${length(var.availability_zones)}" - - vpc_id = "${data.aws_vpc.default.id}" - availability_zone = "${element(var.availability_zones, count.index)}" - cidr_block = "${cidrsubnet(data.aws_vpc.default.cidr_block, length(var.availability_zones), count.index)}" - - tags = "${module.tf_label.tags}" -} - -resource "aws_route_table" "public" { - count = "${signum(length(var.vpc_default_route_table_id)) == 1 ? 0 : 1}" - vpc_id = "${data.aws_vpc.default.id}" - - route { - cidr_block = "0.0.0.0/0" - gateway_id = "${var.igw_id}" - } - tags = "${module.tf_label.tags}" -} - -resource "aws_route_table_association" "public" { - count = "${signum(length(var.vpc_default_route_table_id)) == 1 ? 0 : length(var.availability_zones)}" - subnet_id = "${element(aws_subnet.public.*.id, count.index)}" - route_table_id = "${aws_route_table.public.id}" -} - -resource "aws_route_table_association" "public_default" { - count = "${signum(length(var.vpc_default_route_table_id)) == 1 ? length(var.availability_zones) : 0}" - subnet_id = "${element(aws_subnet.public.*.id, count.index)}" - route_table_id = "${var.vpc_default_route_table_id}" -} \ No newline at end of file diff --git a/variables.tf b/variables.tf deleted file mode 100644 index 9910875f..00000000 --- a/variables.tf +++ /dev/null @@ -1,31 +0,0 @@ -variable "region" { - default = "" -} - -variable "namespace" { - default = "" -} - -variable "stage" { - default = "" -} - -variable "name" { - default = "" -} - -variable "vpc_id" { - default = "" -} - -variable "availability_zones" { - type = "list" -} - -variable "igw_id" { - default = "" -} - -variable "vpc_default_route_table_id" { - default = "" -}