Skip to content

Commit

Permalink
addded outputs and updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
brylex418 committed Apr 5, 2021
1 parent acd87a9 commit 0dd4a4d
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 2 deletions.
54 changes: 54 additions & 0 deletions examples/outpost-subnets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# VPC with Outpost Subnet

Configuration in this directory creates a vpc with public / private / and a private outpost subnet.

This configuration uses Availability Zone IDs and Availability Zone names for demonstration purposes. Normally, you need to specify only names or IDs.

[Read more about AWS regions, availability zones and local zones](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-regions-availability-zones).

## Usage

To run this example you need to execute:

```bash
$ terraform init
$ terraform plan
$ terraform apply
```

Note that this example may create resources which can cost money (AWS Elastic IP, for example). Run `terraform destroy` when you don't need these resources.

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| terraform | >= 0.13.0 |
| aws | >= 3.0 |

## Providers

No provider.

## Inputs

| Name | Description |
|------|-------------|
| outpost_arn | The ARN of the outpost where you would like subnet deployed |
| outpost_az | AZ where outpost is anchored|

Note - without these input variables the subnet(s) will still create however they will be homed to the region not the outpost.

## Outputs

| Name | Description |
|------|-------------|
| azs | A list of availability zones spefified as argument to this module |
| nat\_public\_ips | List of public Elastic IPs created for AWS NAT Gateway |
| private\_subnets | List of IDs of private subnets |
| public\_subnets | List of IDs of public subnets |
| outpost\_subnets | List of IDs of the outpost subnets |
| vpc\_cidr\_block | The CIDR block of the VPC |
| vpc\_id | The ID of the VPC |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
5 changes: 3 additions & 2 deletions examples/outpost-subnets/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ provider "aws" {
}

module "vpc" {
source = "../terraform-aws-vpc"
source = "../../../terraform-aws-vpc"

name = "outpost-example"

Expand All @@ -12,9 +12,10 @@ module "vpc" {
azs = ["us-west-2a", "us-west-2b", "us-west-2c"]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]
outpost_subnets = ["10.0.50.0/24"]
outpost_subnets = ["10.0.50.0/24", "10.0.51.0/24"]
create_outpost_subnet = true
outpost_arn = "arn:aws:outposts:us-west-2:116668991109:outpost/op-0a8c1ab53b023a5a4"
outpost_az = "us-west-2a"

enable_ipv6 = true

Expand Down
38 changes: 38 additions & 0 deletions examples/outpost-subnets/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# VPC
output "vpc_id" {
description = "The ID of the VPC"
value = module.vpc.vpc_id
}

# CIDR blocks
output "vpc_cidr_block" {
description = "The CIDR block of the VPC"
value = module.vpc.vpc_cidr_block
}

# Subnets
output "private_subnets" {
description = "List of IDs of private subnets"
value = module.vpc.private_subnets
}

output "public_subnets" {
description = "List of IDs of public subnets"
value = module.vpc.public_subnets
}
# NAT gateways
output "nat_public_ips" {
description = "List of public Elastic IPs created for AWS NAT Gateway"
value = module.vpc.nat_public_ips
}

# AZs
output "azs" {
description = "A list of availability zones spefified as argument to this module"
value = module.vpc.azs
}

output "outpost_subnets" {
description = "List of IDs of private subnets"
value = module.vpc.outpost_subnets
}
Empty file.
7 changes: 7 additions & 0 deletions examples/outpost-subnets/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
terraform {
required_version = ">= 0.12.21"

required_providers {
aws = ">= 3.0"
}
}
5 changes: 5 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ output "public_subnets" {
value = aws_subnet.public.*.id
}

output "outpost_subnets" {
description = "List of IDs of outpost subnets"
value = aws_subnet.outpost.*.id
}

output "public_subnet_arns" {
description = "List of ARNs of public subnets"
value = aws_subnet.public.*.arn
Expand Down

0 comments on commit 0dd4a4d

Please sign in to comment.