You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Terraform v1.3.1执行destroy -force报错:flag未定义求助

Terraform destroy命令-force参数报错解决办法

在使用Terraform v1.3.1执行Kubernetes资源销毁时,运行命令:

terraform destroy -force

出现如下错误:

Error: Failed to parse command-line flags
flag provided but not defined: -force
For more help on using this command, run:
terraform destroy -help

本地环境版本信息:

terraform -version

Terraform v1.3.1
on linux_amd64
+ provider registry.terraform.io/hashicorp/helm v2.7.0

解决办法

Terraform从v0.15.0版本起,destroy命令的-force参数已被移除,取而代之的是-auto-approve参数——该参数会跳过交互式确认步骤,直接执行销毁操作,功能与原-force完全一致。

正确的销毁命令应为:

terraform destroy -auto-approve

内容的提问来源于stack exchange,提问作者Naveen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.17 09:20:31