-
Notifications
You must be signed in to change notification settings - Fork 5
Fix remote var outputs #147
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
rmaynardap
wants to merge
16
commits into
ephur:master
Choose a base branch
from
affinipay:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INF-6284: Properly represent simple output types
Bumps [werkzeug](https://github.com/pallets/werkzeug) from 3.1.3 to 3.1.4. - [Release notes](https://github.com/pallets/werkzeug/releases) - [Changelog](https://github.com/pallets/werkzeug/blob/main/CHANGES.rst) - [Commits](pallets/werkzeug@3.1.3...3.1.4) --- updated-dependencies: - dependency-name: werkzeug dependency-version: 3.1.4 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.5.0 to 2.6.0. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](urllib3/urllib3@2.5.0...2.6.0) --- updated-dependencies: - dependency-name: urllib3 dependency-version: 2.6.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com>
This constant is no longer needed as we're simplifying the TF_REMOTE flow to use only direct backend.get_state() access, removing the terraform refresh/show cache mechanism entirely. Part of unified environment variable handling improvements.
Major changes: - Added _parse_tfvars_file() using python-hcl2 for proper type parsing - Refactored _populate_environment_with_terraform_variables() to use HCL2 parser - Updated _populate_environment_with_terraform_remote_vars() to add state caching - Rewrote get_state_item() to use only backend.get_state() with caching support - Deleted 10 helper functions (~300 lines): * _get_state_item_from_output (terraform output path) * _get_state_item_from_remote (complex wrapper) * _get_state_cache_name, _make_state_cache, _read_state_cache * _find_remote_state, _get_item_from_remote_state * _run_terraform_refresh, _run_terraform_show, _write_state_cache - Removed redundant TF_EXTRA preprocessing from _set_hook_env_var() - Updated type hints and docstrings Benefits: - Consistent format for all variable types (booleans → TRUE/FALSE, complex types → compact JSON) - Simplified TF_REMOTE flow using only direct backend access - Performance: state cache prevents multiple S3 downloads for same state - More reliable: works with pre_init hooks and --limit flag - Easier to understand and extend
- Add tests for _parse_tfvars_file() function (HCL2 parsing, fallback, errors) - Add tests for simplified get_state_item() with backend.get_state() - Add tests for state caching mechanism - Add test for boolean handling in TF_VAR variables - Update test for _populate_environment_with_terraform_variables to use new parsing - Delete obsolete tests for removed fallback functions Test coverage: 92% for hooks.py, all 502 tests passing
The function was incorrectly looking for terraform_remote_state resources
within the state file's resources section. When backend.get_state() is
called, it returns the raw Terraform state file which has outputs at the
top level, not nested under values.root_module.resources.
Changes:
- Simplified get_state_item() to read from top-level outputs section
- Updated tests to use actual state file format from backend.get_state()
- This fixes the "Remote state resource not found" error
The correct flow is now:
1. backend.get_state(state_name) returns the state file
2. Extract from state_data["outputs"][item_name]
3. Return the output in Terraform format: {"value": ..., "type": ...}
…ndling to dedicated method
…setting INF-6707: Hook environment variable improvements (consistency, speed & reduced complexity)
Bump werkzeug from 3.1.3 to 3.1.4
Bump urllib3 from 2.5.0 to 2.6.0
INF-6706: Update poetry lockfile
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The remote vars were still not being output as expected, even though it was valid JSON it is supposed to only output the "data" part, it was still outputting the entire results from the terraform output show command which is contrary to the expected design.