Por qué este laboratorio
Viene de operar un entorno híbrido con AWS y Azure, donde una necesidad habitual es llegar a un servicio de forma privada, sin internet gateway y sin NAT. Este laboratorio construye ese patrón de principio a fin con Terraform.
Qué he hecho
Cinco módulos de Terraform:
- Una VPC privada con flow logs.
- Un NLB interno con un endpoint service que exige aceptación y principals explícitos.
- Un interface endpoint con un security group estrecho.
- Una zona privada de Route 53 con alias y logs de consultas.
- Endpoints de SSM y S3, más un laboratorio con dos instancias de prueba (IMDSv2, sin IP pública, Session Manager).
Cómo se prueba
terraform test con el proveedor de AWS simulado (5 tests) y un pipeline de GitHub Actions con fmt, validate, test y tfsec, todo en verde. Tener el laboratorio encendido cuesta unos 0,11 $ la hora.
Qué aprendí
La CI con Terraform encontró un fallo real que OpenTofu no marcó: un for_each sobre IDs que no se conocen en el plan. Está corregido y explicado en docs/decisions.md.
Siguientes pasos
- Ejecutar
terraform applyen una cuenta de AWS de pruebas (el laboratorio cuesta unos 0,11 $ por hora). - Conectar tus VPC, los principals permitidos y tu zona DNS privada.
- Mantener las comprobaciones de CI (fmt, validate, test, tfsec) en tu pipeline.
¿Quieres llevarlo a tu entorno o adaptarlo a tu caso? Escríbeme y lo vemos.
Why this lab
Comes from operating a hybrid AWS and Azure environment, where a common need is reaching a service privately, with no internet gateway and no NAT. This lab builds that pattern end to end with Terraform.
What I built
Five Terraform modules:
- A private VPC with flow logs.
- An internal NLB with an endpoint service that requires acceptance and explicit principals.
- An interface endpoint with a narrow security group.
- A private Route 53 zone with an alias and query logs.
- SSM and S3 endpoints, plus a lab with two test instances (IMDSv2, no public IP, Session Manager).
How it is tested
terraform test with a mocked AWS provider (5 tests) and a GitHub Actions pipeline with fmt, validate, test and tfsec, all green. The estimated cost of running the lab is about $0.11 an hour.
What I learned
Running CI with Terraform caught a real bug that OpenTofu didn't flag: a for_each over IDs that are unknown at plan time. It is fixed and written up in docs/decisions.md.
Next steps
- Run
terraform applyin a sandbox AWS account (the lab costs around $0.11 per hour). - Plug in your own VPCs, allowed principals and private DNS zone.
- Keep the CI checks (fmt, validate, test, tfsec) in your pipeline.
Want to bring it to your environment or adapt it to your case? Get in touch and we can look at it together.
Tech Career Lab · newsletter
¿Te ha servido? Cada dos semanas envío una idea práctica para perfiles IT: LinkedIn, proyectos, networking y procesos de selección.Found this useful? Every two weeks I send one practical idea for IT professionals: LinkedIn, projects, networking and hiring processes.
Apúntate y llévate las 33 ideasSign up and get the 33 ideas →