8000 Warn on specific TF Environment Variables by milldr · Pull Request #1206 · cloudposse/atmos · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Warn on specific TF Environment Variables #1206

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

Merged
merged 3 commits into from
Apr 19, 2025
Merged

Conversation

milldr
Copy link
Member
@milldr milldr commented Apr 18, 2025

what

  • Only warn on these environment variables:
"TF_CLI_ARGS"
"TF_VAR_"
"TF_CLI_ARGS_"
"TF_WORKSPACE"
  • Deleted duplicated warning on atmos terraform shell

why

  • Previously we warned on all TF_* environment variables as requested. This is far too noisy and unnecessary for the majority of use cases.
  • Inspired by terraform-exec, we're going to adopt similar convention.

references

No warning

CleanShot 2025-04-18 at 14 27 51@2x

Warning with 1 input

CleanShot 2025-04-18 at 14 28 30@2x

Warning with 2 inputs

CleanShot 2025-04-18 at 14 28 48@2x

Summary by CodeRabbit

  • Bug Fixes
    • Improved detection of environment variables that may interfere with Terraform by warning only on specific prefixes, reducing unnecessary warnings.
    • Enhanced warning messages with clearer, structured logging for easier troubleshooting.

@milldr milldr requested a review from a team as a code owner April 18, 2025 17:54
Copy link
Contributor
coderabbitai bot commented Apr 18, 2025
📝 Walkthrough

Walkthrough

The changes update logging in the shell utilities and Terraform execution code. Custom warning logs are replaced with structured logging using the charmbracelet/log package. The logic for detecting potentially conflicting Terraform environment variables is narrowed to specific prefixes and exact names instead of any variable beginning with "TF_". No exported or public API signatures are changed.

Changes

File(s) Change Summary
internal/exec/shell_utils.go Replaces custom warnings with log.Warn calls in deferred function; removes broad TF_ env var warnings.
internal/exec/terraform.go Narrows env var conflict detection to specific prefixes and exact names; switches to structured log.Warn.

Possibly related PRs

Suggested labels

patch

Suggested reviewers

  • osterman

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f3713c0 and e931469.

📒 Files selected for processing (2)
  • internal/exec/shell_utils.go (3 hunks)
  • internal/exec/terraform.go (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • internal/exec/shell_utils.go
  • internal/exec/terraform.go
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Summary

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the fi 8000 les again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or @auto-summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @auto-title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 18, 2025
@milldr milldr added the minor New features that do not break anything label Apr 18, 2025
Copy link
codecov bot commented Apr 18, 2025

Codecov Report

Attention: Patch coverage is 55.55556% with 12 lines in your changes missing coverage. Please review.

Project coverage is 30.23%. Comparing base (a62050b) to head (e931469).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/exec/terraform.go 60.00% 7 Missing and 3 partials ⚠️
internal/exec/shell_utils.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1206      +/-   ##
==========================================
+ Coverage   30.18%   30.23%   +0.04%     
==========================================
  Files         204      204              
  Lines       22843    22858      +15     
==========================================
+ Hits         6896     6911      +15     
+ Misses      14910    14908       -2     
- Partials     1037     1039       +2     
Flag Coverage Δ
unittests 30.23% <55.55%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aknysh aknysh added no-release Do not create a new release (wait for additional code changes) and removed minor New features that do not break anything labels Apr 19, 2025
@aknysh aknysh merged commit 29577d8 into main Apr 19, 2025
62 checks passed
@aknysh aknysh deleted the chore/tf_env_warnings branch April 19, 2025 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-release Do not create a new release (wait for additional code changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0