API to interact with terraform cli
See original GitHub issueCommunity 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
Description
It would be very useful to have an API to interact with terraform cli (not cloud) from cdk.
Example below:
app = App()
MyStack(app, "automate-everything")
synth = app.synth()
plan = app.plan(synth)
if plan.changes is not None:
if len(plan.changes.module.custom.fruits) > 4:
app.apply(synth, target='module.custom.fruits')
References
Issue Analytics
- State:
- Created 3 years ago
- Reactions:66
- Comments:14 (5 by maintainers)
Top Results From Across the Web
API-driven Runs - Terraform Cloud - HashiCorp Developer
The CLI-driven run workflow, which uses Terraform's standard CLI tools to execute runs in Terraform Cloud. Summary. In the API-driven workflow, workspaces areĀ ......
Read more >Provisioning Resources using Terraform Cloud with an API ...
Terraform Cloud enables provisioning of resources using a VCS driven workflow, a CLI driven workflow as well as an API driven workflow.
Read more >Docs overview | hashicorp/tfe - Terraform Registry
This provider is used to interact with the many resources supported by Terraform Cloud. As Terraform Enterprise is a self-hosted distribution of Terraform...
Read more >CLI-driven Runs - Terraform Enterprise
The UI/VCS-driven run workflow, which is TFE's primary mode of operation. Ā· The API-driven run workflow, which is more flexible but requires you...
Read more >Create a Terraform Cloud Workspace
Similar to how a cloud provider configuration requires a token to interact with the provider, the Fake Web Services provider requires a Terraform...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Was playing around with this a bit. While it requires the usage of JS / Typescript, itās sort of possible to drive synth and deploy / destroy bypassing the full
cdktf-cli
workflow. Itās a bit clunky, but works. Please be aware, that this is using internal APIs of thecdktf-cli
which might break without prior warning.deploy
destroy
Iām using this right now for driving automated test setups / teardowns. Since this skips generating the plan and is running headless, itās also a bit faster compared to using the
cdktf-cli
directly.Thanks for these examples @skorfmann! This is my new favorite way to use CDKTF. Iād love to see a more formal APIā¦
A few things from my experience that would help thisā¦
Looking forward to seeing this evolve. This is the most excited Iāve been about IaC in a while.