Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

509
Visualizações
Terraform : Specifying the working directory when running terraform apply/plan

Is there any way (or workaround) to specify the working directory when running terraform apply or terraform plan ? For example :

terraform apply working_dir/vpc
terraform apply working_dir/dns
terraform apply working_dir/postgres
terraform apply working_dir/service-a
terraform apply working_dir/service-b

I know there's a target option where we can specify the resources to target. But here I need a folder to have more abstraction. The final goal is to be able to setup the infrastructure running the following commands :

make vpc
make dns
make postgres
make service-a
make service-b
over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

These days you can also use global option -chdir:

The chdir option instructs Terraform to change its working directory to the given directory before running the given subcommand. This means that any files that Terraform would normally read or write in the current working directory will be read or written in the given directory instead.

For example:

terraform -chdir=environments/production apply
over 4 years ago · Santiago Trujillo Relatório

0

You can specify a plan or directory when issuing the apply command. Your examples are valid apply commands.

Usage: terraform apply [options] [dir-or-plan]

over 4 years ago · Santiago Trujillo Relatório

0

Execute below commands from parent directory having multiple directories containing terraform (*.tf) files.

To execute terraform:

terraform init dir-name
terraform validate dir-name
terraform plan -detailed-exitcode -out=plan-name.out dir-name
terraform apply plan-name.out

To destroy use:

terraform destroy dir-name
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda