cloudapp_api_handler

最近更新时间:2025-01-08 18:07:02

我的收藏

描述

云应用 API 处理器。

约定如下:
method 是固定的 POST,代理链路从中枢网关发起调用,固定用 POST 调用过来

示例

resource "cloudapp_api_handler" "APIServer" {
vpc_id = var.app_target.vpc.id
host = cloudapp_tke_service.backend.host
handler_protocol = "http"
handler_path = "/api/:api_name"
}

参数说明

类型
名称
数据类型
说明
必填
region
string
地域,如:ap-guangzhou,默认使用 provider 中定义的 region 也可以在 resource 中指定地域,覆盖默认设置
handler_protocol
enum
这里是内网协议
枚举值:
http
https
http&https
vpc_id
string
API 服务所在的 VPC
handler_path
string
前端 API 路径 支持模板字符串,如以下定义,最终的路径为:/api/GetLoadBalanceOverview

resource "cloudapp_api_handler" "APIServer" {
vpc_id = var.app_target.vpc.id
host = cloudapp_tke_service.backend.host
handler_protocol = "http"
handler_path = "/api/:api_name"
}
resource "cloudapp_api" "GetClbOverview" {
handler_id = cloudapp_api_handler.APIServer.id
api_name = "GetLoadBalanceOverview"
api_desc = "获取负载均衡情况"
}
host
string
后端服务的 host
可选
availability_zone
string
可用区
count
int
资源数量,默认为 1 如果为 0 则不创建资源
activity_id
int
计费活动 ID,保留字段
生成
id
string
资源实例 ID
create_time
string
资源创建时间
apiapp_name
string
api 网关的应用名称
apiapp_id
string
api 网关的应用 ID
name
string
api 网关服务名称
outer_sub_domain
string
外网访问子域名
net_type
enum
网络类型,目前仅支持 OUTER
网络类型列表 枚举值:
INNER:内网访问
OUTER:外网访问
ip_version
enum
IP 版本
枚举值:
IPv4:IP 版本为 ipv4
IPv6:IP 版本为 ipv6
service_url
string
接口的服务主域名地址,由协议和服务的 host(一般是服务 IP),如:http://100.1.1.1:8080 通过 ${service_url}${handler_path} 可以拼接出完整的地址