简体   繁体   English

Azure Terraform API 管理 Graphql 支持

[英]Azure Terraform API Management Graphql Support

I'm creating APIs on the Azure APIM with GraphQL. This is still on preview so until now I only can create them clicking in the portal or using the Azure API Rest with a PUT request.我正在使用 GraphQL 在 Azure APIM 上创建 API。这仍然处于预览状态,所以直到现在我只能在门户中单击或使用带有 PUT 请求的 Azure API Rest 创建它们。

I'm trying to migrate all of this to Terraform but I don't find any website with information about if there is any way to create GraphQL APIs with Terraform or even using a module.我正在尝试将所有这些迁移到 Terraform,但我找不到任何网站提供有关是否有任何方法可以使用 Terraform 甚至使用模块创建 GraphQL API 的信息。

What I'm trying to do is something like this:我想做的是这样的:

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 = "graphql-file"
    content_value  = "schema.graphql"
  }
}

I'm kind of newbie at Terraform and I'm a little lost as I can't find any doc about this on the official page or anywhere.我是 Terraform 的新手,我有点迷路,因为我在官方页面或任何地方都找不到关于此的任何文档。

EDIT: What I'm trying to find is to automate with Terraform this process: GraphQL Import编辑:我想要找到的是使用 Terraform 自动化这个过程: GraphQL Import

Thanks.谢谢。

  • Here is the Plugin provider of GraphQL API resources using terraform.这是使用 terraform 的 GraphQL API 资源的插件提供者。

This provider has several configuration inputs.这个提供者有几个配置输入。 In most cases, only url & headers are used,在大多数情况下,只使用url & headers

provider "graphql" {
  url = "https://your-graphql-server-url"
  headers = {
    "header1" = "header1-value"
    "header2" = "header2-value"
    ...
  }
}
  • Here is the Argument Reference document for GraphQl API with terraform.这是 GraphQl API 和 terraform 的参数参考文档
  • And here is the complete document for creating GraphQL api with terraform.这是用 terraform 创建 GraphQL api 的完整文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM