init
This commit is contained in:
14
modules/vpc-subnet/main.tf
Normal file
14
modules/vpc-subnet/main.tf
Normal file
@ -0,0 +1,14 @@
|
||||
resource "aws_subnet" "main" {
|
||||
vpc_id = var.vpc_id
|
||||
|
||||
for_each = var.subnet-az-list
|
||||
availability_zone = each.value.name
|
||||
cidr_block = each.value.cidr
|
||||
|
||||
map_public_ip_on_launch = var.public_ip_on ? true : false
|
||||
|
||||
tags = {
|
||||
Name = "${var.tag_name}-subnet"
|
||||
}
|
||||
|
||||
}
|
||||
5
modules/vpc-subnet/outputs.tf
Normal file
5
modules/vpc-subnet/outputs.tf
Normal file
@ -0,0 +1,5 @@
|
||||
//modules-subnet-outputs
|
||||
output "subnet" {
|
||||
description = "Subnets info"
|
||||
value = aws_subnet.main
|
||||
}
|
||||
20
modules/vpc-subnet/valiables.tf
Normal file
20
modules/vpc-subnet/valiables.tf
Normal file
@ -0,0 +1,20 @@
|
||||
variable "vpc_id" {
|
||||
description = "set vpc id"
|
||||
type = string
|
||||
}
|
||||
|
||||
// reference | https://github.com/davidcsi/terraform/blob/master/healthchecks/main.tf
|
||||
variable "subnet-az-list" {
|
||||
description = "Subnet available zone & cidr"
|
||||
type = map(map(string))
|
||||
}
|
||||
|
||||
|
||||
variable "public_ip_on" {
|
||||
type = bool
|
||||
}
|
||||
|
||||
variable "tag_name" {
|
||||
description = "value"
|
||||
type = string
|
||||
}
|
||||
Reference in New Issue
Block a user