diff --git a/README.md b/README.md index e1cce44..19ce671 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ Terraform Modules from [this package](https://github.com/tedilabs/terraform-aws- ### VPC Peering +- [vpc-peering-simple](./examples/vpc-peering-simple) - [vpc-peering-cross-region](./examples/vpc-peering-cross-region) - [vpc-peering-requester-and-accepter-cross-region](./examples/vpc-peering-requester-and-accepter-cross-region) diff --git a/examples/vpc-peering-simple/main.tf b/examples/vpc-peering-simple/main.tf new file mode 100644 index 0000000..ed50f29 --- /dev/null +++ b/examples/vpc-peering-simple/main.tf @@ -0,0 +1,66 @@ +provider "aws" { + region = "us-east-1" +} + +resource "aws_vpc" "one" { + cidr_block = "10.1.0.0/16" + + enable_dns_hostnames = true + enable_dns_support = true + + tags = { + "Name" = "one" + } +} + +resource "aws_vpc" "two" { + cidr_block = "10.2.0.0/16" + + enable_dns_hostnames = true + enable_dns_support = true + + tags = { + "Name" = "two" + } +} + + +################################################### +# VPC Peering +################################################### + +module "peering" { + source = "../../modules/vpc-peering" + # source = "tedilabs/vpc-connectivity/aws//modules/vpc-peering" + # version = "~> 0.2.0" + + providers = { + aws.requester = aws + aws.accepter = aws + } + + name = "one/two" + + + ## Requester + requester_vpc = { + id = aws_vpc.one.id + } + requester_options = { + allow_remote_vpc_dns_resolution = true + } + + + ## Acccepter + accepter_vpc = { + id = aws_vpc.two.id + } + accepter_options = { + allow_remote_vpc_dns_resolution = true + } + + + tags = { + "project" = "terraform-aws-vpc-connectivity-examples" + } +} diff --git a/examples/vpc-peering-simple/outputs.tf b/examples/vpc-peering-simple/outputs.tf new file mode 100644 index 0000000..571b502 --- /dev/null +++ b/examples/vpc-peering-simple/outputs.tf @@ -0,0 +1,4 @@ +output "peering" { + description = "The VPC Peering Connection." + value = module.peering +} diff --git a/examples/vpc-peering-simple/versions.tf b/examples/vpc-peering-simple/versions.tf new file mode 100644 index 0000000..e5cd366 --- /dev/null +++ b/examples/vpc-peering-simple/versions.tf @@ -0,0 +1,10 @@ +terraform { + required_version = "~> 1.6" + + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 5.0" + } + } +}