From e42fb6e1a1a9bf787bd9d37a05804f3d3257b642 Mon Sep 17 00:00:00 2001 From: Giovanni Gava Date: Fri, 4 Apr 2025 11:45:11 -0300 Subject: [PATCH 1/5] feat(tf): add vpc module and vpc resource --- modules/vpc/main.tf | 10 ++++++++++ modules/vpc/outputs.tf | 9 +++++++++ modules/vpc/variables.tf | 28 ++++++++++++++++++++++++++++ vpc/outputs.tf | 9 +++++++++ vpc/variables.tf | 31 +++++++++++++++++++++++++++++++ vpc/vpc.tf | 8 ++++++++ 6 files changed, 95 insertions(+) create mode 100644 modules/vpc/main.tf create mode 100644 modules/vpc/outputs.tf create mode 100644 modules/vpc/variables.tf create mode 100644 vpc/outputs.tf create mode 100644 vpc/variables.tf create mode 100644 vpc/vpc.tf 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/vpc/outputs.tf b/vpc/outputs.tf new file mode 100644 index 0000000..2f558a1 --- /dev/null +++ b/vpc/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/vpc/variables.tf b/vpc/variables.tf new file mode 100644 index 0000000..db08fbb --- /dev/null +++ b/vpc/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/vpc.tf b/vpc/vpc.tf new file mode 100644 index 0000000..2e8bbf3 --- /dev/null +++ b/vpc/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 From 8f9d497164b25d5bc5ad0c684601c9473a723075 Mon Sep 17 00:00:00 2001 From: Giovanni Gava Date: Fri, 4 Apr 2025 11:49:24 -0300 Subject: [PATCH 2/5] feat(tf): moving folders and add vpc module and vpc resource --- vpc/outputs.tf => outputs.tf | 0 vpc/variables.tf => variables.tf | 0 vpc/vpc.tf => vpc.tf | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename vpc/outputs.tf => outputs.tf (100%) rename vpc/variables.tf => variables.tf (100%) rename vpc/vpc.tf => vpc.tf (100%) diff --git a/vpc/outputs.tf b/outputs.tf similarity index 100% rename from vpc/outputs.tf rename to outputs.tf diff --git a/vpc/variables.tf b/variables.tf similarity index 100% rename from vpc/variables.tf rename to variables.tf diff --git a/vpc/vpc.tf b/vpc.tf similarity index 100% rename from vpc/vpc.tf rename to vpc.tf From b45ec29aa02797cdc5e8dcb407396053b3b3daf0 Mon Sep 17 00:00:00 2001 From: Giovanni Gava Date: Fri, 4 Apr 2025 11:50:40 -0300 Subject: [PATCH 3/5] feat(tf): moving folders and add vpc module and vpc resource --- outputs.tf | 4 ++-- vpc.tf | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/outputs.tf b/outputs.tf index 2f558a1..1fb1169 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,9 +1,9 @@ output "vpc_id" { description = "VPC Identifier" - value = module.vpc-main.id + value = module.vpc-main.id } output "vpc_cidr_block" { description = "VPC CIDR Block" - value = module.vpc-main.cidr_block + value = module.vpc-main.cidr_block } \ No newline at end of file diff --git a/vpc.tf b/vpc.tf index 2e8bbf3..315f42c 100644 --- a/vpc.tf +++ b/vpc.tf @@ -1,8 +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 + 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 From 63372a36e0f9893b2209eb5471f52af69351c62e Mon Sep 17 00:00:00 2001 From: Giovanni Gava Date: Fri, 4 Apr 2025 11:51:18 -0300 Subject: [PATCH 4/5] feat(tf): moving folders and add vpc module and vpc resource --- vpc.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vpc.tf b/vpc.tf index 315f42c..c39427d 100644 --- a/vpc.tf +++ b/vpc.tf @@ -1,5 +1,5 @@ module "vpc-main" { - source = "../modules/vpc" + source = "modules/vpc" name = var.name cidr_block = var.cidr_block enable_dns_support = var.enable_dns_support From b32f4ccb382111d9dd1f3a3ed676ab0b8b23057d Mon Sep 17 00:00:00 2001 From: Giovanni Gava Date: Fri, 4 Apr 2025 11:52:22 -0300 Subject: [PATCH 5/5] feat(tf): moving folders and add vpc module and vpc resource --- vpc.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vpc.tf b/vpc.tf index c39427d..18aa8c3 100644 --- a/vpc.tf +++ b/vpc.tf @@ -1,5 +1,5 @@ module "vpc-main" { - source = "modules/vpc" + source = "./modules/vpc" name = var.name cidr_block = var.cidr_block enable_dns_support = var.enable_dns_support