-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test for when only 1 side has ipv6 addresses
- Loading branch information
1 parent
34f13ba
commit cf25278
Showing
10 changed files
with
104 additions
and
5 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
73 changes: 73 additions & 0 deletions
73
test/fixtures/single-account-single-region-one-dualstack/main.tf
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,73 @@ | ||
// Fixtures | ||
// VPC | ||
resource "aws_vpc" "this" { | ||
cidr_block = "172.20.0.0/16" | ||
assign_generated_ipv6_cidr_block = true | ||
|
||
tags = { | ||
Name = "this_vpc" | ||
Environment = "Test" | ||
} | ||
} | ||
|
||
resource "aws_vpc" "peer" { | ||
cidr_block = "172.21.0.0/16" | ||
assign_generated_ipv6_cidr_block = false | ||
|
||
tags = { | ||
Name = "peer_vpc" | ||
Environment = "Test" | ||
} | ||
} | ||
|
||
// Route Tables | ||
resource "aws_route_table" "this" { | ||
count = length(var.azs) | ||
|
||
vpc_id = aws_vpc.this.id | ||
|
||
tags = { | ||
Name = "This VPC RT" | ||
Environment = "Test" | ||
} | ||
} | ||
|
||
resource "aws_route_table" "peer" { | ||
count = length(var.azs) | ||
|
||
vpc_id = aws_vpc.peer.id | ||
|
||
tags = { | ||
Name = "Peer VPC RT" | ||
Environment = "Test" | ||
} | ||
} | ||
|
||
// Subnets | ||
resource "aws_subnet" "this" { | ||
for_each = toset(var.azs) | ||
|
||
vpc_id = aws_vpc.this.id | ||
cidr_block = cidrsubnet(aws_vpc.this.cidr_block, 5, index(var.azs, each.value)) | ||
// IPV6 Subnet cidr needs to align to /64, aws provides a /56 CIDR automatically | ||
ipv6_cidr_block = cidrsubnet(aws_vpc.this.ipv6_cidr_block, 8, index(var.azs, each.value)) | ||
availability_zone = each.value | ||
|
||
tags = { | ||
Name = "This VPC Subnet" | ||
Environment = "Test" | ||
} | ||
} | ||
|
||
resource "aws_subnet" "peer" { | ||
for_each = toset(var.azs) | ||
|
||
vpc_id = aws_vpc.peer.id | ||
cidr_block = cidrsubnet(aws_vpc.peer.cidr_block, 5, index(var.azs, each.value)) | ||
availability_zone = each.value | ||
|
||
tags = { | ||
Name = "This VPC Subnet" | ||
Environment = "Test" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
test/fixtures/single-account-single-region-one-dualstack/outputs.tf
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 = aws_vpc.this.id | ||
} | ||
|
||
output "peer_vpc_id" { | ||
value = aws_vpc.peer.id | ||
} |
13 changes: 13 additions & 0 deletions
13
test/fixtures/single-account-single-region-one-dualstack/provider.tf
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 @@ | ||
provider "aws" { | ||
endpoints { | ||
ec2 = "http://localhost:4566" | ||
s3 = "http://localhost:4566" | ||
sts = "http://localhost:4566" | ||
} | ||
region = "eu-west-1" | ||
access_key = "null" | ||
secret_key = "null" | ||
skip_credentials_validation = true | ||
skip_metadata_api_check = true | ||
skip_requesting_account_id = true | ||
} |
5 changes: 5 additions & 0 deletions
5
test/fixtures/single-account-single-region-one-dualstack/variables.tf
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 @@ | ||
variable "azs" { | ||
description = "Availability Zones" | ||
type = list(string) | ||
default = ["eu-west-1a", "eu-west-1b", "eu-west-1c"] | ||
} |
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