Skip to content

Commit 3260929

Browse files
committed
Add vpc-peering-simple example
1 parent 7e089cf commit 3260929

File tree

4 files changed

+81
-0
lines changed

4 files changed

+81
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Terraform Modules from [this package](https://github.com/tedilabs/terraform-aws-
6161

6262
### VPC Peering
6363

64+
- [vpc-peering-simple](./examples/vpc-peering-simple)
6465
- [vpc-peering-cross-region](./examples/vpc-peering-cross-region)
6566
- [vpc-peering-requester-and-accepter-cross-region](./examples/vpc-peering-requester-and-accepter-cross-region)
6667

examples/vpc-peering-simple/main.tf

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
provider "aws" {
2+
region = "us-east-1"
3+
}
4+
5+
resource "aws_vpc" "one" {
6+
cidr_block = "10.1.0.0/16"
7+
8+
enable_dns_hostnames = true
9+
enable_dns_support = true
10+
11+
tags = {
12+
"Name" = "one"
13+
}
14+
}
15+
16+
resource "aws_vpc" "two" {
17+
cidr_block = "10.2.0.0/16"
18+
19+
enable_dns_hostnames = true
20+
enable_dns_support = true
21+
22+
tags = {
23+
"Name" = "two"
24+
}
25+
}
26+
27+
28+
###################################################
29+
# VPC Peering
30+
###################################################
31+
32+
module "peering" {
33+
source = "../../modules/vpc-peering"
34+
# source = "tedilabs/vpc-connectivity/aws//modules/vpc-peering"
35+
# version = "~> 0.2.0"
36+
37+
providers = {
38+
aws.requester = aws
39+
aws.accepter = aws
40+
}
41+
42+
name = "one/two"
43+
44+
45+
## Requester
46+
requester_vpc = {
47+
id = aws_vpc.one.id
48+
}
49+
requester_options = {
50+
allow_remote_vpc_dns_resolution = true
51+
}
52+
53+
54+
## Acccepter
55+
accepter_vpc = {
56+
id = aws_vpc.two.id
57+
}
58+
accepter_options = {
59+
allow_remote_vpc_dns_resolution = true
60+
}
61+
62+
63+
tags = {
64+
"project" = "terraform-aws-vpc-connectivity-examples"
65+
}
66+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
output "peering" {
2+
description = "The VPC Peering Connection."
3+
value = module.peering
4+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
terraform {
2+
required_version = "~> 1.6"
3+
4+
required_providers {
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = "~> 5.0"
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)