Terraform may create a few files in a .terraform directory.
The terraform get
command will create symlinks to my local module paths if I use local modules. Those path names are hashes, like
7a1d2376c59a613c3888163f019b98c1@ -> /Users/michael/dev/a-project/terraform/modules/netpart
dc86adf2084ae95b189765d26b75702d@ -> /Users/michael/dev/a-project/terraform/modules/cluster
e03511e017c5612ae4b9e9ebc49d4611@ -> /Users/michael/dev/a-project/terraform/modules/cluster
eb8c48ae43e85626ff456d0a58a6a6a6@ -> /Users/michael/dev/a-project/terraform/modules/netpart
All these files are in the same repo. When a coworker cloned that repo, he noticed that running terraform get
resulted in new symlinks, even though the modules had not changed.
Should I add the .terraform/modules directory to .gitignore and require all developers to run terraform get
any time they git pull
?
We gitignore the whole .terraform
folder entirely.
Yes it does mean you need to run a terraform get
before every action but typically when working as part of a team you will want to wrap your Terraform actions in helper scripts that can do this as well as managing remote state for you.
In fact the above documentation for terraform get
explicitly advises you not to commit the folder to source control:
The modules are downloaded into a local .terraform folder. This folder should not be committed to version control.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With