1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. ApiGatewayApiAppAttachment
tencentcloud 1.81.182 published on Monday, Apr 14, 2025 by tencentcloudstack

tencentcloud.ApiGatewayApiAppAttachment

Explore with Pulumi AI

Provides a resource to create a apigateway api_app_attachment

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";

const exampleApiGatewayApiApp = new tencentcloud.ApiGatewayApiApp("exampleApiGatewayApiApp", {
    apiAppName: "tf_example",
    apiAppDesc: "app desc.",
});
const exampleApiGatewayService = new tencentcloud.ApiGatewayService("exampleApiGatewayService", {
    serviceName: "tf_example_service",
    protocol: "http&https",
    serviceDesc: "your nice service",
    netTypes: [
        "INNER",
        "OUTER",
    ],
    ipVersion: "IPv4",
});
const exampleApiGatewayApi = new tencentcloud.ApiGatewayApi("exampleApiGatewayApi", {
    serviceId: exampleApiGatewayService.apiGatewayServiceId,
    apiName: "tf_example_api",
    apiDesc: "desc.",
    authType: "APP",
    protocol: "HTTP",
    enableCors: true,
    requestConfigPath: "/user/info",
    requestConfigMethod: "GET",
    requestParameters: [{
        name: "name",
        position: "QUERY",
        type: "string",
        desc: "desc.",
        defaultValue: "terraform",
        required: true,
    }],
    serviceConfigType: "HTTP",
    serviceConfigTimeout: 15,
    serviceConfigUrl: "https://www.qq.com",
    serviceConfigPath: "/user",
    serviceConfigMethod: "GET",
    responseType: "HTML",
    responseSuccessExample: "success",
    responseFailExample: "fail",
    responseErrorCodes: [{
        code: 400,
        msg: "system error msg.",
        desc: "system error desc.",
        convertedCode: 407,
        needConvert: true,
    }],
});
const exampleApiGatewayApiAppAttachment = new tencentcloud.ApiGatewayApiAppAttachment("exampleApiGatewayApiAppAttachment", {
    apiAppId: exampleApiGatewayApiApp.apiGatewayApiAppId,
    environment: "test",
    serviceId: exampleApiGatewayService.apiGatewayServiceId,
    apiId: exampleApiGatewayApi.apiGatewayApiId,
});
Copy
import pulumi
import pulumi_tencentcloud as tencentcloud

example_api_gateway_api_app = tencentcloud.ApiGatewayApiApp("exampleApiGatewayApiApp",
    api_app_name="tf_example",
    api_app_desc="app desc.")
example_api_gateway_service = tencentcloud.ApiGatewayService("exampleApiGatewayService",
    service_name="tf_example_service",
    protocol="http&https",
    service_desc="your nice service",
    net_types=[
        "INNER",
        "OUTER",
    ],
    ip_version="IPv4")
example_api_gateway_api = tencentcloud.ApiGatewayApi("exampleApiGatewayApi",
    service_id=example_api_gateway_service.api_gateway_service_id,
    api_name="tf_example_api",
    api_desc="desc.",
    auth_type="APP",
    protocol="HTTP",
    enable_cors=True,
    request_config_path="/user/info",
    request_config_method="GET",
    request_parameters=[{
        "name": "name",
        "position": "QUERY",
        "type": "string",
        "desc": "desc.",
        "default_value": "terraform",
        "required": True,
    }],
    service_config_type="HTTP",
    service_config_timeout=15,
    service_config_url="https://www.qq.com",
    service_config_path="/user",
    service_config_method="GET",
    response_type="HTML",
    response_success_example="success",
    response_fail_example="fail",
    response_error_codes=[{
        "code": 400,
        "msg": "system error msg.",
        "desc": "system error desc.",
        "converted_code": 407,
        "need_convert": True,
    }])
example_api_gateway_api_app_attachment = tencentcloud.ApiGatewayApiAppAttachment("exampleApiGatewayApiAppAttachment",
    api_app_id=example_api_gateway_api_app.api_gateway_api_app_id,
    environment="test",
    service_id=example_api_gateway_service.api_gateway_service_id,
    api_id=example_api_gateway_api.api_gateway_api_id)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleApiGatewayApiApp, err := tencentcloud.NewApiGatewayApiApp(ctx, "exampleApiGatewayApiApp", &tencentcloud.ApiGatewayApiAppArgs{
			ApiAppName: pulumi.String("tf_example"),
			ApiAppDesc: pulumi.String("app desc."),
		})
		if err != nil {
			return err
		}
		exampleApiGatewayService, err := tencentcloud.NewApiGatewayService(ctx, "exampleApiGatewayService", &tencentcloud.ApiGatewayServiceArgs{
			ServiceName: pulumi.String("tf_example_service"),
			Protocol:    pulumi.String("http&https"),
			ServiceDesc: pulumi.String("your nice service"),
			NetTypes: pulumi.StringArray{
				pulumi.String("INNER"),
				pulumi.String("OUTER"),
			},
			IpVersion: pulumi.String("IPv4"),
		})
		if err != nil {
			return err
		}
		exampleApiGatewayApi, err := tencentcloud.NewApiGatewayApi(ctx, "exampleApiGatewayApi", &tencentcloud.ApiGatewayApiArgs{
			ServiceId:           exampleApiGatewayService.ApiGatewayServiceId,
			ApiName:             pulumi.String("tf_example_api"),
			ApiDesc:             pulumi.String("desc."),
			AuthType:            pulumi.String("APP"),
			Protocol:            pulumi.String("HTTP"),
			EnableCors:          pulumi.Bool(true),
			RequestConfigPath:   pulumi.String("/user/info"),
			RequestConfigMethod: pulumi.String("GET"),
			RequestParameters: tencentcloud.ApiGatewayApiRequestParameterArray{
				&tencentcloud.ApiGatewayApiRequestParameterArgs{
					Name:         pulumi.String("name"),
					Position:     pulumi.String("QUERY"),
					Type:         pulumi.String("string"),
					Desc:         pulumi.String("desc."),
					DefaultValue: pulumi.String("terraform"),
					Required:     pulumi.Bool(true),
				},
			},
			ServiceConfigType:      pulumi.String("HTTP"),
			ServiceConfigTimeout:   pulumi.Float64(15),
			ServiceConfigUrl:       pulumi.String("https://www.qq.com"),
			ServiceConfigPath:      pulumi.String("/user"),
			ServiceConfigMethod:    pulumi.String("GET"),
			ResponseType:           pulumi.String("HTML"),
			ResponseSuccessExample: pulumi.String("success"),
			ResponseFailExample:    pulumi.String("fail"),
			ResponseErrorCodes: tencentcloud.ApiGatewayApiResponseErrorCodeArray{
				&tencentcloud.ApiGatewayApiResponseErrorCodeArgs{
					Code:          pulumi.Float64(400),
					Msg:           pulumi.String("system error msg."),
					Desc:          pulumi.String("system error desc."),
					ConvertedCode: pulumi.Float64(407),
					NeedConvert:   pulumi.Bool(true),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = tencentcloud.NewApiGatewayApiAppAttachment(ctx, "exampleApiGatewayApiAppAttachment", &tencentcloud.ApiGatewayApiAppAttachmentArgs{
			ApiAppId:    exampleApiGatewayApiApp.ApiGatewayApiAppId,
			Environment: pulumi.String("test"),
			ServiceId:   exampleApiGatewayService.ApiGatewayServiceId,
			ApiId:       exampleApiGatewayApi.ApiGatewayApiId,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;

return await Deployment.RunAsync(() => 
{
    var exampleApiGatewayApiApp = new Tencentcloud.ApiGatewayApiApp("exampleApiGatewayApiApp", new()
    {
        ApiAppName = "tf_example",
        ApiAppDesc = "app desc.",
    });

    var exampleApiGatewayService = new Tencentcloud.ApiGatewayService("exampleApiGatewayService", new()
    {
        ServiceName = "tf_example_service",
        Protocol = "http&https",
        ServiceDesc = "your nice service",
        NetTypes = new[]
        {
            "INNER",
            "OUTER",
        },
        IpVersion = "IPv4",
    });

    var exampleApiGatewayApi = new Tencentcloud.ApiGatewayApi("exampleApiGatewayApi", new()
    {
        ServiceId = exampleApiGatewayService.ApiGatewayServiceId,
        ApiName = "tf_example_api",
        ApiDesc = "desc.",
        AuthType = "APP",
        Protocol = "HTTP",
        EnableCors = true,
        RequestConfigPath = "/user/info",
        RequestConfigMethod = "GET",
        RequestParameters = new[]
        {
            new Tencentcloud.Inputs.ApiGatewayApiRequestParameterArgs
            {
                Name = "name",
                Position = "QUERY",
                Type = "string",
                Desc = "desc.",
                DefaultValue = "terraform",
                Required = true,
            },
        },
        ServiceConfigType = "HTTP",
        ServiceConfigTimeout = 15,
        ServiceConfigUrl = "https://www.qq.com",
        ServiceConfigPath = "/user",
        ServiceConfigMethod = "GET",
        ResponseType = "HTML",
        ResponseSuccessExample = "success",
        ResponseFailExample = "fail",
        ResponseErrorCodes = new[]
        {
            new Tencentcloud.Inputs.ApiGatewayApiResponseErrorCodeArgs
            {
                Code = 400,
                Msg = "system error msg.",
                Desc = "system error desc.",
                ConvertedCode = 407,
                NeedConvert = true,
            },
        },
    });

    var exampleApiGatewayApiAppAttachment = new Tencentcloud.ApiGatewayApiAppAttachment("exampleApiGatewayApiAppAttachment", new()
    {
        ApiAppId = exampleApiGatewayApiApp.ApiGatewayApiAppId,
        Environment = "test",
        ServiceId = exampleApiGatewayService.ApiGatewayServiceId,
        ApiId = exampleApiGatewayApi.ApiGatewayApiId,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.ApiGatewayApiApp;
import com.pulumi.tencentcloud.ApiGatewayApiAppArgs;
import com.pulumi.tencentcloud.ApiGatewayService;
import com.pulumi.tencentcloud.ApiGatewayServiceArgs;
import com.pulumi.tencentcloud.ApiGatewayApi;
import com.pulumi.tencentcloud.ApiGatewayApiArgs;
import com.pulumi.tencentcloud.inputs.ApiGatewayApiRequestParameterArgs;
import com.pulumi.tencentcloud.inputs.ApiGatewayApiResponseErrorCodeArgs;
import com.pulumi.tencentcloud.ApiGatewayApiAppAttachment;
import com.pulumi.tencentcloud.ApiGatewayApiAppAttachmentArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var exampleApiGatewayApiApp = new ApiGatewayApiApp("exampleApiGatewayApiApp", ApiGatewayApiAppArgs.builder()
            .apiAppName("tf_example")
            .apiAppDesc("app desc.")
            .build());

        var exampleApiGatewayService = new ApiGatewayService("exampleApiGatewayService", ApiGatewayServiceArgs.builder()
            .serviceName("tf_example_service")
            .protocol("http&https")
            .serviceDesc("your nice service")
            .netTypes(            
                "INNER",
                "OUTER")
            .ipVersion("IPv4")
            .build());

        var exampleApiGatewayApi = new ApiGatewayApi("exampleApiGatewayApi", ApiGatewayApiArgs.builder()
            .serviceId(exampleApiGatewayService.apiGatewayServiceId())
            .apiName("tf_example_api")
            .apiDesc("desc.")
            .authType("APP")
            .protocol("HTTP")
            .enableCors(true)
            .requestConfigPath("/user/info")
            .requestConfigMethod("GET")
            .requestParameters(ApiGatewayApiRequestParameterArgs.builder()
                .name("name")
                .position("QUERY")
                .type("string")
                .desc("desc.")
                .defaultValue("terraform")
                .required(true)
                .build())
            .serviceConfigType("HTTP")
            .serviceConfigTimeout(15)
            .serviceConfigUrl("https://www.qq.com")
            .serviceConfigPath("/user")
            .serviceConfigMethod("GET")
            .responseType("HTML")
            .responseSuccessExample("success")
            .responseFailExample("fail")
            .responseErrorCodes(ApiGatewayApiResponseErrorCodeArgs.builder()
                .code(400)
                .msg("system error msg.")
                .desc("system error desc.")
                .convertedCode(407)
                .needConvert(true)
                .build())
            .build());

        var exampleApiGatewayApiAppAttachment = new ApiGatewayApiAppAttachment("exampleApiGatewayApiAppAttachment", ApiGatewayApiAppAttachmentArgs.builder()
            .apiAppId(exampleApiGatewayApiApp.apiGatewayApiAppId())
            .environment("test")
            .serviceId(exampleApiGatewayService.apiGatewayServiceId())
            .apiId(exampleApiGatewayApi.apiGatewayApiId())
            .build());

    }
}
Copy
resources:
  exampleApiGatewayApiApp:
    type: tencentcloud:ApiGatewayApiApp
    properties:
      apiAppName: tf_example
      apiAppDesc: app desc.
  exampleApiGatewayService:
    type: tencentcloud:ApiGatewayService
    properties:
      serviceName: tf_example_service
      protocol: http&https
      serviceDesc: your nice service
      netTypes:
        - INNER
        - OUTER
      ipVersion: IPv4
  exampleApiGatewayApi:
    type: tencentcloud:ApiGatewayApi
    properties:
      serviceId: ${exampleApiGatewayService.apiGatewayServiceId}
      apiName: tf_example_api
      apiDesc: desc.
      authType: APP
      protocol: HTTP
      enableCors: true
      requestConfigPath: /user/info
      requestConfigMethod: GET
      requestParameters:
        - name: name
          position: QUERY
          type: string
          desc: desc.
          defaultValue: terraform
          required: true
      serviceConfigType: HTTP
      serviceConfigTimeout: 15
      serviceConfigUrl: https://www.qq.com
      serviceConfigPath: /user
      serviceConfigMethod: GET
      responseType: HTML
      responseSuccessExample: success
      responseFailExample: fail
      responseErrorCodes:
        - code: 400
          msg: system error msg.
          desc: system error desc.
          convertedCode: 407
          needConvert: true
  exampleApiGatewayApiAppAttachment:
    type: tencentcloud:ApiGatewayApiAppAttachment
    properties:
      apiAppId: ${exampleApiGatewayApiApp.apiGatewayApiAppId}
      environment: test
      serviceId: ${exampleApiGatewayService.apiGatewayServiceId}
      apiId: ${exampleApiGatewayApi.apiGatewayApiId}
Copy

Create ApiGatewayApiAppAttachment Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ApiGatewayApiAppAttachment(name: string, args: ApiGatewayApiAppAttachmentArgs, opts?: CustomResourceOptions);
@overload
def ApiGatewayApiAppAttachment(resource_name: str,
                               args: ApiGatewayApiAppAttachmentArgs,
                               opts: Optional[ResourceOptions] = None)

@overload
def ApiGatewayApiAppAttachment(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               api_app_id: Optional[str] = None,
                               api_id: Optional[str] = None,
                               environment: Optional[str] = None,
                               service_id: Optional[str] = None,
                               api_gateway_api_app_attachment_id: Optional[str] = None)
func NewApiGatewayApiAppAttachment(ctx *Context, name string, args ApiGatewayApiAppAttachmentArgs, opts ...ResourceOption) (*ApiGatewayApiAppAttachment, error)
public ApiGatewayApiAppAttachment(string name, ApiGatewayApiAppAttachmentArgs args, CustomResourceOptions? opts = null)
public ApiGatewayApiAppAttachment(String name, ApiGatewayApiAppAttachmentArgs args)
public ApiGatewayApiAppAttachment(String name, ApiGatewayApiAppAttachmentArgs args, CustomResourceOptions options)
type: tencentcloud:ApiGatewayApiAppAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ApiGatewayApiAppAttachmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ApiGatewayApiAppAttachmentArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ApiGatewayApiAppAttachmentArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ApiGatewayApiAppAttachmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ApiGatewayApiAppAttachmentArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

ApiGatewayApiAppAttachment Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ApiGatewayApiAppAttachment resource accepts the following input properties:

ApiAppId This property is required. string
The unique ID of the application to be bound.
ApiId This property is required. string
The unique ID of the API to be bound.
Environment This property is required. string
The environment to be bound.
ServiceId This property is required. string
The unique ID of the service to be bound.
ApiGatewayApiAppAttachmentId string
ID of the resource.
ApiAppId This property is required. string
The unique ID of the application to be bound.
ApiId This property is required. string
The unique ID of the API to be bound.
Environment This property is required. string
The environment to be bound.
ServiceId This property is required. string
The unique ID of the service to be bound.
ApiGatewayApiAppAttachmentId string
ID of the resource.
apiAppId This property is required. String
The unique ID of the application to be bound.
apiId This property is required. String
The unique ID of the API to be bound.
environment This property is required. String
The environment to be bound.
serviceId This property is required. String
The unique ID of the service to be bound.
apiGatewayApiAppAttachmentId String
ID of the resource.
apiAppId This property is required. string
The unique ID of the application to be bound.
apiId This property is required. string
The unique ID of the API to be bound.
environment This property is required. string
The environment to be bound.
serviceId This property is required. string
The unique ID of the service to be bound.
apiGatewayApiAppAttachmentId string
ID of the resource.
api_app_id This property is required. str
The unique ID of the application to be bound.
api_id This property is required. str
The unique ID of the API to be bound.
environment This property is required. str
The environment to be bound.
service_id This property is required. str
The unique ID of the service to be bound.
api_gateway_api_app_attachment_id str
ID of the resource.
apiAppId This property is required. String
The unique ID of the application to be bound.
apiId This property is required. String
The unique ID of the API to be bound.
environment This property is required. String
The environment to be bound.
serviceId This property is required. String
The unique ID of the service to be bound.
apiGatewayApiAppAttachmentId String
ID of the resource.

Outputs

All input properties are implicitly available as output properties. Additionally, the ApiGatewayApiAppAttachment resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing ApiGatewayApiAppAttachment Resource

Get an existing ApiGatewayApiAppAttachment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ApiGatewayApiAppAttachmentState, opts?: CustomResourceOptions): ApiGatewayApiAppAttachment
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        api_app_id: Optional[str] = None,
        api_gateway_api_app_attachment_id: Optional[str] = None,
        api_id: Optional[str] = None,
        environment: Optional[str] = None,
        service_id: Optional[str] = None) -> ApiGatewayApiAppAttachment
func GetApiGatewayApiAppAttachment(ctx *Context, name string, id IDInput, state *ApiGatewayApiAppAttachmentState, opts ...ResourceOption) (*ApiGatewayApiAppAttachment, error)
public static ApiGatewayApiAppAttachment Get(string name, Input<string> id, ApiGatewayApiAppAttachmentState? state, CustomResourceOptions? opts = null)
public static ApiGatewayApiAppAttachment get(String name, Output<String> id, ApiGatewayApiAppAttachmentState state, CustomResourceOptions options)
resources:  _:    type: tencentcloud:ApiGatewayApiAppAttachment    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ApiAppId string
The unique ID of the application to be bound.
ApiGatewayApiAppAttachmentId string
ID of the resource.
ApiId string
The unique ID of the API to be bound.
Environment string
The environment to be bound.
ServiceId string
The unique ID of the service to be bound.
ApiAppId string
The unique ID of the application to be bound.
ApiGatewayApiAppAttachmentId string
ID of the resource.
ApiId string
The unique ID of the API to be bound.
Environment string
The environment to be bound.
ServiceId string
The unique ID of the service to be bound.
apiAppId String
The unique ID of the application to be bound.
apiGatewayApiAppAttachmentId String
ID of the resource.
apiId String
The unique ID of the API to be bound.
environment String
The environment to be bound.
serviceId String
The unique ID of the service to be bound.
apiAppId string
The unique ID of the application to be bound.
apiGatewayApiAppAttachmentId string
ID of the resource.
apiId string
The unique ID of the API to be bound.
environment string
The environment to be bound.
serviceId string
The unique ID of the service to be bound.
api_app_id str
The unique ID of the application to be bound.
api_gateway_api_app_attachment_id str
ID of the resource.
api_id str
The unique ID of the API to be bound.
environment str
The environment to be bound.
service_id str
The unique ID of the service to be bound.
apiAppId String
The unique ID of the application to be bound.
apiGatewayApiAppAttachmentId String
ID of the resource.
apiId String
The unique ID of the API to be bound.
environment String
The environment to be bound.
serviceId String
The unique ID of the service to be bound.

Import

apigateway api_app_attachment can be imported using the id, e.g.

$ pulumi import tencentcloud:index/apiGatewayApiAppAttachment:ApiGatewayApiAppAttachment example app-f2dxx0lv#test#service-h0trno8e#api-grsomg0w
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
tencentcloud tencentcloudstack/terraform-provider-tencentcloud
License
Notes
This Pulumi package is based on the tencentcloud Terraform Provider.