-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create routes for associated VPC CIDRs (#97)
* Create routes for associated VPC CIDRs * Create fixtures for associated CIDRs (#98) * Create fixtures for associated CIDRs * Add the test * Separate normal and associated routes
- Loading branch information
Showing
14 changed files
with
190 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,6 @@ vendor/ | |
main.go | ||
go.mod | ||
go.sum | ||
|
||
# Environment variables | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Basic Module Example | ||
// Creates a peering between VPCs in the same account in the same region | ||
module "associated_cidrs" { | ||
source = "../../" | ||
|
||
providers = { | ||
aws.this = aws | ||
aws.peer = aws | ||
} | ||
|
||
this_vpc_id = var.this_vpc_id | ||
peer_vpc_id = var.peer_vpc_id | ||
|
||
from_this_associated = true | ||
from_peer_associated = true | ||
|
||
auto_accept_peering = true | ||
|
||
tags = { | ||
Name = "tf-associated-cirds" | ||
Environment = "Test" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Required for tests | ||
output "vpc_peering_accept_status" { | ||
value = module.associated_cidrs.vpc_peering_accept_status | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
provider "aws" { | ||
region = "eu-west-1" | ||
access_key = var.aws_this_access_key | ||
secret_key = var.aws_this_secret_key | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Variables are required to pass them via Terratest | ||
// on fixtures creation | ||
variable "this_vpc_id" {} | ||
|
||
variable "peer_vpc_id" {} | ||
|
||
variable "aws_this_access_key" { | ||
description = "AWS Access Key for requester account" | ||
} | ||
|
||
variable "aws_this_secret_key" { | ||
description = "AWS Secret Key for requester account" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
module "this_vpc" { | ||
source = "terraform-aws-modules/vpc/aws" | ||
|
||
name = "this-vpc" | ||
cidr = "10.0.0.0/16" | ||
secondary_cidr_blocks = ["10.10.0.0/16"] | ||
|
||
azs = ["eu-west-1a", "eu-west-1b", "eu-west-1c"] | ||
intra_subnets = [ | ||
"10.0.1.0/24", | ||
"10.0.2.0/24", | ||
"10.0.3.0/24", | ||
"10.10.1.0/24", | ||
"10.10.2.0/24", | ||
"10.10.3.0/24", | ||
] | ||
|
||
enable_nat_gateway = false | ||
enable_vpn_gateway = false | ||
|
||
tags = { | ||
Name = "this-vpc" | ||
Terraform = "true" | ||
Environment = "Test" | ||
} | ||
} | ||
|
||
module "peer_vpc" { | ||
source = "terraform-aws-modules/vpc/aws" | ||
|
||
name = "peer-vpc" | ||
cidr = "10.1.0.0/16" | ||
secondary_cidr_blocks = ["10.11.0.0/16"] | ||
|
||
azs = ["eu-west-1a", "eu-west-1b", "eu-west-1c"] | ||
intra_subnets = [ | ||
"10.1.1.0/24", | ||
"10.1.2.0/24", | ||
"10.1.3.0/24", | ||
"10.11.1.0/24", | ||
"10.11.2.0/24", | ||
"10.11.3.0/24", | ||
] | ||
|
||
enable_nat_gateway = false | ||
enable_vpn_gateway = false | ||
|
||
tags = { | ||
Name = "peer-vpc" | ||
Terraform = "true" | ||
Environment = "Test" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
output "this_vpc_id" { | ||
value = module.this_vpc.vpc_id | ||
} | ||
|
||
output "peer_vpc_id" { | ||
value = module.peer_vpc.vpc_id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
provider "aws" { | ||
region = "eu-west-1" | ||
access_key = var.aws_this_access_key | ||
secret_key = var.aws_this_secret_key | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Variables | ||
variable "aws_this_access_key" { | ||
description = "AWS Access Key for requester account" | ||
} | ||
|
||
variable "aws_this_secret_key" { | ||
description = "AWS Secret Key for requester account" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters