如何在 Terraform 中按名称应用我的资源之一?

How can I apply one of my resources by name in Terraform?

Terraform 将尝试部署在 Terraform 配置文件中定义的所有资源。我的应用程序中有很多资源,例如lmabdaapi gatewayECS等。我想知道是否可以指定只部署一个资源。比如我只想部署一个lambda,不想申请其他资源。我怎样才能在 Terraform 中制作它?

terraform apply -target=aws_lambda_function.test_function

有关 -target 用法的更多信息,请参阅 terraform apply documentation