如何在 main.tf 中执行一个 Terraform 模块
How to execute one Terraform module in main.tf
我在 main.tf 文件中使用 Terraform 模块。不同的模块引用不同的资源,示例如下:
module "cci-api" {
source = "../../modules/app-service-general"
suffix = var.suffix
location = var.location
}
module "fmc-api" {
source = "../../modules/app-service-fmc"
suffix = var.suffix
location = var.location
}
如何只运行 cci-api 模块?或者换句话说,我如何才能只在云端部署 cci-api?
为 plan/apply 使用 -target
标记,查看有关 here 的更多信息。在你的情况下它将是:
terraform apply -target="module.cci-api"
我在 main.tf 文件中使用 Terraform 模块。不同的模块引用不同的资源,示例如下:
module "cci-api" {
source = "../../modules/app-service-general"
suffix = var.suffix
location = var.location
}
module "fmc-api" {
source = "../../modules/app-service-fmc"
suffix = var.suffix
location = var.location
}
如何只运行 cci-api 模块?或者换句话说,我如何才能只在云端部署 cci-api?
为 plan/apply 使用 -target
标记,查看有关 here 的更多信息。在你的情况下它将是:
terraform apply -target="module.cci-api"