mirror of
https://github.com/mr-vercetti/tf-aws-demo.git
synced 2025-07-01 20:45:33 +02:00
Initial commit
This commit is contained in:
41
modules/vpc_data/main.tf
Executable file
41
modules/vpc_data/main.tf
Executable file
@ -0,0 +1,41 @@
|
||||
data "aws_vpc" "vpc" {
|
||||
tags = {
|
||||
Name = var.VPC_NAME
|
||||
}
|
||||
}
|
||||
|
||||
data "aws_subnets" "private_subnets" {
|
||||
filter {
|
||||
name = "vpc-id"
|
||||
values = [data.aws_vpc.vpc.id]
|
||||
}
|
||||
|
||||
filter {
|
||||
name = "tag:Name"
|
||||
values = ["${var.VPC_NAME}-private*"]
|
||||
}
|
||||
}
|
||||
|
||||
data "aws_subnets" "public_subnets" {
|
||||
filter {
|
||||
name = "vpc-id"
|
||||
values = [data.aws_vpc.vpc.id]
|
||||
}
|
||||
|
||||
filter {
|
||||
name = "tag:Name"
|
||||
values = ["${var.VPC_NAME}-public*"]
|
||||
}
|
||||
}
|
||||
|
||||
data "aws_subnet" "bastion_host_subnet" {
|
||||
filter {
|
||||
name = "vpc-id"
|
||||
values = [data.aws_vpc.vpc.id]
|
||||
}
|
||||
|
||||
filter {
|
||||
name = "tag:Name"
|
||||
values = ["${var.VPC_NAME}-public-${var.BASTION_HOST_AZ}"]
|
||||
}
|
||||
}
|
15
modules/vpc_data/outputs.tf
Executable file
15
modules/vpc_data/outputs.tf
Executable file
@ -0,0 +1,15 @@
|
||||
output "vpc" {
|
||||
value = data.aws_vpc.vpc
|
||||
}
|
||||
|
||||
output "public_subnets" {
|
||||
value = data.aws_subnets.public_subnets
|
||||
}
|
||||
|
||||
output "private_subnets" {
|
||||
value = data.aws_subnets.private_subnets
|
||||
}
|
||||
|
||||
output "bastion_host_subnet" {
|
||||
value = data.aws_subnet.bastion_host_subnet
|
||||
}
|
7
modules/vpc_data/variables.tf
Executable file
7
modules/vpc_data/variables.tf
Executable file
@ -0,0 +1,7 @@
|
||||
variable "VPC_NAME" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "BASTION_HOST_AZ" {
|
||||
type = string
|
||||
}
|
Reference in New Issue
Block a user