Skip to content

Commit 0dd4a4d

Browse files
committed
addded outputs and updated readme
1 parent acd87a9 commit 0dd4a4d

File tree

6 files changed

+107
-2
lines changed

6 files changed

+107
-2
lines changed

examples/outpost-subnets/README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# VPC with Outpost Subnet
2+
3+
Configuration in this directory creates a vpc with public / private / and a private outpost subnet.
4+
5+
This configuration uses Availability Zone IDs and Availability Zone names for demonstration purposes. Normally, you need to specify only names or IDs.
6+
7+
[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).
8+
9+
## Usage
10+
11+
To run this example you need to execute:
12+
13+
```bash
14+
$ terraform init
15+
$ terraform plan
16+
$ terraform apply
17+
```
18+
19+
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.
20+
21+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
22+
## Requirements
23+
24+
| Name | Version |
25+
|------|---------|
26+
| terraform | >= 0.13.0 |
27+
| aws | >= 3.0 |
28+
29+
## Providers
30+
31+
No provider.
32+
33+
## Inputs
34+
35+
| Name | Description |
36+
|------|-------------|
37+
| outpost_arn | The ARN of the outpost where you would like subnet deployed |
38+
| outpost_az | AZ where outpost is anchored|
39+
40+
Note - without these input variables the subnet(s) will still create however they will be homed to the region not the outpost.
41+
42+
## Outputs
43+
44+
| Name | Description |
45+
|------|-------------|
46+
| azs | A list of availability zones spefified as argument to this module |
47+
| nat\_public\_ips | List of public Elastic IPs created for AWS NAT Gateway |
48+
| private\_subnets | List of IDs of private subnets |
49+
| public\_subnets | List of IDs of public subnets |
50+
| outpost\_subnets | List of IDs of the outpost subnets |
51+
| vpc\_cidr\_block | The CIDR block of the VPC |
52+
| vpc\_id | The ID of the VPC |
53+
54+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/outpost-subnets/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ provider "aws" {
33
}
44

55
module "vpc" {
6-
source = "../terraform-aws-vpc"
6+
source = "../../../terraform-aws-vpc"
77

88
name = "outpost-example"
99

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

1920
enable_ipv6 = true
2021

examples/outpost-subnets/outputs.tf

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# VPC
2+
output "vpc_id" {
3+
description = "The ID of the VPC"
4+
value = module.vpc.vpc_id
5+
}
6+
7+
# CIDR blocks
8+
output "vpc_cidr_block" {
9+
description = "The CIDR block of the VPC"
10+
value = module.vpc.vpc_cidr_block
11+
}
12+
13+
# Subnets
14+
output "private_subnets" {
15+
description = "List of IDs of private subnets"
16+
value = module.vpc.private_subnets
17+
}
18+
19+
output "public_subnets" {
20+
description = "List of IDs of public subnets"
21+
value = module.vpc.public_subnets
22+
}
23+
# NAT gateways
24+
output "nat_public_ips" {
25+
description = "List of public Elastic IPs created for AWS NAT Gateway"
26+
value = module.vpc.nat_public_ips
27+
}
28+
29+
# AZs
30+
output "azs" {
31+
description = "A list of availability zones spefified as argument to this module"
32+
value = module.vpc.azs
33+
}
34+
35+
output "outpost_subnets" {
36+
description = "List of IDs of private subnets"
37+
value = module.vpc.outpost_subnets
38+
}

examples/outpost-subnets/variables.tf

Whitespace-only changes.

examples/outpost-subnets/versions.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
terraform {
2+
required_version = ">= 0.12.21"
3+
4+
required_providers {
5+
aws = ">= 3.0"
6+
}
7+
}

outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ output "public_subnets" {
9393
value = aws_subnet.public.*.id
9494
}
9595

96+
output "outpost_subnets" {
97+
description = "List of IDs of outpost subnets"
98+
value = aws_subnet.outpost.*.id
99+
}
100+
96101
output "public_subnet_arns" {
97102
description = "List of ARNs of public subnets"
98103
value = aws_subnet.public.*.arn

0 commit comments

Comments
 (0)