【问题标题】:Terraform : How to hookup azurerm_api_management_authorization_server to azurerm_api_management_apiTerraform:如何将 azurerm_api_management_authorization_server 连接到 azurerm_api_management_api
【发布时间】:2020-03-03 17:22:06
【问题描述】:

您好,感谢您抽出宝贵时间查看我的问题。

我正在使用 terraform 在 Azure 中创建一个 api_management 对象。我已经掌握了 API、产品、策略、订阅和用户的设置。

我的开发人员在 Azure 中的 API 管理对象上设置了一个授权服务器,我使用 azurerm_api_management_authorization_server 自动化了它,它工作正常。

但是,我看不到如何在 terraform 中配置 API 设置以使用该授权服务器。 API User Authorisation Settings

【问题讨论】:

    标签: azure terraform azure-api-management


    【解决方案1】:

    似乎此功能目前无法通过 Terraform 获得,这可以通过针对 azurerm 提供程序的未解决问题找到: https://github.com/terraform-providers/terraform-provider-azurerm/issues/3341

    为了让您继续在 Terraform 中构建基础架构,我建议您使用 azurerm_template_deployment 资源。

    这将使您能够利用 ARM 部署中的可用 ARM API: https://docs.microsoft.com/en-us/azure/templates/microsoft.apimanagement/2019-01-01/service/apis

    遗憾的是,在关闭该问题之前,azurerm 提供程序中不会提供该功能。

    【讨论】:

    • Thx Lachie,也是一个可行的答案。
    【解决方案2】:

    Lachie White 提供的答案注释

    当我从 azure devops 中的 yaml 管道运行它时,我通过使用 azure powershell 任务解决了这个限制

    - task: AzurePowerShell@5
            inputs:
              azureSubscription: 'Subscription (111111111-1111-1111-1111-111111111111)'
              ScriptType: 'InlineScript'
              Inline: |
                $ApiMgmtContext = New-AzApiManagementContext -ResourceGroupName "api-mgmt-rg" -ServiceName "api-mgmt"
                $ApiAuthorizationServer = Get-AzApiManagementAuthorizationServer -Context $ApiMgmtContext
                $ApiAuthorizationServerName = $ApiAuthorizationServer.Name
                Set-AzApiManagementApi -Context $ApiMgmtContext -ApiId "api-name" -AuthorizationServerId "$ApiAuthorizationServerName"
             azurePowerShellVersion: 'LatestVersion'
    

    【讨论】:

      猜你喜欢
      • 2021-12-16
      • 2021-09-20
      • 2021-01-01
      • 2019-08-20
      • 2021-05-10
      • 1970-01-01
      • 2021-06-18
      • 1970-01-01
      • 2021-08-27
      相关资源
      最近更新 更多