hashicorp / terraform-cdk

Define infrastructure resources using programming constructs and provision them using HashiCorp Terraform
https://www.terraform.io/cdktf
Mozilla Public License 2.0
4.8k stars 443 forks source link

Human error-prone CLI #1811

Open nikolay opened 2 years ago

nikolay commented 2 years ago

Community Note

Description

The visual difference between deploy and destroy is minimal. Also, both are prone to an autocomplete devastating mistakes. Please, consider deprecating deploy in favor of provision or something different. This problem does not exist with apply and destroy! No to mention that diff also starts with a D.

DanielMSchmidt commented 2 years ago

You can use apply instead of deploy, but we need to keep deploy to stay compliant with the AWS cdk

nikolay commented 2 years ago

@DanielMSchmidt Sorry, didn't see the aliases on the far right. I'm not sure why they have to be kept when it's a totally different CLI, which is targeting only Terraform. In fact, deploy and destroy can be aliases only in the presence of an environment flag, for example. CDKTF can do irreversible damage unlike the typical CDK use cases!

DanielMSchmidt commented 2 years ago

They don't have to be in sync, but there are a lot of folks coming from the AWS CDK so we want to make their transitions as easy as possible.

nikolay commented 2 years ago

@DanielMSchmidt It's hard to quantify, but a lot of people who use CDK are simply Terraform users, who are missing the dynamic provider capability of Terraform proper and are faced with the difficult choice to either use Terragrunt, or implement some templating, or use Terraform CDK. Given Terraform Cloud users can't use Terragrunt nicely, I picked CDKTF. And thanks to autocomplete, I've accidentally destroyed a test stack.

DanielMSchmidt commented 2 years ago

I'm sorry that happened to you! I definitely agree, a lot of folks come from Terraform, even more than from the AWS CDK would be my guess. That is why these commands exist both as apply/deploy & plan/diff. Not having the deploy alias for apply would certainly lead to folks being annoyed with CDKTF since apply is weird for them. It's a weird spot for both user groups and allowing both is the best trade-off we can do.

Another thing is, we don't want to second guess our users, which is why if you supply an --auto-approve flag we won't ask again before running the command.