-
Notifications
You must be signed in to change notification settings - Fork 113
Separate the two clients (TFE & Http) #145
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
Conversation
mayank-sisodiya
left a comment
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.
Should we update the packaging of the tools as well for registry & tfe tools?
Example tools/registry/get_latest_provider_version.go & tools/terraform/list_orgs.
On second thought, let's address that in a later PR when list becomes longer |
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.
Pull Request Overview
This PR separates the previously combined TFE (Terraform Enterprise/Cloud) and HTTP clients into distinct, independently managed clients. The refactor improves client management by creating separate client types with their own lifecycle management and context retrieval methods.
Key changes:
- Split the monolithic
terraformClientsstruct into separate TFE and HTTP client management - Created dedicated client files (
tfe_client.go,registry_client.go,session.go) with independent storage and retrieval - Updated all tool handlers to use the appropriate client type based on their functionality
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/utils/utils.go | Added utility function for environment variable retrieval |
| pkg/client/client.go | Removed monolithic client structure - replaced by separate client files |
| pkg/client/tfe_client.go | New file implementing TFE client management and context retrieval |
| pkg/client/registry_client.go | New file implementing HTTP client management for registry operations |
| pkg/client/session.go | New file handling session lifecycle for both client types |
| pkg/client/common.go | Added shared utility function for TLS verification parsing |
| pkg/client/middleware.go | Updated to use the new utility function location |
| pkg/tools/*.go | Updated all tool handlers to use appropriate client retrieval methods |
| pkg/resources/*.go | Updated resource handlers to use HTTP client retrieval |
| pkg/tools/dynamic_tool.go | Updated to use direct TFE client retrieval |
| CHANGELOG.md | Added reference to this PR |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Reminder to the contributor that merged this PR: if your changes have added important functionality or fixed a relevant bug, open a follow-up PR to update CHANGELOG.md with a note on your changes. |
PCI review checklist
I have documented a clear reason for, and description of, the change I am making.
If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.
If applicable, I've documented the impact of any changes to security controls.
Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.