Skip to content

AAP-46677-updated-terraform.py #194

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

Open
wants to merge 40 commits into
base: main
Choose a base branch
from

Conversation

shvenkat-rh
Copy link

@shvenkat-rh shvenkat-rh commented Jun 19, 2025

SUMMARY

Please refer to https://issues.redhat.com/browse/AAP-46677.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

terraform.py

ADDITIONAL INFORMATION

f the workspace is given in the playbook - Then use that version
if there is a mismatch between the playbook and the one in the cloud config then an error would likely occur
If the workspace is not given and cloud block is present - Then use workspace from cloud block version
If the workspace is not given and cloud block is not used - Then use CLI version (existing logic).

Also I have added a TF file parser which removes comments from the TF file.

Copy link

codecov bot commented Jun 19, 2025

Codecov Report

Attention: Patch coverage is 73.28767% with 39 lines in your changes missing coverage. Please review.

Project coverage is 80.77%. Comparing base (8c52bf2) to head (578b3a5).
Report is 34 commits behind head on main.

Files with missing lines Patch % Lines
plugins/modules/terraform.py 59.79% 36 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #194      +/-   ##
==========================================
+ Coverage   73.00%   80.77%   +7.76%     
==========================================
  Files          16       23       +7     
  Lines        1015     1737     +722     
  Branches      182      343     +161     
==========================================
+ Hits          741     1403     +662     
- Misses        243      289      +46     
- Partials       31       45      +14     
Flag Coverage Δ
sanity ?
units 80.77% <73.28%> (+8.16%) ⬆️

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.

Copy link

Copy link

Copy link

Copy link

@shvenkat-rh shvenkat-rh self-assigned this Jun 19, 2025
Copy link

Copy link

Copy link

Copy link

Copy link

Copy link

Copy link

@shvenkat-rh shvenkat-rh marked this pull request as ready for review June 24, 2025 10:33
Copy link

Copy link

Copy link

Copy link

Copy link

Copy link

Copy link

Copy link
Member

@gravesm gravesm left a comment

Choose a reason for hiding this comment

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

I have a lot of concerns about this PR. The parsing logic currently does not account for:

  • nested blocks
  • jsonencode
  • heredoc syntax
  • workspace tags
  • terraform config written in json

In addition, we're opening and reading every file in the directory and then looping over every single character in every one of those files, and that's being done every time this module is used.

Can we not just use workspace list to figure out what workspace terraform thinks is configured? I'm not clear on what problem this PR is trying to solve.

Copy link

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

Successfully merging this pull request may close these issues.

5 participants