Skip to content

Commit 68043bf

Browse files
authored
Merge pull request #2 from cisagov/bugfix/resolve_terraform_issues
Update GitHub Actions Steps for Terraform Installation and Initialization
2 parents a6bdc81 + e16a05c commit 68043bf

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

.github/workflows/build.yml

+10-7
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ jobs:
4141
uses: actions/cache@v2
4242
with:
4343
# 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.
4849
path: |
4950
${{ env.PIP_CACHE_DIR }}
5051
${{ env.PRE_COMMIT_CACHE_DIR }}
@@ -73,14 +74,16 @@ jobs:
7374
sudo unzip -d /opt/terraform \
7475
${{ env.CURL_CACHE_DIR }}/"${TERRAFORM_ZIP}"
7576
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
7679
- name: Install Terraform-docs
7780
run: GO111MODULE=on go get github.com/segmentio/terraform-docs
7881
- name: Find and initialize Terraform directories
7982
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 \
8285
echo "Initializing '$path'..."; \
83-
terraform init -upgrade=true -input=false -backend=false "$path"; \
86+
terraform init -input=false -backend=false "$path"; \
8487
done
8588
- name: Install dependencies
8689
run: |

meta/main.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
---
22
galaxy_info:
33
author: First Last
4-
description: Skeleton Ansible role
4+
description: Skeleton Ansible role with test user
55
company: CISA Cyber Assessments
6+
galaxy_tags:
7+
- skeleton
68
license: CC0
79
min_ansible_version: 2.0
810
platforms:
@@ -25,7 +27,6 @@ galaxy_info:
2527
versions:
2628
- bionic
2729
- xenial
28-
galaxy_tags:
29-
- skeleton
30+
role_name: skeleton_with_test_user
3031

3132
dependencies: []

0 commit comments

Comments
 (0)