alicloud_api_gateway_api

Provides an api resource.When you create an API, you must enter the basic information about the API, and define the API request information, the API backend service and response information.

For information about Api Gateway Api and how to use it, see Create an API

Example Usage

Basic Usage

provider "alicloud" {
  region = "cn-beijing"
}

resource "alicloud_api_gateway_group" "example" {
  name        = "tf-example"
  description = "tf-example"
}

resource "alicloud_api_gateway_api" "example" {
  group_id          = alicloud_api_gateway_group.example.id
  name              = "tf-example"
  description       = "tf-example"
  auth_type         = "APP"
  force_nonce_check = false

  request_config {
    protocol = "HTTP"
    method   = "GET"
    path     = "/example/path"
    mode     = "MAPPING"
  }

  service_type = "HTTP"

  http_service_config {
    address   = "http://apigateway-backend.alicloudapi.com:8080"
    method    = "GET"
    path      = "/web/cloudapi"
    timeout   = 12
    aone_name = "cloudapi-openapi"
  }

  request_parameters {
    name         = "example"
    type         = "STRING"
    required     = "OPTIONAL"
    in           = "QUERY"
    in_service   = "QUERY"
    name_service = "exampleservice"
  }

  stage_names = [
    "RELEASE",
    "TEST",
  ]
}

Argument Reference

The following arguments are supported:

request_config

The request_config mapping supports the following:

http_service_config

The http_service_config mapping supports the following:

http_vpc_service_config

The http_vpc_service_config mapping supports the following:

fc_service_config

The fc_service_config mapping supports the following:

mock_service_config

The mock_service_config mapping supports the following:

request_parameters

The request_parameters mapping supports the following:

constant_parameters

The constant_parameters mapping supports the following:

system_parameters

The system_parameters mapping supports the following:

Attributes Reference

The following attributes are exported:

Import

Api gateway api can be imported using the id.Format to <API Group Id>:<API Id> e.g.

$ terraform import alicloud_api_gateway_api.example "ab2351f2ce904edaa8d92a0510832b91:e4f728fca5a94148b023b99a3e5d0b62"