Skip to content

Conversation

@DaviPtrs
Copy link

@DaviPtrs DaviPtrs commented Jul 12, 2025

SUMMARY

I have a use case where a single Terraform configuration manages multiple environments sharing the same modules, but for the Ansible part I would like to have separate inventory files.

I thought about a feature where I can choose which modules I want to fetch the ansible_host and ansible_group resources from, instead of only choosing between root + child modules or just root modules.

So I added both include_modules and exclude_modules directives to the terraform provider inventory plugin.

ISSUE TYPE
  • Feature Pull Request
ADDITIONAL INFORMATION

This is the basic usage:

plugin: cloud.terraform.terraform_provider
project_path: some/project/path
include_modules:
  - production

or

plugin: cloud.terraform.terraform_provider
project_path: some/project/path
exclude_modules:
  - development
  • include_modules and exclude_modules are mutually exclusive
  • if you set search_child_modules: false, the module filtering directives are ignored

@DaviPtrs
Copy link
Author

the command to generate docs is not working properly btw

ansible-doc --list | grep cloud.terraform | cut -d " " -f 1 | xargs -I {} antsibull-docs plugin --dest-dir docs/ {}
image

@softwarefactory-project-zuul
Copy link

@DaviPtrs
Copy link
Author

Hey guys, can you take a look at this? It was very useful to me, I think it's worth checking @beeankha @gravesm @abikouo

@codecov
Copy link

codecov bot commented Jul 28, 2025

Codecov Report

❌ Patch coverage is 98.68421% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.99%. Comparing base (8c52bf2) to head (6f47f24).
⚠️ Report is 37 commits behind head on main.

Files with missing lines Patch % Lines
plugins/inventory/terraform_provider.py 94.28% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #204       +/-   ##
===========================================
+ Coverage   73.00%   83.99%   +10.98%     
===========================================
  Files          16       23        +7     
  Lines        1015     1818      +803     
  Branches      182      329      +147     
===========================================
+ Hits          741     1527      +786     
- Misses        243      244        +1     
- Partials       31       47       +16     
Flag Coverage Δ
sanity ?
units 83.99% <98.68%> (+11.38%) ⬆️

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.

@softwarefactory-project-zuul
Copy link

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.

1 participant