【发布时间】:2021-01-14 20:44:26
【问题描述】:
Terraform 新手,正如问题所述,我想将其他 API 添加到现有 API Manager 实例。下面是 Terraform 的示例,它工作正常。但我想添加第二个 api。是否绝对需要将其内联在此 Terraform 脚本中?我问的原因是,如果我的团队开发“示例 api”,而第二个团队开发“awesomeexample api”,他们能否拥有仅用于存储库中 api 资源的 Terraform 代码?我需要通过 Powershell 或 GraphAPI 获取 API Manager 的名称吗? 编辑: 现在,当我添加一个额外的 api 资源时,它会破坏第一个。我猜这是因为 Terraform 状态......但这不是我想要的行为。我只是想独立于 api 管理器继续添加 api 或更改它们。
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_api_management" "example" {
name = "example-apim"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
publisher_name = "My Company"
publisher_email = "company@terraform.io"
sku_name = "Developer_1"
}
resource "azurerm_api_management_api" "example" {
name = "example-api"
resource_group_name = azurerm_resource_group.example.name
api_management_name = azurerm_api_management.example.name
revision = "1"
display_name = "Example API"
path = "example"
protocols = ["https"]
import {
content_format = "swagger-link-json"
content_value = "http://conferenceapi.azurewebsites.net/?format=json"
}
}
【问题讨论】:
-
terraform plan说什么?
标签: terraform azure-api-management