diff --git a/modules/vpc/main.tf b/modules/vpc/main.tf new file mode 100644 index 0000000..99de59d --- /dev/null +++ b/modules/vpc/main.tf @@ -0,0 +1,10 @@ +resource "aws_vpc" "vpc-main" { + cidr_block = var.cidr_block + enable_dns_support = var.enable_dns_support + enable_dns_hostnames = var.enable_dns_hostnames + + tags = ({ + Name = var.name + }) + +} \ No newline at end of file diff --git a/modules/vpc/outputs.tf b/modules/vpc/outputs.tf new file mode 100644 index 0000000..03ba89b --- /dev/null +++ b/modules/vpc/outputs.tf @@ -0,0 +1,9 @@ +output "vpc_id" { + description = "VPC Identifier" + value = aws_vpc.vpc-main.id +} + +output "vpc_cidr_block" { + description = "VPC CIDR Block" + value = aws_vpc.vpc-main.cidr_block +} \ No newline at end of file diff --git a/modules/vpc/variables.tf b/modules/vpc/variables.tf new file mode 100644 index 0000000..f6740bd --- /dev/null +++ b/modules/vpc/variables.tf @@ -0,0 +1,28 @@ +variable "name" { + description = "The name of the VPC" + type = string + +} + +variable "cidr_block" { + description = "CIDR block for the VPC" + type = string + default = "10.0.0.0/16" + +} + +variable "enable_dns_support" { + description = "CIDR block for the VPC" + type = bool + default = true + +} + +variable "enable_dns_hostnames" { + description = "CIDR block for the VPC" + type = bool + default = true + +} + + diff --git a/outputs.tf b/outputs.tf new file mode 100644 index 0000000..1fb1169 --- /dev/null +++ b/outputs.tf @@ -0,0 +1,9 @@ +output "vpc_id" { + description = "VPC Identifier" + value = module.vpc-main.id +} + +output "vpc_cidr_block" { + description = "VPC CIDR Block" + value = module.vpc-main.cidr_block +} \ No newline at end of file diff --git a/variables.tf b/variables.tf new file mode 100644 index 0000000..db08fbb --- /dev/null +++ b/variables.tf @@ -0,0 +1,31 @@ +variable "name" { + description = "The name of the VPC" + type = string + default = "vpc-main" + +} + +variable "cidr_block" { + description = "CIDR block for the VPC" + type = string + default = "10.0.0.0/16" + +} + +variable "enable_dns_support" { + description = "CIDR block for the VPC" + type = bool + default = true + +} + +variable "enable_dns_hostnames" { + description = "CIDR block for the VPC" + type = bool + default = true + +} + + + + diff --git a/vpc.tf b/vpc.tf new file mode 100644 index 0000000..18aa8c3 --- /dev/null +++ b/vpc.tf @@ -0,0 +1,8 @@ +module "vpc-main" { + source = "./modules/vpc" + name = var.name + cidr_block = var.cidr_block + enable_dns_support = var.enable_dns_support + enable_dns_hostnames = var.enable_dns_hostnames + +} \ No newline at end of file