Which command-line option can be used to provide variable values from a file?

Prepare for the HashiCorp Terraform Associate Exam. Utilize flashcards and multiple-choice questions with detailed hints and explanations. Boost your confidence and be ready for success!

Multiple Choice

Which command-line option can be used to provide variable values from a file?

Explanation:
Providing variable values from a file is done with a CLI option that takes the path to a file containing those definitions. The option -var-file=path/to/your.vars.tfvars loads all variables defined in that file before Terraform runs a plan or apply. This approach is ideal when you have many variables to manage, and the file can be in HCL tfvars format or JSON. In contrast, -var is used to set a single variable inline, and the other listed forms aren’t valid Terraform options, so they wouldn’t load variables from a file.

Providing variable values from a file is done with a CLI option that takes the path to a file containing those definitions. The option -var-file=path/to/your.vars.tfvars loads all variables defined in that file before Terraform runs a plan or apply. This approach is ideal when you have many variables to manage, and the file can be in HCL tfvars format or JSON. In contrast, -var is used to set a single variable inline, and the other listed forms aren’t valid Terraform options, so they wouldn’t load variables from a file.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy