diff --git a/examples/outpost-subnets/README.md b/examples/outpost-subnets/README.md new file mode 100644 index 000000000..f7920e948 --- /dev/null +++ b/examples/outpost-subnets/README.md @@ -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. + + +## 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 | + + diff --git a/examples/outpost-subnets/main.tf b/examples/outpost-subnets/main.tf index cf13fdf4e..49301d272 100644 --- a/examples/outpost-subnets/main.tf +++ b/examples/outpost-subnets/main.tf @@ -3,7 +3,7 @@ provider "aws" { } module "vpc" { - source = "../terraform-aws-vpc" + source = "../../../terraform-aws-vpc" name = "outpost-example" @@ -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 diff --git a/examples/outpost-subnets/outputs.tf b/examples/outpost-subnets/outputs.tf new file mode 100644 index 000000000..79ea42744 --- /dev/null +++ b/examples/outpost-subnets/outputs.tf @@ -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 +} diff --git a/examples/outpost-subnets/variables.tf b/examples/outpost-subnets/variables.tf new file mode 100644 index 000000000..e69de29bb diff --git a/examples/outpost-subnets/versions.tf b/examples/outpost-subnets/versions.tf new file mode 100644 index 000000000..c82e21055 --- /dev/null +++ b/examples/outpost-subnets/versions.tf @@ -0,0 +1,7 @@ +terraform { + required_version = ">= 0.12.21" + + required_providers { + aws = ">= 3.0" + } +} diff --git a/outputs.tf b/outputs.tf index 16a9a6cad..687b10ea0 100644 --- a/outputs.tf +++ b/outputs.tf @@ -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