-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2438 from wking/aws-bring-your-own-vpc
data/aws/vpc: Lay the groundwork for bring-your-own VPC/subnets
- Loading branch information
Showing
9 changed files
with
94 additions
and
37 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
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 |
---|---|---|
@@ -1,16 +1,21 @@ | ||
# Canonical internal state definitions for this module. | ||
# read only: only locals and data source definitions allowed. No resources or module blocks in this file | ||
|
||
// Only reference data sources which are guaranteed to exist at any time (above) in this locals{} block | ||
locals { | ||
private_subnet_ids = aws_subnet.private_subnet.*.id | ||
public_subnet_ids = aws_subnet.public_subnet.*.id | ||
} | ||
|
||
# all data sources should be input variable-agnostic and used as canonical source for querying "state of resources" and building outputs | ||
# (ie: we don't want "aws.new_vpc" and "data.aws_vpc.cluster_vpc", just "data.aws_vpc.cluster_vpc" used everwhere). | ||
|
||
data "aws_vpc" "cluster_vpc" { | ||
id = aws_vpc.new_vpc.id | ||
id = var.vpc == null ? aws_vpc.new_vpc[0].id : var.vpc | ||
} | ||
|
||
data "aws_subnet" "public" { | ||
count = var.public_subnets == null ? length(var.availability_zones) : length(var.public_subnets) | ||
|
||
id = var.public_subnets == null ? aws_subnet.public_subnet[count.index].id : var.public_subnets[count.index] | ||
} | ||
|
||
data "aws_subnet" "private" { | ||
count = var.private_subnets == null ? length(var.availability_zones) : length(var.private_subnets) | ||
|
||
id = var.private_subnets == null ? aws_subnet.private_subnet[count.index].id : var.private_subnets[count.index] | ||
} |
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
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