@@ -41,10 +41,11 @@ jobs:
41
41
uses : actions/cache@v2
42
42
with :
43
43
# Note that the .terraform directory IS NOT included in the
44
- # cache because we use the -upgrade=true option when we run
45
- # terraform below. That option pulls down the latest
46
- # modules and providers no matter what, so there is no point
47
- # in caching the .terraform directory.
44
+ # cache because if we were caching, then we would need to use
45
+ # the `-upgrade=true` option. This option blindly pulls down the
46
+ # latest modules and providers instead of checking to see if an
47
+ # update is required. That behavior defeats the benefits of caching.
48
+ # so there is no point in doing it for the .terraform directory.
48
49
path : |
49
50
${{ env.PIP_CACHE_DIR }}
50
51
${{ env.PRE_COMMIT_CACHE_DIR }}
@@ -73,14 +74,16 @@ jobs:
73
74
sudo unzip -d /opt/terraform \
74
75
${{ env.CURL_CACHE_DIR }}/"${TERRAFORM_ZIP}"
75
76
sudo ln -s /opt/terraform/terraform /usr/bin/terraform
77
+ sudo mv /usr/local/bin/terraform /usr/local/bin/terraform-default
78
+ sudo ln -s /opt/terraform/terraform /usr/local/bin/terraform
76
79
- name : Install Terraform-docs
77
80
run : GO111MODULE=on go get github.com/segmentio/terraform-docs
78
81
- name : Find and initialize Terraform directories
79
82
run : |
80
- for path in $(find . -type f -iname "*.tf " -exec dirname "{}" \; \
81
- | sort -u); do \
83
+ for path in $(find . -not \( - type d -name ".terraform " -prune \) \
84
+ -type f -iname "*.tf" -exec dirname "{}" \; | sort -u); do \
82
85
echo "Initializing '$path'..."; \
83
- terraform init -upgrade=true - input=false -backend=false "$path"; \
86
+ terraform init -input=false -backend=false "$path"; \
84
87
done
85
88
- name : Install dependencies
86
89
run : |
0 commit comments