Skip to content

Conversation

@krisrjohnson21
Copy link
Contributor

@krisrjohnson21 krisrjohnson21 commented Jan 1, 2026

Summary

This PR makes a few updates to the check-tofu action, as recommended by @ianwestcott.

I tested this successfully in a workflow run here

Asana task: https://app.asana.com/1/15492006741476/project/1113545750913664/task/1212628693483355?focus=true

@krisrjohnson21 krisrjohnson21 requested a review from a team as a code owner January 1, 2026 00:46
@krisrjohnson21
Copy link
Contributor Author

I also ran a multi-directory test successfully here

# Setup Cache Directory
if [[ ! -d "$TF_PLUGIN_CACHE_DIR" ]]; then
echo "Creating Tofu plugin cache directory at $TF_PLUGIN_CACHE_DIR"
mkdir -p "$TF_PLUGIN_CACHE_DIR"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: mkdir -p already works like this (not erroring if the directory already exists) so you don't need to wrap it in an existence check.

Comment on lines +91 to 92
local start_time
start_time=$(date +%s)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local start_time
start_time=$(date +%s)
local start_time=$(date +%s)

Comment on lines +111 to 112
local end_time
end_time=$(date +%s)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local end_time
end_time=$(date +%s)
local end_time=$(date +%s)

export TF_PLUGIN_CACHE_DIR="$TF_PLUGIN_CACHE_DIR"
}

function check_binary() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: can you say more about the situation where this is needed?

run_module_checks "${tf_dir}";
done < <(get_terraform_root_modules)
# If CHANGED_DIRS env var is set (from CI), use it, otherwise scan all
if [[ -n "$CHANGED_DIRS" ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: this looks like it's another way to run a specific set of checks. is there a way to pass $CHANGED_DIRS as the arguments to this script rather than special-casing it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants