如何執行 terraform azure 基礎架構程式碼來建立環境

如何執行 terraform azure 基礎架構程式碼來建立環境

目前,我正在從筆記型電腦上運行 terraform,這顯然不太理想:

module "eu_resource_group" {
  source                        = "./modules/resource_groups"

  resource_group_name           = var.resource_group_name
  resource_group_location       = var.location
}

module "vault" {
  source                        = "./modules/vault"

  resource_group_name           = module.eu_resource_group.eu_resource_group_name
  resource_group_location       = module.eu_resource_group.eu_resource_group_location
}

module "storage" {
  source                        = "./modules/storage"

  resource_group_name           = module.eu_resource_group.eu_resource_group_name
  resource_group_location       = module.eu_resource_group.eu_resource_group_location

  storage_account_name          = var.storage_account_name
  storage_container_name        = var.storage_container_name
}

我想從天藍色運行它。

我將如何從天藍色運行它。建立 azure devops 專案會建立 CI 管道等。

人們如何在非本地環境中運行 Terraform 基礎架構代碼?

答案1

基本上,是的 - 您需要建立新的 Azure DevOps 管道並配置其中的所有內容(程式碼位置、機密、服務主體等)。有很多逐步指南,例如這個(中)或者這個(azure devops 實驗室)。另外,不要忘記儲存 TerraformAzure 上的遠端狀態

相關內容