2019年1月29日 星期二

DevOps Tip - How to use shared terraform plugins by -plugin-dir argument?


Problem


If you executed `terraform init`, you may already have the .terraform in your folder.


Because you may have many terraform repo similar to another, you can use the -plugin-dir to reduce the usage of disk space.

As a shared plugins so that we don’t need many copies of plugins into different locations.

Example

  • Here I used my OSX Macbook as a Demo Environment.
  ====================
  cd /build/setupdev/
    sudo mkdir -p  /opt/terraform/terraform.d
mv .terraform/plugins to /opt/terraform/terraform.d/plugins


  • Please run the following command to apply it.
  ====================
terraform init -input=false \
-plugin-dir=/opt/terraform/terraform.d/plugins/darwin_amd64





Tree of .terraform

Tree of terraform plugins

Reference

沒有留言: