-
Notifications
You must be signed in to change notification settings - Fork 2
chore: improve check tofu to be more self-contained #69
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
base: main
Are you sure you want to change the base?
Conversation
|
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" |
There was a problem hiding this comment.
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.
| local start_time | ||
| start_time=$(date +%s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| local start_time | |
| start_time=$(date +%s) | |
| local start_time=$(date +%s) |
| local end_time | ||
| end_time=$(date +%s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| local end_time | |
| end_time=$(date +%s) | |
| local end_time=$(date +%s) |
| export TF_PLUGIN_CACHE_DIR="$TF_PLUGIN_CACHE_DIR" | ||
| } | ||
|
|
||
| function check_binary() { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
Summary
This PR makes a few updates to the
check-tofuaction, 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