Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

cdktf init - Error: Unprocessable Entity when selecting an existing empty workspace #400

Closed
mindlapse opened this issue Oct 4, 2020 · 5 comments
Labels
bug Something isn't working cdktf-cli good first issue Good for newcomers terraform cloud
Milestone

Comments

@mindlapse
Copy link

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

cdktf & Language Versions

cdktf 0.0.17

Affected Resource(s)

ctktf init

Debug Output

Error: Unprocessable Entity

Expected Behavior

I created a new workspace in Terraform Cloud, then tried to use it with cdktf init, but if failed with Error: Unprocessable Entity. The error does not occur if the workspace does not already exist. My expectation is that since I am asking to use a brand new workspace, it should be possible to use it without error.

Actual Behavior

See the above Gist

Steps to Reproduce

  • Create a workspace in Terraform Cloud
  • cdktf init
  • When it prompts with Terraform Cloud Workspace Name: (default: 'typescript'), then enter the name of the workspace that was just created
  • Observe the Error: Unprocessable Entity error

Important Factoids

References

  • #0000
@mindlapse mindlapse added the bug Something isn't working label Oct 4, 2020
@skorfmann
Copy link
Contributor

skorfmann commented Oct 5, 2020

There will be some focused work around the Terraform Cloud integration. I think we'll tackle this then.

@gvasquez95
Copy link

Same here:

Error: Unprocessable Entity
    at ClientRequest.<anonymous> (/usr/local/lib/node_modules/cdktf-cli/bin/cmds/helper/terraform-cloud-client.js:37:31)
    at Object.onceWrapper (events.js:421:26)
    at ClientRequest.emit (events.js:314:20)
    at HTTPParser.parserOnIncomingClient (_http_client.js:640:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
    at TLSSocket.socketOnData (_http_client.js:509:22)
    at TLSSocket.emit (events.js:314:20)
    at addChunk (_stream_readable.js:307:12)
    at readableAddChunk (_stream_readable.js:282:9)
    at TLSSocket.Readable.push (_stream_readable.js:221:10)

Using:

cdktf --version
0.0.17

Adding --local flag works, but offline :(

@skorfmann skorfmann added this to the 0.2 milestone Jan 27, 2021
@danieldreier danieldreier added this to To do in CDK for Terraform Roadmap via automation Jan 27, 2021
@AdminTurnedDevOps
Copy link

I echo this for Python. If I try running cdktf init --template=python for the app to be in TF cloud, I get this exact error. If I throw the local flag (cdktf init --template=python --local), it works just fine.

@hashicorp-cloud Any ETA on when this will be resolved?

@danieldreier danieldreier modified the milestones: 0.2, 0.3 Mar 16, 2021
@danieldreier danieldreier added the good first issue Good for newcomers label Mar 16, 2021
@skorfmann
Copy link
Contributor

Yes, I see that the current behaviour is confusing. The cdktf init workflow will always create a new workspace within the chosen organization. Since there's no extensive error handling around this, it'll just error out without any meaningful message in case the remote workspace already exists.

To address this particular issue here, I'd suggest to adjust the wording for the cdktf init workflow to make it clear that it's gonna create a new workspace. In addition to that, the error handling in the terraform cloud client should print out actionable error messages. Here are the API docs, but there are no error responses for the create endpoint specified. So, we'll have to check what the error messages from the API will look like. Perhaps it's good enough to just relay that message.

In case of the 422 validation error, it would be good to handle it explicitly without erroring out, so that a user can change the name of the workspace to something non existent and continue within the dialog.

As a separate follow up story, I'd tackle the following:

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2022

I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working cdktf-cli good first issue Good for newcomers terraform cloud
Projects
No open projects
Development

No branches or pull requests

5 participants