1. Packages
  2. Packages
  3. Alibaba Cloud Provider
  4. API Docs
  5. apigateway
  6. GroupPluginAttachment
Viewing docs for Alibaba Cloud v3.102.0
published on Sunday, May 10, 2026 by Pulumi
alicloud logo
Viewing docs for Alibaba Cloud v3.102.0
published on Sunday, May 10, 2026 by Pulumi

    Provides a plugin attachment resource.It is used for attaching a specific plugin to an api group.

    For information about Api Gateway Plugin attachment and how to use it, see Attach Plugin to specified API GROUP

    NOTE: Available since v1.278.0.

    NOTE: Terraform will auto build plugin attachment while it uses alicloud.apigateway.GroupPluginAttachment to build.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const example = new alicloud.apigateway.Group("example", {
        name: "tf-example-api-gateway-group",
        description: "tf-example-api-gateway-group",
    });
    const examplePlugin = new alicloud.apigateway.Plugin("example", {
        description: "tf_example",
        pluginName: "tf-example-api-gateway-plugin",
        pluginData: JSON.stringify({
            allowOrigins: "api.foo.com",
            allowMethods: "GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH",
            allowHeaders: "Authorization,Accept,Accept-Ranges,Cache-Control,Range,Date,Content-Type,Content-Length,Content-MD5,User-Agent,X-Ca-Signature,X-Ca-Signature-Headers,X-Ca-Signature-Method,X-Ca-Key,X-Ca-Timestamp,X-Ca-Nonce,X-Ca-Stage,X-Ca-Request-Mode,x-ca-deviceid",
            exposeHeaders: "Content-MD5,Server,Date,Latency,X-Ca-Request-Id,X-Ca-Error-Code,X-Ca-Error-Message",
            maxAge: 172800,
            allowCredentials: true,
        }),
        pluginType: "cors",
    });
    const exampleGroupPluginAttachment = new alicloud.apigateway.GroupPluginAttachment("example", {
        groupId: example.id,
        pluginId: examplePlugin.id,
        stageName: "RELEASE",
    });
    
    import pulumi
    import json
    import pulumi_alicloud as alicloud
    
    example = alicloud.apigateway.Group("example",
        name="tf-example-api-gateway-group",
        description="tf-example-api-gateway-group")
    example_plugin = alicloud.apigateway.Plugin("example",
        description="tf_example",
        plugin_name="tf-example-api-gateway-plugin",
        plugin_data=json.dumps({
            "allowOrigins": "api.foo.com",
            "allowMethods": "GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH",
            "allowHeaders": "Authorization,Accept,Accept-Ranges,Cache-Control,Range,Date,Content-Type,Content-Length,Content-MD5,User-Agent,X-Ca-Signature,X-Ca-Signature-Headers,X-Ca-Signature-Method,X-Ca-Key,X-Ca-Timestamp,X-Ca-Nonce,X-Ca-Stage,X-Ca-Request-Mode,x-ca-deviceid",
            "exposeHeaders": "Content-MD5,Server,Date,Latency,X-Ca-Request-Id,X-Ca-Error-Code,X-Ca-Error-Message",
            "maxAge": 172800,
            "allowCredentials": True,
        }),
        plugin_type="cors")
    example_group_plugin_attachment = alicloud.apigateway.GroupPluginAttachment("example",
        group_id=example.id,
        plugin_id=example_plugin.id,
        stage_name="RELEASE")
    
    package main
    
    import (
    	"encoding/json"
    
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/apigateway"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := apigateway.NewGroup(ctx, "example", &apigateway.GroupArgs{
    			Name:        pulumi.String("tf-example-api-gateway-group"),
    			Description: pulumi.String("tf-example-api-gateway-group"),
    		})
    		if err != nil {
    			return err
    		}
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"allowOrigins":     "api.foo.com",
    			"allowMethods":     "GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH",
    			"allowHeaders":     "Authorization,Accept,Accept-Ranges,Cache-Control,Range,Date,Content-Type,Content-Length,Content-MD5,User-Agent,X-Ca-Signature,X-Ca-Signature-Headers,X-Ca-Signature-Method,X-Ca-Key,X-Ca-Timestamp,X-Ca-Nonce,X-Ca-Stage,X-Ca-Request-Mode,x-ca-deviceid",
    			"exposeHeaders":    "Content-MD5,Server,Date,Latency,X-Ca-Request-Id,X-Ca-Error-Code,X-Ca-Error-Message",
    			"maxAge":           172800,
    			"allowCredentials": true,
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		examplePlugin, err := apigateway.NewPlugin(ctx, "example", &apigateway.PluginArgs{
    			Description: pulumi.String("tf_example"),
    			PluginName:  pulumi.String("tf-example-api-gateway-plugin"),
    			PluginData:  pulumi.String(pulumi.String(json0)),
    			PluginType:  pulumi.String("cors"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = apigateway.NewGroupPluginAttachment(ctx, "example", &apigateway.GroupPluginAttachmentArgs{
    			GroupId:   example.ID(),
    			PluginId:  examplePlugin.ID(),
    			StageName: pulumi.String("RELEASE"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new AliCloud.ApiGateway.Group("example", new()
        {
            Name = "tf-example-api-gateway-group",
            Description = "tf-example-api-gateway-group",
        });
    
        var examplePlugin = new AliCloud.ApiGateway.Plugin("example", new()
        {
            Description = "tf_example",
            PluginName = "tf-example-api-gateway-plugin",
            PluginData = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["allowOrigins"] = "api.foo.com",
                ["allowMethods"] = "GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH",
                ["allowHeaders"] = "Authorization,Accept,Accept-Ranges,Cache-Control,Range,Date,Content-Type,Content-Length,Content-MD5,User-Agent,X-Ca-Signature,X-Ca-Signature-Headers,X-Ca-Signature-Method,X-Ca-Key,X-Ca-Timestamp,X-Ca-Nonce,X-Ca-Stage,X-Ca-Request-Mode,x-ca-deviceid",
                ["exposeHeaders"] = "Content-MD5,Server,Date,Latency,X-Ca-Request-Id,X-Ca-Error-Code,X-Ca-Error-Message",
                ["maxAge"] = 172800,
                ["allowCredentials"] = true,
            }),
            PluginType = "cors",
        });
    
        var exampleGroupPluginAttachment = new AliCloud.ApiGateway.GroupPluginAttachment("example", new()
        {
            GroupId = example.Id,
            PluginId = examplePlugin.Id,
            StageName = "RELEASE",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.apigateway.Group;
    import com.pulumi.alicloud.apigateway.GroupArgs;
    import com.pulumi.alicloud.apigateway.Plugin;
    import com.pulumi.alicloud.apigateway.PluginArgs;
    import com.pulumi.alicloud.apigateway.GroupPluginAttachment;
    import com.pulumi.alicloud.apigateway.GroupPluginAttachmentArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 example = new Group("example", GroupArgs.builder()
                .name("tf-example-api-gateway-group")
                .description("tf-example-api-gateway-group")
                .build());
    
            var examplePlugin = new Plugin("examplePlugin", PluginArgs.builder()
                .description("tf_example")
                .pluginName("tf-example-api-gateway-plugin")
                .pluginData(serializeJson(
                    jsonObject(
                        jsonProperty("allowOrigins", "api.foo.com"),
                        jsonProperty("allowMethods", "GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH"),
                        jsonProperty("allowHeaders", "Authorization,Accept,Accept-Ranges,Cache-Control,Range,Date,Content-Type,Content-Length,Content-MD5,User-Agent,X-Ca-Signature,X-Ca-Signature-Headers,X-Ca-Signature-Method,X-Ca-Key,X-Ca-Timestamp,X-Ca-Nonce,X-Ca-Stage,X-Ca-Request-Mode,x-ca-deviceid"),
                        jsonProperty("exposeHeaders", "Content-MD5,Server,Date,Latency,X-Ca-Request-Id,X-Ca-Error-Code,X-Ca-Error-Message"),
                        jsonProperty("maxAge", 172800),
                        jsonProperty("allowCredentials", true)
                    )))
                .pluginType("cors")
                .build());
    
            var exampleGroupPluginAttachment = new GroupPluginAttachment("exampleGroupPluginAttachment", GroupPluginAttachmentArgs.builder()
                .groupId(example.id())
                .pluginId(examplePlugin.id())
                .stageName("RELEASE")
                .build());
    
        }
    }
    
    resources:
      example:
        type: alicloud:apigateway:Group
        properties:
          name: tf-example-api-gateway-group
          description: tf-example-api-gateway-group
      examplePlugin:
        type: alicloud:apigateway:Plugin
        name: example
        properties:
          description: tf_example
          pluginName: tf-example-api-gateway-plugin
          pluginData:
            fn::toJSON:
              allowOrigins: api.foo.com
              allowMethods: GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH
              allowHeaders: Authorization,Accept,Accept-Ranges,Cache-Control,Range,Date,Content-Type,Content-Length,Content-MD5,User-Agent,X-Ca-Signature,X-Ca-Signature-Headers,X-Ca-Signature-Method,X-Ca-Key,X-Ca-Timestamp,X-Ca-Nonce,X-Ca-Stage,X-Ca-Request-Mode,x-ca-deviceid
              exposeHeaders: Content-MD5,Server,Date,Latency,X-Ca-Request-Id,X-Ca-Error-Code,X-Ca-Error-Message
              maxAge: 172800
              allowCredentials: true
          pluginType: cors
      exampleGroupPluginAttachment:
        type: alicloud:apigateway:GroupPluginAttachment
        name: example
        properties:
          groupId: ${example.id}
          pluginId: ${examplePlugin.id}
          stageName: RELEASE
    
    Example coming soon!
    

    📚 Need more examples? VIEW MORE EXAMPLES

    Create GroupPluginAttachment Resource

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

    Constructor syntax

    new GroupPluginAttachment(name: string, args: GroupPluginAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def GroupPluginAttachment(resource_name: str,
                              args: GroupPluginAttachmentArgs,
                              opts: Optional[ResourceOptions] = None)
    
    @overload
    def GroupPluginAttachment(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              group_id: Optional[str] = None,
                              plugin_id: Optional[str] = None,
                              stage_name: Optional[str] = None)
    func NewGroupPluginAttachment(ctx *Context, name string, args GroupPluginAttachmentArgs, opts ...ResourceOption) (*GroupPluginAttachment, error)
    public GroupPluginAttachment(string name, GroupPluginAttachmentArgs args, CustomResourceOptions? opts = null)
    public GroupPluginAttachment(String name, GroupPluginAttachmentArgs args)
    public GroupPluginAttachment(String name, GroupPluginAttachmentArgs args, CustomResourceOptions options)
    
    type: alicloud:apigateway:GroupPluginAttachment
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "alicloud_apigateway_grouppluginattachment" "name" {
        # resource properties
    }

    Parameters

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

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var groupPluginAttachmentResource = new AliCloud.ApiGateway.GroupPluginAttachment("groupPluginAttachmentResource", new()
    {
        GroupId = "string",
        PluginId = "string",
        StageName = "string",
    });
    
    example, err := apigateway.NewGroupPluginAttachment(ctx, "groupPluginAttachmentResource", &apigateway.GroupPluginAttachmentArgs{
    	GroupId:   pulumi.String("string"),
    	PluginId:  pulumi.String("string"),
    	StageName: pulumi.String("string"),
    })
    
    resource "alicloud_apigateway_grouppluginattachment" "groupPluginAttachmentResource" {
      group_id   = "string"
      plugin_id  = "string"
      stage_name = "string"
    }
    
    var groupPluginAttachmentResource = new GroupPluginAttachment("groupPluginAttachmentResource", GroupPluginAttachmentArgs.builder()
        .groupId("string")
        .pluginId("string")
        .stageName("string")
        .build());
    
    group_plugin_attachment_resource = alicloud.apigateway.GroupPluginAttachment("groupPluginAttachmentResource",
        group_id="string",
        plugin_id="string",
        stage_name="string")
    
    const groupPluginAttachmentResource = new alicloud.apigateway.GroupPluginAttachment("groupPluginAttachmentResource", {
        groupId: "string",
        pluginId: "string",
        stageName: "string",
    });
    
    type: alicloud:apigateway:GroupPluginAttachment
    properties:
        groupId: string
        pluginId: string
        stageName: string
    

    GroupPluginAttachment 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 GroupPluginAttachment resource accepts the following input properties:

    GroupId string
    The group that plugin attaches to.
    PluginId string
    The plugin that attaches to the group.
    StageName string
    Stage that the plugin attaches to.
    GroupId string
    The group that plugin attaches to.
    PluginId string
    The plugin that attaches to the group.
    StageName string
    Stage that the plugin attaches to.
    group_id string
    The group that plugin attaches to.
    plugin_id string
    The plugin that attaches to the group.
    stage_name string
    Stage that the plugin attaches to.
    groupId String
    The group that plugin attaches to.
    pluginId String
    The plugin that attaches to the group.
    stageName String
    Stage that the plugin attaches to.
    groupId string
    The group that plugin attaches to.
    pluginId string
    The plugin that attaches to the group.
    stageName string
    Stage that the plugin attaches to.
    group_id str
    The group that plugin attaches to.
    plugin_id str
    The plugin that attaches to the group.
    stage_name str
    Stage that the plugin attaches to.
    groupId String
    The group that plugin attaches to.
    pluginId String
    The plugin that attaches to the group.
    stageName String
    Stage that the plugin attaches to.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the GroupPluginAttachment 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 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 GroupPluginAttachment Resource

    Get an existing GroupPluginAttachment 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?: GroupPluginAttachmentState, opts?: CustomResourceOptions): GroupPluginAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            group_id: Optional[str] = None,
            plugin_id: Optional[str] = None,
            stage_name: Optional[str] = None) -> GroupPluginAttachment
    func GetGroupPluginAttachment(ctx *Context, name string, id IDInput, state *GroupPluginAttachmentState, opts ...ResourceOption) (*GroupPluginAttachment, error)
    public static GroupPluginAttachment Get(string name, Input<string> id, GroupPluginAttachmentState? state, CustomResourceOptions? opts = null)
    public static GroupPluginAttachment get(String name, Output<String> id, GroupPluginAttachmentState state, CustomResourceOptions options)
    resources:  _:    type: alicloud:apigateway:GroupPluginAttachment    get:      id: ${id}
    import {
      to = alicloud_apigateway_grouppluginattachment.example
      id = "${id}"
    }
    
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    GroupId string
    The group that plugin attaches to.
    PluginId string
    The plugin that attaches to the group.
    StageName string
    Stage that the plugin attaches to.
    GroupId string
    The group that plugin attaches to.
    PluginId string
    The plugin that attaches to the group.
    StageName string
    Stage that the plugin attaches to.
    group_id string
    The group that plugin attaches to.
    plugin_id string
    The plugin that attaches to the group.
    stage_name string
    Stage that the plugin attaches to.
    groupId String
    The group that plugin attaches to.
    pluginId String
    The plugin that attaches to the group.
    stageName String
    Stage that the plugin attaches to.
    groupId string
    The group that plugin attaches to.
    pluginId string
    The plugin that attaches to the group.
    stageName string
    Stage that the plugin attaches to.
    group_id str
    The group that plugin attaches to.
    plugin_id str
    The plugin that attaches to the group.
    stage_name str
    Stage that the plugin attaches to.
    groupId String
    The group that plugin attaches to.
    pluginId String
    The plugin that attaches to the group.
    stageName String
    Stage that the plugin attaches to.

    Import

    Api Gateway group plugin attachment a can be imported using the id, e.g.

    $ pulumi import alicloud:apigateway/groupPluginAttachment:GroupPluginAttachment example <group_id>:<plugin_id>:<stage_name>
    

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

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Viewing docs for Alibaba Cloud v3.102.0
    published on Sunday, May 10, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.