Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

148
Vistas
Using outputs from other tf files in terraform

Is there a way of using output values of a module that is located in another folder? Imagine the following environment:

tm-project/
├── lambda
│   └── vpctm-manager.js
├── networking
│   ├── init.tf
│   ├── terraform.tfvars
│   ├── variables.tf
│   └── vpc-tst.tf
├── prd
│   ├── init.tf
│   ├── instances.tf
│   ├── terraform.tfvars
│   └── variables.tf
└── security
    └── init.tf

I want to create EC2 instances and place them in a subnet that is declared in networking folder. So, I was wondering if by any chance I could access the outputs of the module I used in networking/vpc-tst.tf as the inputs of my prd/instances.tf.

Thanks in advances.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can use a outputs.tf file to define the outputs of a terraform module. Your output will have the variables name such as the content below.

output "vpc_id" {
  value = "${aws_vpc.default.id}"
}

These can then be referenced within your prd/instances.tf by referencing the resource name combined with the output name you defined in your file.

For example if you have a module named vpc which uses this module you could then use the output similar to below.

module "vpc" {
   ......
}

resource "aws_security_group" "my_sg" {
    vpc_id = module.vpc.vpc_id
}
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda