Use-cases
Need to fetch the nocode module and version used to provision the workspace.
It is displayed in the TFE/TFC web gui on the workspace as:
"Module:" private/myorg/my-mod/aws/1.5.0
This value is available as "source-module-id" & displayed when you curl the api like so:
curl --header "Authorization: Bearer $TFE_TOKEN" --header "Content-Type: application/vnd.api+json" $TFE_ADDRESS/api/v2/organizations/myorg/workspaces/my-workspace
Output from raw api:
{
"data": {
"id": "ws-asdfasdfasdf",
"type": "workspaces",
"attributes": {
// ....
"source": "tfe-module",
"source-name": null,
"source-url": null,
"source-module-id": "private/myorg/my-mod/aws/1.5.0",
"no-code-upgrade-available": false,
// ....
But it's not available on the Workspace struct:
https://pkg.go.dev/github.com/hashicorp/go-tfe#Workspace
Is there another way to get this value for a nocode provisioned workspace via go-tfe?
If not, can this be made available on the Workspace struct?
Proposal
Make SourceModuleId
available on the Workspace struct.