Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terraform: How do I Execute Terraform Actions Without the Interactive Prompt?

Tags:

terraform

How am I able to execute the following command:

terraform apply

#=>

. . .

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value:

without the interactive prompt that follows?

like image 371
Dan Avatar asked Jan 28 '20 22:01

Dan


People also ask

How do I run terraform without prompt?

You can pass the -auto-approve option to instruct Terraform to apply the plan without asking for confirmation.

How do I run terraform code locally?

Automated Terraform CLI WorkflowInitialize the Terraform working directory. Produce a plan for changing resources to match the current configuration. Have a human operator review that plan, to ensure it is acceptable. Apply the changes described by the plan.

What is the command to execute a terraform script?

The command line interface to Terraform is via the terraform command, which accepts a variety of subcommands such as terraform init or terraform plan .

Can we run terraform apply without plan?

In automation terraform apply can be run after the plan stage, passing in the plan output file. If there is no plan stage prior to the apply stage (not recommended), then the terraform apply -auto-approve option can be used.


1 Answers

terraform apply -auto-approve 

https://www.terraform.io/docs/commands/apply.html#auto-approve

like image 53
Pero P. Avatar answered Sep 28 '22 14:09

Pero P.