published on Monday, Aug 24, 2026 by Pulumi
published on Monday, Aug 24, 2026 by Pulumi
Provides a APIG Plugin resource.
For information about APIG Plugin and how to use it, see What is Plugin.
NOTE: Available since v1.286.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const pluginVpcPre = new alicloud.vpc.Network("plugin_vpc_pre", {
isDefault: false,
cidrBlock: "10.0.0.0/8",
vpcName: "plugin-example-vpc",
});
const pluginVswitchPre = new alicloud.vpc.Switch("plugin_vswitch_pre", {
isDefault: false,
vpcId: pluginVpcPre.id,
zoneId: "cn-hangzhou-i",
cidrBlock: "10.0.0.0/24",
vswitchName: "plugin-example-vswitch",
});
const pluginGatewayPre = new alicloud.apig.Gateway("plugin_gateway_pre", {
networkAccessConfig: {
type: "Internet",
},
vswitch: {
vswitchId: pluginVswitchPre.id,
},
zoneConfig: {
selectOption: "Auto",
},
vpc: {
vpcId: pluginVpcPre.id,
},
gatewayType: "API",
paymentType: "PayAsYouGo",
gatewayName: "plugin-example-gateway",
spec: "apigw.small.x1",
logConfig: {
sls: {
enable: true,
},
},
});
const _default = new alicloud.apig.Plugin("default", {
pluginClassId: "pls-crpqb35lhtgo800k2m86",
gatewayId: pluginGatewayPre.id,
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
plugin_vpc_pre = alicloud.vpc.Network("plugin_vpc_pre",
is_default=False,
cidr_block="10.0.0.0/8",
vpc_name="plugin-example-vpc")
plugin_vswitch_pre = alicloud.vpc.Switch("plugin_vswitch_pre",
is_default=False,
vpc_id=plugin_vpc_pre.id,
zone_id="cn-hangzhou-i",
cidr_block="10.0.0.0/24",
vswitch_name="plugin-example-vswitch")
plugin_gateway_pre = alicloud.apig.Gateway("plugin_gateway_pre",
network_access_config={
"type": "Internet",
},
vswitch={
"vswitch_id": plugin_vswitch_pre.id,
},
zone_config={
"select_option": "Auto",
},
vpc={
"vpc_id": plugin_vpc_pre.id,
},
gateway_type="API",
payment_type="PayAsYouGo",
gateway_name="plugin-example-gateway",
spec="apigw.small.x1",
log_config={
"sls": {
"enable": True,
},
})
default = alicloud.apig.Plugin("default",
plugin_class_id="pls-crpqb35lhtgo800k2m86",
gateway_id=plugin_gateway_pre.id)
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/apig"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
pluginVpcPre, err := vpc.NewNetwork(ctx, "plugin_vpc_pre", &vpc.NetworkArgs{
IsDefault: pulumi.Bool(false),
CidrBlock: pulumi.String("10.0.0.0/8"),
VpcName: pulumi.String("plugin-example-vpc"),
})
if err != nil {
return err
}
pluginVswitchPre, err := vpc.NewSwitch(ctx, "plugin_vswitch_pre", &vpc.SwitchArgs{
IsDefault: pulumi.Bool(false),
VpcId: pluginVpcPre.ID().ToIDOutput().ToStringOutput(),
ZoneId: pulumi.String("cn-hangzhou-i"),
CidrBlock: pulumi.String("10.0.0.0/24"),
VswitchName: pulumi.String("plugin-example-vswitch"),
})
if err != nil {
return err
}
pluginGatewayPre, err := apig.NewGateway(ctx, "plugin_gateway_pre", &apig.GatewayArgs{
NetworkAccessConfig: &apig.GatewayNetworkAccessConfigArgs{
Type: pulumi.String("Internet"),
},
Vswitch: &apig.GatewayVswitchArgs{
VswitchId: pluginVswitchPre.ID().ToIDOutput().ToStringOutput(),
},
ZoneConfig: &apig.GatewayZoneConfigArgs{
SelectOption: pulumi.String("Auto"),
},
Vpc: &apig.GatewayVpcArgs{
VpcId: pluginVpcPre.ID().ToIDOutput().ToStringOutput(),
},
GatewayType: pulumi.String("API"),
PaymentType: pulumi.String("PayAsYouGo"),
GatewayName: pulumi.String("plugin-example-gateway"),
Spec: pulumi.String("apigw.small.x1"),
LogConfig: &apig.GatewayLogConfigArgs{
Sls: &apig.GatewayLogConfigSlsArgs{
Enable: pulumi.Bool(true),
},
},
})
if err != nil {
return err
}
_, err = apig.NewPlugin(ctx, "default", &apig.PluginArgs{
PluginClassId: pulumi.String("pls-crpqb35lhtgo800k2m86"),
GatewayId: pluginGatewayPre.ID().ToIDOutput().ToStringOutput(),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var pluginVpcPre = new AliCloud.Vpc.Network("plugin_vpc_pre", new()
{
IsDefault = false,
CidrBlock = "10.0.0.0/8",
VpcName = "plugin-example-vpc",
});
var pluginVswitchPre = new AliCloud.Vpc.Switch("plugin_vswitch_pre", new()
{
IsDefault = false,
VpcId = pluginVpcPre.Id,
ZoneId = "cn-hangzhou-i",
CidrBlock = "10.0.0.0/24",
VswitchName = "plugin-example-vswitch",
});
var pluginGatewayPre = new AliCloud.Apig.Gateway("plugin_gateway_pre", new()
{
NetworkAccessConfig = new AliCloud.Apig.Inputs.GatewayNetworkAccessConfigArgs
{
Type = "Internet",
},
Vswitch = new AliCloud.Apig.Inputs.GatewayVswitchArgs
{
VswitchId = pluginVswitchPre.Id,
},
ZoneConfig = new AliCloud.Apig.Inputs.GatewayZoneConfigArgs
{
SelectOption = "Auto",
},
Vpc = new AliCloud.Apig.Inputs.GatewayVpcArgs
{
VpcId = pluginVpcPre.Id,
},
GatewayType = "API",
PaymentType = "PayAsYouGo",
GatewayName = "plugin-example-gateway",
Spec = "apigw.small.x1",
LogConfig = new AliCloud.Apig.Inputs.GatewayLogConfigArgs
{
Sls = new AliCloud.Apig.Inputs.GatewayLogConfigSlsArgs
{
Enable = true,
},
},
});
var @default = new AliCloud.Apig.Plugin("default", new()
{
PluginClassId = "pls-crpqb35lhtgo800k2m86",
GatewayId = pluginGatewayPre.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.apig.Gateway;
import com.pulumi.alicloud.apig.GatewayArgs;
import com.pulumi.alicloud.apig.inputs.GatewayNetworkAccessConfigArgs;
import com.pulumi.alicloud.apig.inputs.GatewayVswitchArgs;
import com.pulumi.alicloud.apig.inputs.GatewayZoneConfigArgs;
import com.pulumi.alicloud.apig.inputs.GatewayVpcArgs;
import com.pulumi.alicloud.apig.inputs.GatewayLogConfigArgs;
import com.pulumi.alicloud.apig.inputs.GatewayLogConfigSlsArgs;
import com.pulumi.alicloud.apig.Plugin;
import com.pulumi.alicloud.apig.PluginArgs;
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) {
final var config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
var pluginVpcPre = new Network("pluginVpcPre", NetworkArgs.builder()
.isDefault(false)
.cidrBlock("10.0.0.0/8")
.vpcName("plugin-example-vpc")
.build());
var pluginVswitchPre = new Switch("pluginVswitchPre", SwitchArgs.builder()
.isDefault(false)
.vpcId(pluginVpcPre.id())
.zoneId("cn-hangzhou-i")
.cidrBlock("10.0.0.0/24")
.vswitchName("plugin-example-vswitch")
.build());
var pluginGatewayPre = new Gateway("pluginGatewayPre", GatewayArgs.builder()
.networkAccessConfig(GatewayNetworkAccessConfigArgs.builder()
.type("Internet")
.build())
.vswitch(GatewayVswitchArgs.builder()
.vswitchId(pluginVswitchPre.id())
.build())
.zoneConfig(GatewayZoneConfigArgs.builder()
.selectOption("Auto")
.build())
.vpc(GatewayVpcArgs.builder()
.vpcId(pluginVpcPre.id())
.build())
.gatewayType("API")
.paymentType("PayAsYouGo")
.gatewayName("plugin-example-gateway")
.spec("apigw.small.x1")
.logConfig(GatewayLogConfigArgs.builder()
.sls(GatewayLogConfigSlsArgs.builder()
.enable(true)
.build())
.build())
.build());
var default_ = new Plugin("default", PluginArgs.builder()
.pluginClassId("pls-crpqb35lhtgo800k2m86")
.gatewayId(pluginGatewayPre.id())
.build());
}
}
configuration:
name:
type: string
default: terraform-example
resources:
pluginVpcPre:
type: alicloud:vpc:Network
name: plugin_vpc_pre
properties:
isDefault: false
cidrBlock: 10.0.0.0/8
vpcName: plugin-example-vpc
pluginVswitchPre:
type: alicloud:vpc:Switch
name: plugin_vswitch_pre
properties:
isDefault: false
vpcId: ${pluginVpcPre.id}
zoneId: cn-hangzhou-i
cidrBlock: 10.0.0.0/24
vswitchName: plugin-example-vswitch
pluginGatewayPre:
type: alicloud:apig:Gateway
name: plugin_gateway_pre
properties:
networkAccessConfig:
type: Internet
vswitch:
vswitchId: ${pluginVswitchPre.id}
zoneConfig:
selectOption: Auto
vpc:
vpcId: ${pluginVpcPre.id}
gatewayType: API
paymentType: PayAsYouGo
gatewayName: plugin-example-gateway
spec: apigw.small.x1
logConfig:
sls:
enable: true
default:
type: alicloud:apig:Plugin
properties:
pluginClassId: pls-crpqb35lhtgo800k2m86
gatewayId: ${pluginGatewayPre.id}
pulumi {
required_providers {
alicloud = {
source = "pulumi/alicloud"
}
}
}
resource "alicloud_vpc_network" "plugin_vpc_pre" {
is_default = false
cidr_block = "10.0.0.0/8"
vpc_name = "plugin-example-vpc"
}
resource "alicloud_vpc_switch" "plugin_vswitch_pre" {
is_default = false
vpc_id = alicloud_vpc_network.plugin_vpc_pre.id
zone_id = "cn-hangzhou-i"
cidr_block = "10.0.0.0/24"
vswitch_name = "plugin-example-vswitch"
}
resource "alicloud_apig_gateway" "plugin_gateway_pre" {
network_access_config = {
type = "Internet"
}
vswitch = {
vswitch_id = alicloud_vpc_switch.plugin_vswitch_pre.id
}
zone_config = {
select_option = "Auto"
}
vpc = {
vpc_id = alicloud_vpc_network.plugin_vpc_pre.id
}
gateway_type = "API"
payment_type = "PayAsYouGo"
gateway_name = "plugin-example-gateway"
spec = "apigw.small.x1"
log_config = {
sls = {
enable = true
}
}
}
resource "alicloud_apig_plugin" "default" {
plugin_class_id = "pls-crpqb35lhtgo800k2m86"
gateway_id = alicloud_apig_gateway.plugin_gateway_pre.id
}
variable "name" {
type = string
default = "terraform-example"
}
📚 Need more examples? VIEW MORE EXAMPLES
Create Plugin Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Plugin(name: string, args: PluginArgs, opts?: CustomResourceOptions);@overload
def Plugin(resource_name: str,
args: PluginArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Plugin(resource_name: str,
opts: Optional[ResourceOptions] = None,
gateway_id: Optional[str] = None,
plugin_class_id: Optional[str] = None)func NewPlugin(ctx *Context, name string, args PluginArgs, opts ...ResourceOption) (*Plugin, error)public Plugin(string name, PluginArgs args, CustomResourceOptions? opts = null)
public Plugin(String name, PluginArgs args)
public Plugin(String name, PluginArgs args, CustomResourceOptions options)
type: alicloud:apig:Plugin
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "alicloud_apig_plugin" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args PluginArgs
- 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 PluginArgs
- 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 PluginArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PluginArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PluginArgs
- 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 pluginResource = new AliCloud.Apig.Plugin("pluginResource", new()
{
GatewayId = "string",
PluginClassId = "string",
});
example, err := apig.NewPlugin(ctx, "pluginResource", &apig.PluginArgs{
GatewayId: pulumi.String("string"),
PluginClassId: pulumi.String("string"),
})
resource "alicloud_apig_plugin" "pluginResource" {
lifecycle {
create_before_destroy = true
}
gateway_id = "string"
plugin_class_id = "string"
}
var pluginResource = new com.pulumi.alicloud.apig.Plugin("pluginResource", com.pulumi.alicloud.apig.PluginArgs.builder()
.gatewayId("string")
.pluginClassId("string")
.build());
plugin_resource = alicloud.apig.Plugin("pluginResource",
gateway_id="string",
plugin_class_id="string")
const pluginResource = new alicloud.apig.Plugin("pluginResource", {
gatewayId: "string",
pluginClassId: "string",
});
type: alicloud:apig:Plugin
properties:
gatewayId: string
pluginClassId: string
Plugin 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 Plugin resource accepts the following input properties:
- Gateway
Id string The filter parameter for the gateway instance ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- Plugin
Class stringId The plugin class ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- Gateway
Id string The filter parameter for the gateway instance ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- Plugin
Class stringId The plugin class ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- gateway_
id string The filter parameter for the gateway instance ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- plugin_
class_ stringid The plugin class ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- gateway
Id String The filter parameter for the gateway instance ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- plugin
Class StringId The plugin class ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- gateway
Id string The filter parameter for the gateway instance ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- plugin
Class stringId The plugin class ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- gateway_
id str The filter parameter for the gateway instance ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- plugin_
class_ strid The plugin class ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- gateway
Id String The filter parameter for the gateway instance ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- plugin
Class StringId The plugin class ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
Outputs
All input properties are implicitly available as output properties. Additionally, the Plugin resource produces the following output properties:
- Gateway
Name string - The gateway name.
- Id string
- The provider-assigned unique ID for this managed resource.
- Plugin
Class stringName - The filter parameter for the plugin class name.
- Gateway
Name string - The gateway name.
- Id string
- The provider-assigned unique ID for this managed resource.
- Plugin
Class stringName - The filter parameter for the plugin class name.
- gateway_
name string - The gateway name.
- id string
- The provider-assigned unique ID for this managed resource.
- plugin_
class_ stringname - The filter parameter for the plugin class name.
- gateway
Name String - The gateway name.
- id String
- The provider-assigned unique ID for this managed resource.
- plugin
Class StringName - The filter parameter for the plugin class name.
- gateway
Name string - The gateway name.
- id string
- The provider-assigned unique ID for this managed resource.
- plugin
Class stringName - The filter parameter for the plugin class name.
- gateway_
name str - The gateway name.
- id str
- The provider-assigned unique ID for this managed resource.
- plugin_
class_ strname - The filter parameter for the plugin class name.
- gateway
Name String - The gateway name.
- id String
- The provider-assigned unique ID for this managed resource.
- plugin
Class StringName - The filter parameter for the plugin class name.
Look up Existing Plugin Resource
Get an existing Plugin 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?: PluginState, opts?: CustomResourceOptions): Plugin@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
gateway_id: Optional[str] = None,
gateway_name: Optional[str] = None,
plugin_class_id: Optional[str] = None,
plugin_class_name: Optional[str] = None) -> Pluginfunc GetPlugin(ctx *Context, name string, id IDInput, state *PluginState, opts ...ResourceOption) (*Plugin, error)public static Plugin Get(string name, Input<string> id, PluginState? state, CustomResourceOptions? opts = null)public static Plugin get(String name, Output<String> id, PluginState state, CustomResourceOptions options)resources: _: type: alicloud:apig:Plugin get: id: ${id}import {
to = alicloud_apig_plugin.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.
- Gateway
Id string The filter parameter for the gateway instance ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- Gateway
Name string - The gateway name.
- Plugin
Class stringId The plugin class ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- Plugin
Class stringName - The filter parameter for the plugin class name.
- Gateway
Id string The filter parameter for the gateway instance ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- Gateway
Name string - The gateway name.
- Plugin
Class stringId The plugin class ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- Plugin
Class stringName - The filter parameter for the plugin class name.
- gateway_
id string The filter parameter for the gateway instance ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- gateway_
name string - The gateway name.
- plugin_
class_ stringid The plugin class ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- plugin_
class_ stringname - The filter parameter for the plugin class name.
- gateway
Id String The filter parameter for the gateway instance ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- gateway
Name String - The gateway name.
- plugin
Class StringId The plugin class ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- plugin
Class StringName - The filter parameter for the plugin class name.
- gateway
Id string The filter parameter for the gateway instance ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- gateway
Name string - The gateway name.
- plugin
Class stringId The plugin class ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- plugin
Class stringName - The filter parameter for the plugin class name.
- gateway_
id str The filter parameter for the gateway instance ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- gateway_
name str - The gateway name.
- plugin_
class_ strid The plugin class ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- plugin_
class_ strname - The filter parameter for the plugin class name.
- gateway
Id String The filter parameter for the gateway instance ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- gateway
Name String - The gateway name.
- plugin
Class StringId The plugin class ID.
NOTE: This parameter is immutable. Changing it after creation has no effect.
- plugin
Class StringName - The filter parameter for the plugin class name.
Import
APIG Plugin can be imported using the id, e.g.
$ pulumi import alicloud:apig/plugin:Plugin example <plugin_id>
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
alicloudTerraform Provider.
published on Monday, Aug 24, 2026 by Pulumi