Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for custom path in TF_PLUGIN_CACHE_DIR #778

Closed
nocode99 opened this issue Sep 17, 2019 · 4 comments
Closed

Allow for custom path in TF_PLUGIN_CACHE_DIR #778

nocode99 opened this issue Sep 17, 2019 · 4 comments
Labels
question Further information is requested waiting-on-response Waiting for a response from the user

Comments

@nocode99
Copy link

According to this: #34, TF_PLUGIN_CACHE_DIR defaults to $HOME/.terraform.d/plugin-cache however I can't get this to work in Docker (using the Fargate module). atlantis server is run by root (home: /root/) and the child process runs as atlantis. However, when atlantis runs any TF commands, the child process is using the parent processes $HOME

TF_PLUGIN_CACHE_DIR should be an env var that the child process can honor. I've read through the guides and documentation and don't see a way around this? AWS Fargate has a 10GB limit that cannot be increased and so we run out of disk space very quickly. I wanted to set the plugin cache to somewhere in /tmp. Ideally, that's where the default should be.

@lkysow
Copy link
Member

lkysow commented Sep 27, 2019

Weird. If it's running as atlantis then it shouldn't be using /root as its home. Did you make any modifications to the fargate module?

Regardless, we actually use a directory the --data-dir for the plugin cache. --data-dir defaults to $HOME/.atlantis. Unless you're using custom workflows?

@lkysow lkysow added question Further information is requested waiting-on-response Waiting for a response from the user labels Sep 27, 2019
@nocode99
Copy link
Author

nocode99 commented Oct 7, 2019

We are using the official Atlantis Docker image and using terragrunt with an Atlantis custom workflow. In the docker_entrypoint.sh, it's running the atlantis process as the atlantis user. Seemingly, any time we run atlantis plan/apply in PR's, it's using the /root. Below is a sample plan output:


�[0m�[1mInitializing the backend...�[0m
�[0m�[32m
Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.�[0m

�[0m�[1mInitializing provider plugins...�[0m
- Checking for available provider plugins...
- Downloading plugin for provider "aws" (terraform-providers/aws) 2.25.0...
�[31m
�[0m�[1m�[31mError installing provider "aws": mkdir /root/.terraform.d: permission denied.�[0m�[31m

Terraform analyses the configuration and state and automatically downloads
plugins for the providers used. However, when attempting to download this
plugin an unexpected error occurred.

This may be caused if for some reason Terraform is unable to reach the
plugin repository. The repository may be unreachable if access is blocked
by a firewall.

If automatic installation is not possible or desirable in your environment,
you may alternatively manually install plugins by downloading a suitable
distribution package and placing the plugin's executable file in the
following directory:
    terraform.d/plugins/linux_amd64
�[0m�[0m
�[31m
�[1m�[31mError: �[0m�[0m�[1mmkdir /root/.terraform.d: permission denied�[0m

�[0m�[0m�[0m
[terragrunt] 2019/08/28 18:37:53 Hit multiple errors:
exit status 1

@lkysow
Copy link
Member

lkysow commented Oct 7, 2019

Ahh, if you're using custom workflows you'll probably have to set the environment variable yourself like we do for the built-in steps.

fmt.Sprintf("TF_PLUGIN_CACHE_DIR=%s", c.terraformPluginCacheDir),

@lkysow
Copy link
Member

lkysow commented Oct 29, 2019

I'm going to close this since it's been a while. If there's still an issue please comment and I can re-open.

@lkysow lkysow closed this as completed Oct 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested waiting-on-response Waiting for a response from the user
Projects
None yet
Development

No branches or pull requests

2 participants