.terraformrc file location

1,303 views
Skip to first unread message

Andy

unread,
Dec 14, 2016, 2:33:14 PM12/14/16
to Terraform
I know this is probably a dumb question but I had hunted high and low to see if there is any other option besides placing in ~/.terraformrc. Is there any other way to put this file somewhere else or does it have to be in home dir? I see the docs explicitly state this (relevant to putting in ~/terraformrc)  but because I am relatively new to terraform I though I would ask here in case I missed something..

Andrew Langhorn

unread,
Dec 14, 2016, 6:58:07 PM12/14/16
to terrafo...@googlegroups.com
It's possible I'm misreading the source, but https://github.com/hashicorp/terraform/blob/master/config_unix.go#L15-L22 suggests that Terraform always looks in the home directory for .terraformrc. If you did want to move .terraformrc elsewhere, you could maybe symlink it.

Out of interest, what's the reason for wanting .terraformrc out of the home directory?

Andy

unread,
Dec 14, 2016, 8:46:03 PM12/14/16
to Terraform, andrew....@thoughtworks.com
I am deploying terraform via puppet as a git repo that includes all the custom terraform modules required to manage infrastructure. (actually deploying consul/vault and the entitre platform via puppet)  So in my mind I am thinking that I should be able to source the provider binary inside if this git repo so it is completely self contained and does not need to require a user to put a .terraformrc in their home dir. I did include the .terraformrc in this repo and was planning to tell folks to create symlinks but it just seemed like there must be another way. I guess there is not and that is the way it is.

I wonder what is the specific logic/reasoning behind requiring this in a users home dir. I cant think of any other tool that I have worked with that was like this but then again I am sure there are tons of tools I have not worked with yet :) I can make whatever is required work so no biggie but I just wanted to make sure that I was no missing something. (which it appears that I am not thus far )

quenti...@coreos.com

unread,
Mar 29, 2017, 2:02:53 PM3/29/17
to Terraform
You may use the `TERRAFORM_CONFIG` environment variable to specify the path to a configuration file.
Reply all
Reply to author
Forward
0 new messages