-
Notifications
You must be signed in to change notification settings - Fork 9.9k
[IPL-7725] Updating Calls to the Remote HCP Terraform API to Retrieve All Workspace Variables #37241
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
base: main
Are you sure you want to change the base?
Conversation
go get github.com/hashicorp/[email protected]
… all variables accessible to a workspace. This should include: - variables declared in the workspace and not overwritten by organization / project varset variables - variables inherited from organization / project varsets and not overwritten by workspace variables Other changes: Adding mocks for new functions in go-tfe after version upgrade
@hashicorp/terraform-aws @hashicorp/tf-eco-hybrid-cloud @hashicorp/terraform-azure Can you all check whether these dependency updates look safe to you and/or test as needed? |
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.
This looks ok from my POV but I would defer to the Core Cloud team on the actual logic being changed here.
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.
LGTM 🚀
@iBrandyJackson and @katbyte : Can you folks, please help as well. |
Description
Original Problem
While doing a
terraform import
, it was observed that variables inherited from variable sets in HCP Terraform were notgetting resolved, which caused the No value for required variable error. Usually, in such cases, terraform would make
an API call to HCP Terraform (via go-tfe client) to retrieve the list of variables accessible to the workspace. However,
the HCP Terraform API failed to include inherited variables that were not overwritten by workspace variables, which led
to the error.
Proposed Solution
We updated the HCP Terraform API to include the following variables for a workspace:
The updated API was included in the latest version (v1.83.0) of the go-tfe client, and this PR updates the go-tfe client
version and updates the API calls in the
terraform import
command to use the new API.Note - the terraform
import
block does not face this issue since it is executed during a plan / apply run, andimporting variables from variable sets works as expected.
Testing
terraform import
on a workspace with inherited variables from variablesets. Evidence attached below.
Documentation and External References
Target Release
1.13.x
Rollback Plan
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
NO
CHANGELOG entry
Testing Evidence