Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Terraform know what files to load?

Tags:

terraform

How do commands such as terraform plan know / decide which files to use?

-help shows a DIR-OR-PLAN argument, but doesn't show how to use it:

$ terraform -help plan
Usage: terraform plan [options] [DIR-OR-PLAN]

How do I specify what files to use?

like image 297
davetapley Avatar asked Dec 21 '25 08:12

davetapley


1 Answers

If [DIR-OR-PLAN] is omitted (e.g. terraform plan) then it defaults to the current directory.

Terraform loads all configuration files (i.e. files ending in .tf or .tf.json) within that directory in alphabetical order.

So in answer to:

How do I specify what files to use?

You must ensure only the files you wish terraform to use are in the directory.

See Load Order and Semantics for more info.

like image 145
davetapley Avatar answered Dec 23 '25 20:12

davetapley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!