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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support HTTP_PROXY/HTTPS_PROXY for Terraform Cloud #816

Closed
amod-kadam-avq opened this issue Jul 1, 2021 · 12 comments · Fixed by #1507
Closed

Support HTTP_PROXY/HTTPS_PROXY for Terraform Cloud #816

amod-kadam-avq opened this issue Jul 1, 2021 · 12 comments · Fixed by #1507
Assignees
Labels
cdktf-cli enhancement New feature or request priority/important-soon High priority, to be worked on as part of our current release or the following one. size/medium estimated < 1 week
Milestone

Comments

@amod-kadam-avq
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.4.1
typescript (node - 14.7.1)

Affected Resource(s)

Unable to create project with Terraform Cloud as a backend.

Debug Output

Expected Behavior

cdktf should create the project and configure backened to be Terraform Cloud.

Actual Behavior

Unable to setup Terraform Cloud for the project

Following error is thrown
image

Steps to Reproduce

  1. Ensure proxy is setup and environment variables are pointing to PROXY settings.
HTTP_PROXY
HTTPS_PROXY
  1. Create a directory e.g. test-cdktf and run following command from directory
    cdktf init --template="typescript"
    cdktf will try to create the project and prompts for connecting to Terraform Cloud and Token subsequently.
  2. Provide the token

Important Factoids

References

@amod-kadam-avq amod-kadam-avq added bug Something isn't working new Un-triaged issue labels Jul 1, 2021
@skorfmann
Copy link
Contributor

Had a quick look, the builtin https request library of node which we're using is not and won't respect the ENV - see here for details nodejs/node#8381

This leaves two options:

  • built custom handing for these envs
  • swap the builtin https library for some higher level abstraction

@skorfmann skorfmann added cdktf-cli and removed new Un-triaged issue labels Jul 1, 2021
@danieldreier danieldreier added this to the 0.6 milestone Jul 1, 2021
@greenstevester
Copy link

As a possible workaround, could we add a the same “decorator” functionality as https://github.com/Rob--W/proxy-from-env into https://github.com/hashicorp/terraform-cdk to respect the ENV vars?

@danieldreier danieldreier added the priority/important-soon High priority, to be worked on as part of our current release or the following one. label Jul 2, 2021
@danieldreier danieldreier changed the title Unable to connect to Terraform Cloud with CDKTF Support HTTP_PROXY/HTTPS_PROXY for Terraform Cloud Jul 2, 2021
@danieldreier danieldreier added enhancement New feature or request and removed bug Something isn't working labels Jul 2, 2021
@danieldreier
Copy link
Contributor

@amod-kadam-avq I've switched this from a bug to an enhancement request and renamed it to show what the underlying improvement needed is. It's tentatively planned for the 0.6 release. Thank you for reporting this!

@danieldreier
Copy link
Contributor

danieldreier commented Jul 2, 2021

@greenstevester given that we're planning on starting work on this in approximately 4-6 weeks I don't think we'll do any interim workarounds before then

@skorfmann
Copy link
Contributor

@greenstevester since this seems to be an issue when Terraform Cloud is involved during init, would cdktf init --template typescript --local work for you? This would skip the Terraform Cloud step entirely.

@greenstevester
Copy link

@skorfmann - cdktf init --template typescript --local does work for me. I am not clear tho on how a synth and deploy would then work with our terraform cloud instance?

@skorfmann
Copy link
Contributor

@skorfmann - cdktf init --template typescript --local does work for me. I am not clear tho on how a synth and deploy would then work with our terraform cloud instance?

I was hoping that this wouldn't be an issue, since that's using another library - However, looking at this issue, it seems to be a similar story. That's where the the request is created in the Terraform Cloud library.

Which leaves you the option, to just use the cdktf synth command and leave the rest to the Terraform CLI for now.

For reference: NPM itself will respect the proxy settings.

@greenstevester
Copy link

@skorfmann - how then via cdktf synth can we instruct to push the generated stack to terraform cloud since, without the --local it will send a cloud token, which is then stored in .terraform.d\credentials.tfrc.json ?

@skorfmann
Copy link
Contributor

@skorfmann - how then via cdktf synth can we instruct to push the generated stack to terraform cloud since, without the --local it will send a cloud token, which is then stored in .terraform.d\credentials.tfrc.json ?

What the cdktf init cloud workflow is doing:

Both can be done manually. If the remote backend was added to the stack it's gonna by synthesized correctly and the Terraform CLI should pick up whatever you configured there. Does this answer you question, or did I miss anything?

@greenstevester
Copy link

@skorfmann - great thanks, this is what I was missing.

@danieldreier
Copy link
Contributor

Quick update - this isn't going to make it into CDK for Terraform 0.6. I still see it as a high priority and am hoping to get it addressed in a release in the near future.

@phinze phinze modified the milestones: 0.7, 0.8 (in planning) Oct 14, 2021
@DanielMSchmidt DanielMSchmidt added the size/medium estimated < 1 week label Nov 29, 2021
@ansgarm ansgarm removed this from the 0.9 milestone Jan 26, 2022
@github-actions
Copy link
Contributor

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 Nov 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cdktf-cli enhancement New feature or request priority/important-soon High priority, to be worked on as part of our current release or the following one. size/medium estimated < 1 week
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants