Add GitLab Terraform state provider support (tfstategitlab) #767
+154
−0
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.
This PR adds support for reading Terraform state from GitLab's Terraform state API, addressing the limitation where
ref+tfstateremoteonly works with Terraform Cloud/Enterprise but not with GitLab.Problem
Users with Terraform state stored in GitLab cannot use vals to read state values. The existing
tfstateremoteprovider only supports Terraform Cloud/Enterprise API endpoints, not GitLab's Terraform state API which uses different authentication and URL patterns.For example, this command works with tfstate-lookup but fails with vals:
Solution
Added a new
tfstategitlabprovider that:ref+tfstategitlab://gitlab.com/api/v4/projects/PROJECT_ID/terraform/state/STATE_NAME/RESOURCE_NAMEGITLAB_TOKENenvironment variable (GitLab private token)TFE_TOKENenvironment variable (for Terraform Enterprise workflow compatibility)TFE_USER+TFE_TOKENfor HTTP basic authentication/api/v4/projects/.../terraform/state/endpointsUsage Examples
Implementation Details
Fixes #661.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com./bin/vals eval -f -(dns block)gitlab.com./bin/vals eval -f -(dns block)httpbin.org./bin/vals eval -f -(dns block)my-gitlab.com./bin/vals eval -f -(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.