Skip to content

Latest commit

 

History

History
113 lines (97 loc) · 3.92 KB

red.md

File metadata and controls

113 lines (97 loc) · 3.92 KB

Resume Modulo Red

Requirements

No requirements.

Resources

Name Type
aws_default_route_table.OBL-route-table resource
aws_internet_gateway.OBL-IGW resource
aws_subnet.OBL-public-subnet resource
aws_subnet.OBL-public-subnet-2 resource
aws_vpc.vpc-OBL resource

Inputs

Name Description Type Default Required
name_vpc Nombre VPC any n/a yes
public_subnet Direccion de primer subred any n/a yes
public_subnet-2 Direccion segunda subred any n/a yes
tag_igw Tag IGW string n/a yes
tag_subnet1 Tag Subnet string n/a yes
tag_subnet2 Tag Subnet2 string n/a yes
tag_tablarutas Tabla de rutas string n/a yes
vpc_aws_az Zona de Disponibilidad any n/a yes
vpc_aws_az-2 Zona de Disponibilidad 2 any n/a yes
vpc_cidr Direccion y mascara any n/a yes

Outputs

Name Description
aws_vpc_id n/a
id-subnet-1 n/a
id-subnet-2 n/a

Explicación del código

  • main.tf
#### Recursos de Red #### 
resource "aws_vpc" "vpc-OBL" {
  cidr_block           = var.vpc_cidr
  enable_dns_support   = true
  enable_dns_hostnames = true

  tags = {
    Name = var.name_vpc
  }
}
resource "aws_subnet" "OBL-public-subnet" {
  vpc_id                  = aws_vpc.vpc-OBL.id
  cidr_block              = var.public_subnet
  availability_zone       = var.vpc_aws_az
  map_public_ip_on_launch = "true"
  
  tags = {
    Name = var.tag_subnet1
  }
}
resource "aws_subnet" "OBL-public-subnet-2" {
  vpc_id                  = aws_vpc.vpc-OBL.id
  cidr_block              = var.public_subnet-2
  availability_zone       = var.vpc_aws_az-2
  map_public_ip_on_launch = "true"
  
  tags = {
    Name = var.tag_subnet2
  }
}
resource "aws_internet_gateway" "OBL-IGW" {
  vpc_id = aws_vpc.vpc-OBL.id
  tags = {
    Name = var.tag_igw
  }
}
resource "aws_default_route_table" "OBL-route-table" {
  default_route_table_id = aws_vpc.vpc-OBL.default_route_table_id
  
  route {
    cidr_block = "0.0.0.0/0"
    gateway_id = aws_internet_gateway.OBL-IGW.id
  }
  tags = {
    Name = var.tag_tablarutas
  }
}
  • output.tf
output "aws_vpc_id" {
  value = aws_vpc.vpc-OBL.id
}

output "id-subnet-1" {
  value = aws_subnet.OBL-public-subnet.id
}

output "id-subnet-2" {
  value = aws_subnet.OBL-public-subnet-2.id
}
  • variables.tf
### Variables locales del modulo RED ###

Anexo - recursos externos

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_cluster

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_node_group