Skip to content

Commit

Permalink
Add vpc-peering-simple example
Browse files Browse the repository at this point in the history
  • Loading branch information
posquit0 committed Dec 2, 2023
1 parent 7e089cf commit 3260929
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
66 changes: 66 additions & 0 deletions examples/vpc-peering-simple/main.tf
Original file line number Diff line number Diff line change
@@ -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"
}
}
4 changes: 4 additions & 0 deletions examples/vpc-peering-simple/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "peering" {
description = "The VPC Peering Connection."
value = module.peering
}
10 changes: 10 additions & 0 deletions examples/vpc-peering-simple/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
terraform {
required_version = "~> 1.6"

required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}

0 comments on commit 3260929

Please sign in to comment.