hashicorp-community / tf-helper

Commands for performing operations on Terraform states, configurations, TFE using the API, and more. Please target all PRs to the master branch, not the release branch.
Mozilla Public License 2.0
102 stars 32 forks source link

update workspace to configure the vcs repo getting "765: unexpected token" #17

Closed jennihan closed 5 years ago

jennihan commented 5 years ago

Tried to run the command "tfh workspace update -name fabric2 -vcs-id test/fabric -oauth-id "ot-QAn654UeHQocidjs" to configure the vcs for the workspace, getting below error:

[ERROR] API request failed. HTTP status code: 400 JSON-API details: detail: 765: unexpected token at '{ "data": { "attributes": { "vcs-repo" { "identifier": "test/fabric", "oauth-token-id": "ot-QAn654UeHQocidjs"} }, "type": "workspaces" }}' status: 400 title: JSON body is invalid

fprimex commented 5 years ago

Hi,

This line:

https://github.com/hashicorp-community/tf-helper/blob/release/tfh/lib/tfh/cmd/tfh_workspace_update.sh#L111

Should have a : I think. So:

    attr_obj="$attr_obj \"vcs-repo\": {$vcs_obj}"

Would you be able to make this change and see if it works for you?

jennihan commented 5 years ago

Thanks, it works.