Skip to content

Commit

Permalink
Add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
anarwal committed Jul 17, 2019
1 parent 59e27d5 commit fc4f863
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 20 deletions.
51 changes: 50 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,50 @@
# networking-module
# networking-module

This module produces following resources:

1. VPC
2. Subnets in multiple AZs
3. Internet Gateway
4. Route Table, Route, Route Table Association

Usage:
```
module "networking_setup" {
source = "../../module/"
namespace = "${var.namespace}"
stage = "${var.stage}"
attributes = "${var.attributes}"
name = "${var.name}"
delimiter = "${var.delimiter}"
cidr = "${var.cidr_block}"
private_subnets = "${var.private_subnets}"
public_subnets = "${var.public_subnets}"
availability_zones = "${var.availability_zones}"
}
```

## INPUT VALUES

| Input | Description | Type | Default | Required |
| ------------------| -------------------------------------------------------------------------------| --------|---------|----------|
| namespace | Namespace, which could be your organization name or abbreviation" |`string` | "" | yes |
| stage | Stage, e.g. 'prod', 'staging', 'dev' |`string` | "" | yes |
| name | Solution name, e.g. 'app' or 'jenkins' |`string` | "" | yes |
| attributes | Additional attributes |`list` | <list> | no |
| delimiter | Delimiter to be used between namespace, environment, stage, name and attributes|`string` | "-" | no |
| public_subnets | List of public subnets (Value needs to be in CIDR Block range) |`list` | <list> | yes |
| private_subnets | List of private subnets (Value needs to be in CIDR Block range) |`list` | <list> | yes |
| availability_zones| List of availability zones |`list` | <list> | yes |
| cidr | CIDR block for the VPC |`string` | "" | yes |

## OUTPUT VALUE NAMES

| Name | Description |
| ------------------------| --------------------------------------------|
| vpc_id | VPC ID |
| vpc_cidr_block | VPC CIDR |
| public_subnets | Comma-separated list of public subnet IDs. |
| private_subnets | Comma-separated list of private subnet IDs. |
| availability_zones | List of availability zones of the VPC. |
| default_db_subnet_group | Default Subnet ID for Database |
| public_rtb_id | Public route table ID. |
34 changes: 34 additions & 0 deletions examples/simple-vpc/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// The VPC ID
output "vpc_id" {
value = "${module.networking_setup.vpc_id}"
}

// The VPC CIDR
output "vpc_cidr_block" {
value = "${module.networking_setup.vpc_cidr_block}"
}

// A comma-separated list of public subnet IDs
output "public_subnets" {
value = ["${module.networking_setup.public_subnets}"]
}

// A comma-separated list of private subnet IDs
output "private_subnets" {
value = ["${module.networking_setup.private_subnets}"]
}

// The list of availability zones of the VPC.
output "availability_zones" {
value = ["${module.networking_setup.availability_zones}"]
}

// Default Subnet ID for Database
output "default_db_subnet_group" {
value = "${module.networking_setup.default_db_subnet_group}"
}

// The public route table ID.
output "public_rtb_id" {
value = "${module.networking_setup.public_rtb_id}"
}
5 changes: 3 additions & 2 deletions module/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ output "vpc_cidr_block" {
value = "${aws_vpc.vpc.cidr_block}"
}

// A comma-separated list of subnet IDs.
// A comma-separated list of public subnet IDs
output "public_subnets" {
value = ["${aws_subnet.public.*.id}"]
}

// A list of subnet IDs.
// A comma-separated list of private subnet IDs
output "private_subnets" {
value = ["${aws_subnet.private.*.id}"]
}
Expand All @@ -23,6 +23,7 @@ output "availability_zones" {
value = ["${aws_subnet.public.*.availability_zone}"]
}

// Default Subnet ID for Database
output "default_db_subnet_group" {
value = "${aws_db_subnet_group.default.id}"
}
Expand Down
19 changes: 2 additions & 17 deletions module/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,6 @@ variable "private_subnets" {
default = []
}

variable "use_nat_instances" {
description = "If true, use EC2 NAT instances instead of the AWS NAT gateway service."
default = false
}

variable "nat_instance_type" {
description = "Only if use_nat_instances is true, which EC2 instance type to use for the NAT instances."
default = "t2.nano"
}

variable "use_eip_with_nat_instances" {
description = "Only if use_nat_instances is true, whether to assign Elastic IPs to the NAT instances. IF this is set to false, NAT instances use dynamically assigned IPs."
default = false
}

variable "name" {
type = string
description = "Name tag, e.g stack"
Expand All @@ -39,7 +24,7 @@ variable "name" {
variable "availability_zones" {
description = "List of availability zones"
type = list
default = [""]
default = []
}

variable "namespace" {
Expand All @@ -57,7 +42,7 @@ variable "stage" {
variable "attributes" {
type = list
description = "Additional attributes (e.g. 1)"
default = [""]
default = []
}

variable "delimiter" {
Expand Down

0 comments on commit fc4f863

Please sign in to comment.