无法在Terraform中执行目标删除

无法在Terraform中执行目标删除,terraform,terraform-provider-gcp,Terraform,Terraform Provider Gcp,我的main.tf中有以下资源,我正试图删除它。资源存在于terraform.tfstate文件中 module "sql_instance_01" { source = "../../modules/sql-instance" name = "tf-test-mysql-1" project = "proj-test" } 我尝试使用的资源是- resource "google_sql_database_instance" "mysql_instance" 但是,当我运行ta

我的
main.tf
中有以下资源,我正试图删除它。资源存在于
terraform.tfstate
文件中

module "sql_instance_01" {
  source = "../../modules/sql-instance"

  name = "tf-test-mysql-1"
  project = "proj-test"
}
我尝试使用的资源是-

resource "google_sql_database_instance" "mysql_instance"
但是,当我运行targeted destroy时,它不起作用。尝试了多种排列和组合-

$ terraform plan -destroy -target google_sql_database_instance.sql_instance_01
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.


------------------------------------------------------------------------

No changes. Infrastructure is up-to-date.


我调用destroy是否有误?还是我在这里遗漏了什么

您需要指定资源的完整路径。使用
地形状态列表中显示的任何东西作为所需资源的路径。完美!成功了。谢谢
$ terraform plan -destroy -target google_sql_database_instance.tf-test-mysql-1
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.


------------------------------------------------------------------------

No changes. Infrastructure is up-to-date.

$ terraform plan -destroy -target sql_instance_01.tf-test-mysql-1
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.


------------------------------------------------------------------------

No changes. Infrastructure is up-to-date.

$ terraform plan -destroy -target mysql_instance.tf-test-mysql-1
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.


------------------------------------------------------------------------

No changes. Infrastructure is up-to-date.