Order of run tf file

I have some *.tf files in terraform directory. How can I run them in order? for example:
run file3.tf before file1.tf

1 Like

That’s not how Terraform works. All files are parsed and then a dependency graph is created from all the resources/data sources found. When you run apply this graph is then followed, with Terraform making any changes that are depended upon first. By default several changes (assuming they don’t have dependencies) will be run in parallel.

1 Like

If you’d like to learn more about how Terraform infers dependencies based on references, there is a tutorial about this subject: Create Resource Dependencies.

2 Likes