0

I have to create a schema so then I can create operation in Azure APIM. the code that I know is need to be used is:

resource "azurerm_api_management_api_schema" "example" {
      api_name            = azurerm_api_management_api.sample-api.name
      api_management_name = azurerm_api_management_api.sample-api.api_management_name
      resource_group_name = azurerm_api_management_api.sample-api.resource_group_name
      schema_id           = "example-schema"
      content_type        = "application/vnd.oai.openapi.components+json"
      value               = <<JSON
      {
    "properties": {
        "contentType": "application/vnd.oai.openapi.components+json",
        "document": {
          "components": {
            "schemas": {
              operation Get 1
              operation Get 2
              operation post 1.....

but how Im supposed to extract Get and POST operations from this openapi definition and include them in that Schema? https://github.com/RaphaelYoshiga/TerraformBasics/blob/master/conference-api.json

I haven´t find a clear example so far .

Chanafot
  • 736
  • 4
  • 22
  • 46
  • Does this answer your question? [Terrform Module for Azure APIM Definitions](https://stackoverflow.com/questions/69229878/terrform-module-for-azure-apim-definitions) – UserP Sep 28 '21 at 15:25
  • that´s for a definition and I need it for the operations. Not sure how to add them. guess similar aproach but not quite sure – Chanafot Sep 28 '21 at 15:39

1 Answers1

0

Below is the example of Azure apim operation with apim service

data "azurerm_api_management_api" "example" {
  name                = "search-api"
  api_management_name = "search-api-management"
  resource_group_name = "search-service"
  revision            = "2"
}

resource "azurerm_api_management_api_operation" "example" {
  operation_id        = "user-delete"
  api_name            = data.azurerm_api_management_api.example.name
  api_management_name = data.azurerm_api_management_api.example.api_management_name
  resource_group_name = data.azurerm_api_management_api.example.resource_group_name
  display_name        = "Delete User Operation"
  method              = "DELETE"
  url_template        = "/users/{id}/delete"
  description         = "This can only be done by the logged in user."

  response {
    status_code = 200
  }
}

For further information check this.

SaiSakethGuduru
  • 2,218
  • 1
  • 5
  • 15