Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi
alicloud.fc.Trigger
Explore with Pulumi AI
Provides an Alicloud Function Compute Trigger resource. Based on trigger, execute your code in response to events in Alibaba Cloud. For information about Service and how to use it, see What is Function Compute.
NOTE: The resource requires a provider field ‘account_id’. See account_id.
NOTE: Available since v1.93.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
const defaultAccount = alicloud.getAccount({});
const defaultRegions = alicloud.getRegions({
current: true,
});
const defaultRandomInteger = new random.RandomInteger("defaultRandomInteger", {
max: 99999,
min: 10000,
});
const defaultProject = new alicloud.log.Project("defaultProject", {projectName: pulumi.interpolate`example-value-${defaultRandomInteger.result}`});
const defaultStore = new alicloud.log.Store("defaultStore", {
projectName: defaultProject.name,
logstoreName: "example-value",
});
const sourceStore = new alicloud.log.Store("sourceStore", {
projectName: defaultProject.name,
logstoreName: "example-source-store",
});
const defaultRole = new alicloud.ram.Role("defaultRole", {
document: ` {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"fc.aliyuncs.com"
]
}
}
],
"Version": "1"
}
`,
description: "this is a example",
force: true,
});
const defaultRolePolicyAttachment = new alicloud.ram.RolePolicyAttachment("defaultRolePolicyAttachment", {
roleName: defaultRole.name,
policyName: "AliyunLogFullAccess",
policyType: "System",
});
const defaultService = new alicloud.fc.Service("defaultService", {
description: "example-value",
role: defaultRole.arn,
logConfig: {
project: defaultProject.name,
logstore: defaultStore.name,
enableInstanceMetrics: true,
enableRequestMetrics: true,
},
});
const defaultBucket = new alicloud.oss.Bucket("defaultBucket", {bucket: pulumi.interpolate`terraform-example-${defaultRandomInteger.result}`});
// If you upload the function by OSS Bucket, you need to specify path can't upload by content.
const defaultBucketObject = new alicloud.oss.BucketObject("defaultBucketObject", {
bucket: defaultBucket.id,
key: "index.py",
content: `import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world'`,
});
const defaultFunction = new alicloud.fc.Function("defaultFunction", {
service: defaultService.name,
description: "example",
ossBucket: defaultBucket.id,
ossKey: defaultBucketObject.key,
memorySize: 512,
runtime: "python3.10",
handler: "hello.handler",
});
const defaultTrigger = new alicloud.fc.Trigger("defaultTrigger", {
service: defaultService.name,
"function": defaultFunction.name,
role: defaultRole.arn,
sourceArn: pulumi.all([defaultRegions, defaultAccount, defaultProject.name]).apply(([defaultRegions, defaultAccount, name]) => `acs:log:${defaultRegions.regions?.[0]?.id}:${defaultAccount.id}:project/${name}`),
type: "log",
config: pulumi.interpolate` {
"sourceConfig": {
"logstore": "${sourceStore.name}",
"startTime": null
},
"jobConfig": {
"maxRetryTime": 3,
"triggerInterval": 60
},
"functionParameter": {
"a": "b",
"c": "d"
},
"logConfig": {
"project": "${defaultProject.name}",
"logstore": "${defaultStore.name}"
},
"targetConfig": null,
"enable": true
}
`,
});
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
default_account = alicloud.get_account()
default_regions = alicloud.get_regions(current=True)
default_random_integer = random.RandomInteger("defaultRandomInteger",
max=99999,
min=10000)
default_project = alicloud.log.Project("defaultProject", project_name=default_random_integer.result.apply(lambda result: f"example-value-{result}"))
default_store = alicloud.log.Store("defaultStore",
project_name=default_project.name,
logstore_name="example-value")
source_store = alicloud.log.Store("sourceStore",
project_name=default_project.name,
logstore_name="example-source-store")
default_role = alicloud.ram.Role("defaultRole",
document=""" {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"fc.aliyuncs.com"
]
}
}
],
"Version": "1"
}
""",
description="this is a example",
force=True)
default_role_policy_attachment = alicloud.ram.RolePolicyAttachment("defaultRolePolicyAttachment",
role_name=default_role.name,
policy_name="AliyunLogFullAccess",
policy_type="System")
default_service = alicloud.fc.Service("defaultService",
description="example-value",
role=default_role.arn,
log_config=alicloud.fc.ServiceLogConfigArgs(
project=default_project.name,
logstore=default_store.name,
enable_instance_metrics=True,
enable_request_metrics=True,
))
default_bucket = alicloud.oss.Bucket("defaultBucket", bucket=default_random_integer.result.apply(lambda result: f"terraform-example-{result}"))
# If you upload the function by OSS Bucket, you need to specify path can't upload by content.
default_bucket_object = alicloud.oss.BucketObject("defaultBucketObject",
bucket=default_bucket.id,
key="index.py",
content="""import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world'""")
default_function = alicloud.fc.Function("defaultFunction",
service=default_service.name,
description="example",
oss_bucket=default_bucket.id,
oss_key=default_bucket_object.key,
memory_size=512,
runtime="python3.10",
handler="hello.handler")
default_trigger = alicloud.fc.Trigger("defaultTrigger",
service=default_service.name,
function=default_function.name,
role=default_role.arn,
source_arn=default_project.name.apply(lambda name: f"acs:log:{default_regions.regions[0].id}:{default_account.id}:project/{name}"),
type="log",
config=pulumi.Output.all(source_store.name, default_project.name, default_store.name).apply(lambda sourceStoreName, defaultProjectName, defaultStoreName: f""" {{
"sourceConfig": {{
"logstore": "{source_store_name}",
"startTime": null
}},
"jobConfig": {{
"maxRetryTime": 3,
"triggerInterval": 60
}},
"functionParameter": {{
"a": "b",
"c": "d"
}},
"logConfig": {{
"project": "{default_project_name}",
"logstore": "{default_store_name}"
}},
"targetConfig": null,
"enable": true
}}
"""))
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/fc"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/log"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/oss"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ram"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
defaultAccount, err := alicloud.GetAccount(ctx, nil, nil)
if err != nil {
return err
}
defaultRegions, err := alicloud.GetRegions(ctx, &alicloud.GetRegionsArgs{
Current: pulumi.BoolRef(true),
}, nil)
if err != nil {
return err
}
defaultRandomInteger, err := random.NewRandomInteger(ctx, "defaultRandomInteger", &random.RandomIntegerArgs{
Max: pulumi.Int(99999),
Min: pulumi.Int(10000),
})
if err != nil {
return err
}
defaultProject, err := log.NewProject(ctx, "defaultProject", &log.ProjectArgs{
ProjectName: defaultRandomInteger.Result.ApplyT(func(result int) (string, error) {
return fmt.Sprintf("example-value-%v", result), nil
}).(pulumi.StringOutput),
})
if err != nil {
return err
}
defaultStore, err := log.NewStore(ctx, "defaultStore", &log.StoreArgs{
ProjectName: defaultProject.Name,
LogstoreName: pulumi.String("example-value"),
})
if err != nil {
return err
}
sourceStore, err := log.NewStore(ctx, "sourceStore", &log.StoreArgs{
ProjectName: defaultProject.Name,
LogstoreName: pulumi.String("example-source-store"),
})
if err != nil {
return err
}
defaultRole, err := ram.NewRole(ctx, "defaultRole", &ram.RoleArgs{
Document: pulumi.String(` {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"fc.aliyuncs.com"
]
}
}
],
"Version": "1"
}
`),
Description: pulumi.String("this is a example"),
Force: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = ram.NewRolePolicyAttachment(ctx, "defaultRolePolicyAttachment", &ram.RolePolicyAttachmentArgs{
RoleName: defaultRole.Name,
PolicyName: pulumi.String("AliyunLogFullAccess"),
PolicyType: pulumi.String("System"),
})
if err != nil {
return err
}
defaultService, err := fc.NewService(ctx, "defaultService", &fc.ServiceArgs{
Description: pulumi.String("example-value"),
Role: defaultRole.Arn,
LogConfig: &fc.ServiceLogConfigArgs{
Project: defaultProject.Name,
Logstore: defaultStore.Name,
EnableInstanceMetrics: pulumi.Bool(true),
EnableRequestMetrics: pulumi.Bool(true),
},
})
if err != nil {
return err
}
defaultBucket, err := oss.NewBucket(ctx, "defaultBucket", &oss.BucketArgs{
Bucket: defaultRandomInteger.Result.ApplyT(func(result int) (string, error) {
return fmt.Sprintf("terraform-example-%v", result), nil
}).(pulumi.StringOutput),
})
if err != nil {
return err
}
// If you upload the function by OSS Bucket, you need to specify path can't upload by content.
defaultBucketObject, err := oss.NewBucketObject(ctx, "defaultBucketObject", &oss.BucketObjectArgs{
Bucket: defaultBucket.ID(),
Key: pulumi.String("index.py"),
Content: pulumi.String("import logging \ndef handler(event, context): \nlogger = logging.getLogger() \nlogger.info('hello world') \nreturn 'hello world'"),
})
if err != nil {
return err
}
defaultFunction, err := fc.NewFunction(ctx, "defaultFunction", &fc.FunctionArgs{
Service: defaultService.Name,
Description: pulumi.String("example"),
OssBucket: defaultBucket.ID(),
OssKey: defaultBucketObject.Key,
MemorySize: pulumi.Int(512),
Runtime: pulumi.String("python3.10"),
Handler: pulumi.String("hello.handler"),
})
if err != nil {
return err
}
_, err = fc.NewTrigger(ctx, "defaultTrigger", &fc.TriggerArgs{
Service: defaultService.Name,
Function: defaultFunction.Name,
Role: defaultRole.Arn,
SourceArn: defaultProject.Name.ApplyT(func(name string) (string, error) {
return fmt.Sprintf("acs:log:%v:%v:project/%v", defaultRegions.Regions[0].Id, defaultAccount.Id, name), nil
}).(pulumi.StringOutput),
Type: pulumi.String("log"),
Config: pulumi.All(sourceStore.Name, defaultProject.Name, defaultStore.Name).ApplyT(func(_args []interface{}) (string, error) {
sourceStoreName := _args[0].(string)
defaultProjectName := _args[1].(string)
defaultStoreName := _args[2].(string)
return fmt.Sprintf(` {
"sourceConfig": {
"logstore": "%v",
"startTime": null
},
"jobConfig": {
"maxRetryTime": 3,
"triggerInterval": 60
},
"functionParameter": {
"a": "b",
"c": "d"
},
"logConfig": {
"project": "%v",
"logstore": "%v"
},
"targetConfig": null,
"enable": true
}
`, sourceStoreName, defaultProjectName, defaultStoreName), nil
}).(pulumi.StringOutput),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var defaultAccount = AliCloud.GetAccount.Invoke();
var defaultRegions = AliCloud.GetRegions.Invoke(new()
{
Current = true,
});
var defaultRandomInteger = new Random.RandomInteger("defaultRandomInteger", new()
{
Max = 99999,
Min = 10000,
});
var defaultProject = new AliCloud.Log.Project("defaultProject", new()
{
ProjectName = defaultRandomInteger.Result.Apply(result => $"example-value-{result}"),
});
var defaultStore = new AliCloud.Log.Store("defaultStore", new()
{
ProjectName = defaultProject.Name,
LogstoreName = "example-value",
});
var sourceStore = new AliCloud.Log.Store("sourceStore", new()
{
ProjectName = defaultProject.Name,
LogstoreName = "example-source-store",
});
var defaultRole = new AliCloud.Ram.Role("defaultRole", new()
{
Document = @" {
""Statement"": [
{
""Action"": ""sts:AssumeRole"",
""Effect"": ""Allow"",
""Principal"": {
""Service"": [
""fc.aliyuncs.com""
]
}
}
],
""Version"": ""1""
}
",
Description = "this is a example",
Force = true,
});
var defaultRolePolicyAttachment = new AliCloud.Ram.RolePolicyAttachment("defaultRolePolicyAttachment", new()
{
RoleName = defaultRole.Name,
PolicyName = "AliyunLogFullAccess",
PolicyType = "System",
});
var defaultService = new AliCloud.FC.Service("defaultService", new()
{
Description = "example-value",
Role = defaultRole.Arn,
LogConfig = new AliCloud.FC.Inputs.ServiceLogConfigArgs
{
Project = defaultProject.Name,
Logstore = defaultStore.Name,
EnableInstanceMetrics = true,
EnableRequestMetrics = true,
},
});
var defaultBucket = new AliCloud.Oss.Bucket("defaultBucket", new()
{
BucketName = defaultRandomInteger.Result.Apply(result => $"terraform-example-{result}"),
});
// If you upload the function by OSS Bucket, you need to specify path can't upload by content.
var defaultBucketObject = new AliCloud.Oss.BucketObject("defaultBucketObject", new()
{
Bucket = defaultBucket.Id,
Key = "index.py",
Content = @"import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world'",
});
var defaultFunction = new AliCloud.FC.Function("defaultFunction", new()
{
Service = defaultService.Name,
Description = "example",
OssBucket = defaultBucket.Id,
OssKey = defaultBucketObject.Key,
MemorySize = 512,
Runtime = "python3.10",
Handler = "hello.handler",
});
var defaultTrigger = new AliCloud.FC.Trigger("defaultTrigger", new()
{
Service = defaultService.Name,
Function = defaultFunction.Name,
Role = defaultRole.Arn,
SourceArn = Output.Tuple(defaultRegions, defaultAccount, defaultProject.Name).Apply(values =>
{
var defaultRegions = values.Item1;
var defaultAccount = values.Item2;
var name = values.Item3;
return $"acs:log:{defaultRegions.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id)}:{defaultAccount.Apply(getAccountResult => getAccountResult.Id)}:project/{name}";
}),
Type = "log",
Config = Output.Tuple(sourceStore.Name, defaultProject.Name, defaultStore.Name).Apply(values =>
{
var sourceStoreName = values.Item1;
var defaultProjectName = values.Item2;
var defaultStoreName = values.Item3;
return @$" {{
""sourceConfig"": {{
""logstore"": ""{sourceStoreName}"",
""startTime"": null
}},
""jobConfig"": {{
""maxRetryTime"": 3,
""triggerInterval"": 60
}},
""functionParameter"": {{
""a"": ""b"",
""c"": ""d""
}},
""logConfig"": {{
""project"": ""{defaultProjectName}"",
""logstore"": ""{defaultStoreName}""
}},
""targetConfig"": null,
""enable"": true
}}
";
}),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetRegionsArgs;
import com.pulumi.random.RandomInteger;
import com.pulumi.random.RandomIntegerArgs;
import com.pulumi.alicloud.log.Project;
import com.pulumi.alicloud.log.ProjectArgs;
import com.pulumi.alicloud.log.Store;
import com.pulumi.alicloud.log.StoreArgs;
import com.pulumi.alicloud.ram.Role;
import com.pulumi.alicloud.ram.RoleArgs;
import com.pulumi.alicloud.ram.RolePolicyAttachment;
import com.pulumi.alicloud.ram.RolePolicyAttachmentArgs;
import com.pulumi.alicloud.fc.Service;
import com.pulumi.alicloud.fc.ServiceArgs;
import com.pulumi.alicloud.fc.inputs.ServiceLogConfigArgs;
import com.pulumi.alicloud.oss.Bucket;
import com.pulumi.alicloud.oss.BucketArgs;
import com.pulumi.alicloud.oss.BucketObject;
import com.pulumi.alicloud.oss.BucketObjectArgs;
import com.pulumi.alicloud.fc.Function;
import com.pulumi.alicloud.fc.FunctionArgs;
import com.pulumi.alicloud.fc.Trigger;
import com.pulumi.alicloud.fc.TriggerArgs;
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) {
final var defaultAccount = AlicloudFunctions.getAccount();
final var defaultRegions = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
.current(true)
.build());
var defaultRandomInteger = new RandomInteger("defaultRandomInteger", RandomIntegerArgs.builder()
.max(99999)
.min(10000)
.build());
var defaultProject = new Project("defaultProject", ProjectArgs.builder()
.projectName(defaultRandomInteger.result().applyValue(result -> String.format("example-value-%s", result)))
.build());
var defaultStore = new Store("defaultStore", StoreArgs.builder()
.projectName(defaultProject.name())
.logstoreName("example-value")
.build());
var sourceStore = new Store("sourceStore", StoreArgs.builder()
.projectName(defaultProject.name())
.logstoreName("example-source-store")
.build());
var defaultRole = new Role("defaultRole", RoleArgs.builder()
.document("""
{
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"fc.aliyuncs.com"
]
}
}
],
"Version": "1"
}
""")
.description("this is a example")
.force(true)
.build());
var defaultRolePolicyAttachment = new RolePolicyAttachment("defaultRolePolicyAttachment", RolePolicyAttachmentArgs.builder()
.roleName(defaultRole.name())
.policyName("AliyunLogFullAccess")
.policyType("System")
.build());
var defaultService = new Service("defaultService", ServiceArgs.builder()
.description("example-value")
.role(defaultRole.arn())
.logConfig(ServiceLogConfigArgs.builder()
.project(defaultProject.name())
.logstore(defaultStore.name())
.enableInstanceMetrics(true)
.enableRequestMetrics(true)
.build())
.build());
var defaultBucket = new Bucket("defaultBucket", BucketArgs.builder()
.bucket(defaultRandomInteger.result().applyValue(result -> String.format("terraform-example-%s", result)))
.build());
var defaultBucketObject = new BucketObject("defaultBucketObject", BucketObjectArgs.builder()
.bucket(defaultBucket.id())
.key("index.py")
.content("""
import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world' """)
.build());
var defaultFunction = new Function("defaultFunction", FunctionArgs.builder()
.service(defaultService.name())
.description("example")
.ossBucket(defaultBucket.id())
.ossKey(defaultBucketObject.key())
.memorySize("512")
.runtime("python3.10")
.handler("hello.handler")
.build());
var defaultTrigger = new Trigger("defaultTrigger", TriggerArgs.builder()
.service(defaultService.name())
.function(defaultFunction.name())
.role(defaultRole.arn())
.sourceArn(defaultProject.name().applyValue(name -> String.format("acs:log:%s:%s:project/%s", defaultRegions.applyValue(getRegionsResult -> getRegionsResult.regions()[0].id()),defaultAccount.applyValue(getAccountResult -> getAccountResult.id()),name)))
.type("log")
.config(Output.tuple(sourceStore.name(), defaultProject.name(), defaultStore.name()).applyValue(values -> {
var sourceStoreName = values.t1;
var defaultProjectName = values.t2;
var defaultStoreName = values.t3;
return """
{
"sourceConfig": {
"logstore": "%s",
"startTime": null
},
"jobConfig": {
"maxRetryTime": 3,
"triggerInterval": 60
},
"functionParameter": {
"a": "b",
"c": "d"
},
"logConfig": {
"project": "%s",
"logstore": "%s"
},
"targetConfig": null,
"enable": true
}
", sourceStoreName,defaultProjectName,defaultStoreName);
}))
.build());
}
}
resources:
defaultRandomInteger:
type: random:RandomInteger
properties:
max: 99999
min: 10000
defaultProject:
type: alicloud:log:Project
properties:
projectName: example-value-${defaultRandomInteger.result}
defaultStore:
type: alicloud:log:Store
properties:
projectName: ${defaultProject.name}
logstoreName: example-value
sourceStore:
type: alicloud:log:Store
properties:
projectName: ${defaultProject.name}
logstoreName: example-source-store
defaultRole:
type: alicloud:ram:Role
properties:
document: |2
{
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"fc.aliyuncs.com"
]
}
}
],
"Version": "1"
}
description: this is a example
force: true
defaultRolePolicyAttachment:
type: alicloud:ram:RolePolicyAttachment
properties:
roleName: ${defaultRole.name}
policyName: AliyunLogFullAccess
policyType: System
defaultService:
type: alicloud:fc:Service
properties:
description: example-value
role: ${defaultRole.arn}
logConfig:
project: ${defaultProject.name}
logstore: ${defaultStore.name}
enableInstanceMetrics: true
enableRequestMetrics: true
defaultBucket:
type: alicloud:oss:Bucket
properties:
bucket: terraform-example-${defaultRandomInteger.result}
# If you upload the function by OSS Bucket, you need to specify path can't upload by content.
defaultBucketObject:
type: alicloud:oss:BucketObject
properties:
bucket: ${defaultBucket.id}
key: index.py
content: "import logging \ndef handler(event, context): \nlogger = logging.getLogger() \nlogger.info('hello world') \nreturn 'hello world'"
defaultFunction:
type: alicloud:fc:Function
properties:
service: ${defaultService.name}
description: example
ossBucket: ${defaultBucket.id}
ossKey: ${defaultBucketObject.key}
memorySize: '512'
runtime: python3.10
handler: hello.handler
defaultTrigger:
type: alicloud:fc:Trigger
properties:
service: ${defaultService.name}
function: ${defaultFunction.name}
role: ${defaultRole.arn}
sourceArn: acs:log:${defaultRegions.regions[0].id}:${defaultAccount.id}:project/${defaultProject.name}
type: log
config: " {\n \"sourceConfig\": {\n \"logstore\": \"${sourceStore.name}\",\n \"startTime\": null\n },\n \"jobConfig\": {\n \"maxRetryTime\": 3,\n \"triggerInterval\": 60\n },\n \"functionParameter\": {\n \"a\": \"b\",\n \"c\": \"d\"\n },\n \"logConfig\": {\n \"project\": \"${defaultProject.name}\",\n \"logstore\": \"${defaultStore.name}\"\n },\n \"targetConfig\": null,\n \"enable\": true\n }\n \n"
variables:
defaultAccount:
fn::invoke:
Function: alicloud:getAccount
Arguments: {}
defaultRegions:
fn::invoke:
Function: alicloud:getRegions
Arguments:
current: true
MNS topic trigger:
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
const defaultAccount = alicloud.getAccount({});
const defaultRegions = alicloud.getRegions({
current: true,
});
const defaultRandomInteger = new random.RandomInteger("defaultRandomInteger", {
max: 99999,
min: 10000,
});
const defaultTopic = new alicloud.mns.Topic("defaultTopic", {});
const defaultRole = new alicloud.ram.Role("defaultRole", {
document: ` {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"mns.aliyuncs.com"
]
}
}
],
"Version": "1"
}
`,
description: "this is a example",
force: true,
});
const defaultRolePolicyAttachment = new alicloud.ram.RolePolicyAttachment("defaultRolePolicyAttachment", {
roleName: defaultRole.name,
policyName: "AliyunMNSNotificationRolePolicy",
policyType: "System",
});
const defaultService = new alicloud.fc.Service("defaultService", {
description: "example-value",
internetAccess: false,
});
const defaultBucket = new alicloud.oss.Bucket("defaultBucket", {bucket: pulumi.interpolate`terraform-example-${defaultRandomInteger.result}`});
// If you upload the function by OSS Bucket, you need to specify path can't upload by content.
const defaultBucketObject = new alicloud.oss.BucketObject("defaultBucketObject", {
bucket: defaultBucket.id,
key: "index.py",
content: `import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world'`,
});
const defaultFunction = new alicloud.fc.Function("defaultFunction", {
service: defaultService.name,
description: "example",
ossBucket: defaultBucket.id,
ossKey: defaultBucketObject.key,
memorySize: 512,
runtime: "python3.10",
handler: "hello.handler",
});
const defaultTrigger = new alicloud.fc.Trigger("defaultTrigger", {
service: defaultService.name,
"function": defaultFunction.name,
role: defaultRole.arn,
sourceArn: pulumi.all([defaultRegions, defaultAccount, defaultTopic.name]).apply(([defaultRegions, defaultAccount, name]) => `acs:mns:${defaultRegions.regions?.[0]?.id}:${defaultAccount.id}:/topics/${name}`),
type: "mns_topic",
configMns: ` {
"filterTag":"exampleTag",
"notifyContentFormat":"STREAM",
"notifyStrategy":"BACKOFF_RETRY"
}
`,
});
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
default_account = alicloud.get_account()
default_regions = alicloud.get_regions(current=True)
default_random_integer = random.RandomInteger("defaultRandomInteger",
max=99999,
min=10000)
default_topic = alicloud.mns.Topic("defaultTopic")
default_role = alicloud.ram.Role("defaultRole",
document=""" {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"mns.aliyuncs.com"
]
}
}
],
"Version": "1"
}
""",
description="this is a example",
force=True)
default_role_policy_attachment = alicloud.ram.RolePolicyAttachment("defaultRolePolicyAttachment",
role_name=default_role.name,
policy_name="AliyunMNSNotificationRolePolicy",
policy_type="System")
default_service = alicloud.fc.Service("defaultService",
description="example-value",
internet_access=False)
default_bucket = alicloud.oss.Bucket("defaultBucket", bucket=default_random_integer.result.apply(lambda result: f"terraform-example-{result}"))
# If you upload the function by OSS Bucket, you need to specify path can't upload by content.
default_bucket_object = alicloud.oss.BucketObject("defaultBucketObject",
bucket=default_bucket.id,
key="index.py",
content="""import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world'""")
default_function = alicloud.fc.Function("defaultFunction",
service=default_service.name,
description="example",
oss_bucket=default_bucket.id,
oss_key=default_bucket_object.key,
memory_size=512,
runtime="python3.10",
handler="hello.handler")
default_trigger = alicloud.fc.Trigger("defaultTrigger",
service=default_service.name,
function=default_function.name,
role=default_role.arn,
source_arn=default_topic.name.apply(lambda name: f"acs:mns:{default_regions.regions[0].id}:{default_account.id}:/topics/{name}"),
type="mns_topic",
config_mns=""" {
"filterTag":"exampleTag",
"notifyContentFormat":"STREAM",
"notifyStrategy":"BACKOFF_RETRY"
}
""")
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/fc"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/mns"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/oss"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ram"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
defaultAccount, err := alicloud.GetAccount(ctx, nil, nil)
if err != nil {
return err
}
defaultRegions, err := alicloud.GetRegions(ctx, &alicloud.GetRegionsArgs{
Current: pulumi.BoolRef(true),
}, nil)
if err != nil {
return err
}
defaultRandomInteger, err := random.NewRandomInteger(ctx, "defaultRandomInteger", &random.RandomIntegerArgs{
Max: pulumi.Int(99999),
Min: pulumi.Int(10000),
})
if err != nil {
return err
}
defaultTopic, err := mns.NewTopic(ctx, "defaultTopic", nil)
if err != nil {
return err
}
defaultRole, err := ram.NewRole(ctx, "defaultRole", &ram.RoleArgs{
Document: pulumi.String(` {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"mns.aliyuncs.com"
]
}
}
],
"Version": "1"
}
`),
Description: pulumi.String("this is a example"),
Force: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = ram.NewRolePolicyAttachment(ctx, "defaultRolePolicyAttachment", &ram.RolePolicyAttachmentArgs{
RoleName: defaultRole.Name,
PolicyName: pulumi.String("AliyunMNSNotificationRolePolicy"),
PolicyType: pulumi.String("System"),
})
if err != nil {
return err
}
defaultService, err := fc.NewService(ctx, "defaultService", &fc.ServiceArgs{
Description: pulumi.String("example-value"),
InternetAccess: pulumi.Bool(false),
})
if err != nil {
return err
}
defaultBucket, err := oss.NewBucket(ctx, "defaultBucket", &oss.BucketArgs{
Bucket: defaultRandomInteger.Result.ApplyT(func(result int) (string, error) {
return fmt.Sprintf("terraform-example-%v", result), nil
}).(pulumi.StringOutput),
})
if err != nil {
return err
}
// If you upload the function by OSS Bucket, you need to specify path can't upload by content.
defaultBucketObject, err := oss.NewBucketObject(ctx, "defaultBucketObject", &oss.BucketObjectArgs{
Bucket: defaultBucket.ID(),
Key: pulumi.String("index.py"),
Content: pulumi.String("import logging \ndef handler(event, context): \nlogger = logging.getLogger() \nlogger.info('hello world') \nreturn 'hello world'"),
})
if err != nil {
return err
}
defaultFunction, err := fc.NewFunction(ctx, "defaultFunction", &fc.FunctionArgs{
Service: defaultService.Name,
Description: pulumi.String("example"),
OssBucket: defaultBucket.ID(),
OssKey: defaultBucketObject.Key,
MemorySize: pulumi.Int(512),
Runtime: pulumi.String("python3.10"),
Handler: pulumi.String("hello.handler"),
})
if err != nil {
return err
}
_, err = fc.NewTrigger(ctx, "defaultTrigger", &fc.TriggerArgs{
Service: defaultService.Name,
Function: defaultFunction.Name,
Role: defaultRole.Arn,
SourceArn: defaultTopic.Name.ApplyT(func(name string) (string, error) {
return fmt.Sprintf("acs:mns:%v:%v:/topics/%v", defaultRegions.Regions[0].Id, defaultAccount.Id, name), nil
}).(pulumi.StringOutput),
Type: pulumi.String("mns_topic"),
ConfigMns: pulumi.String(` {
"filterTag":"exampleTag",
"notifyContentFormat":"STREAM",
"notifyStrategy":"BACKOFF_RETRY"
}
`),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var defaultAccount = AliCloud.GetAccount.Invoke();
var defaultRegions = AliCloud.GetRegions.Invoke(new()
{
Current = true,
});
var defaultRandomInteger = new Random.RandomInteger("defaultRandomInteger", new()
{
Max = 99999,
Min = 10000,
});
var defaultTopic = new AliCloud.Mns.Topic("defaultTopic");
var defaultRole = new AliCloud.Ram.Role("defaultRole", new()
{
Document = @" {
""Statement"": [
{
""Action"": ""sts:AssumeRole"",
""Effect"": ""Allow"",
""Principal"": {
""Service"": [
""mns.aliyuncs.com""
]
}
}
],
""Version"": ""1""
}
",
Description = "this is a example",
Force = true,
});
var defaultRolePolicyAttachment = new AliCloud.Ram.RolePolicyAttachment("defaultRolePolicyAttachment", new()
{
RoleName = defaultRole.Name,
PolicyName = "AliyunMNSNotificationRolePolicy",
PolicyType = "System",
});
var defaultService = new AliCloud.FC.Service("defaultService", new()
{
Description = "example-value",
InternetAccess = false,
});
var defaultBucket = new AliCloud.Oss.Bucket("defaultBucket", new()
{
BucketName = defaultRandomInteger.Result.Apply(result => $"terraform-example-{result}"),
});
// If you upload the function by OSS Bucket, you need to specify path can't upload by content.
var defaultBucketObject = new AliCloud.Oss.BucketObject("defaultBucketObject", new()
{
Bucket = defaultBucket.Id,
Key = "index.py",
Content = @"import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world'",
});
var defaultFunction = new AliCloud.FC.Function("defaultFunction", new()
{
Service = defaultService.Name,
Description = "example",
OssBucket = defaultBucket.Id,
OssKey = defaultBucketObject.Key,
MemorySize = 512,
Runtime = "python3.10",
Handler = "hello.handler",
});
var defaultTrigger = new AliCloud.FC.Trigger("defaultTrigger", new()
{
Service = defaultService.Name,
Function = defaultFunction.Name,
Role = defaultRole.Arn,
SourceArn = Output.Tuple(defaultRegions, defaultAccount, defaultTopic.Name).Apply(values =>
{
var defaultRegions = values.Item1;
var defaultAccount = values.Item2;
var name = values.Item3;
return $"acs:mns:{defaultRegions.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id)}:{defaultAccount.Apply(getAccountResult => getAccountResult.Id)}:/topics/{name}";
}),
Type = "mns_topic",
ConfigMns = @" {
""filterTag"":""exampleTag"",
""notifyContentFormat"":""STREAM"",
""notifyStrategy"":""BACKOFF_RETRY""
}
",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetRegionsArgs;
import com.pulumi.random.RandomInteger;
import com.pulumi.random.RandomIntegerArgs;
import com.pulumi.alicloud.mns.Topic;
import com.pulumi.alicloud.ram.Role;
import com.pulumi.alicloud.ram.RoleArgs;
import com.pulumi.alicloud.ram.RolePolicyAttachment;
import com.pulumi.alicloud.ram.RolePolicyAttachmentArgs;
import com.pulumi.alicloud.fc.Service;
import com.pulumi.alicloud.fc.ServiceArgs;
import com.pulumi.alicloud.oss.Bucket;
import com.pulumi.alicloud.oss.BucketArgs;
import com.pulumi.alicloud.oss.BucketObject;
import com.pulumi.alicloud.oss.BucketObjectArgs;
import com.pulumi.alicloud.fc.Function;
import com.pulumi.alicloud.fc.FunctionArgs;
import com.pulumi.alicloud.fc.Trigger;
import com.pulumi.alicloud.fc.TriggerArgs;
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) {
final var defaultAccount = AlicloudFunctions.getAccount();
final var defaultRegions = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
.current(true)
.build());
var defaultRandomInteger = new RandomInteger("defaultRandomInteger", RandomIntegerArgs.builder()
.max(99999)
.min(10000)
.build());
var defaultTopic = new Topic("defaultTopic");
var defaultRole = new Role("defaultRole", RoleArgs.builder()
.document("""
{
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"mns.aliyuncs.com"
]
}
}
],
"Version": "1"
}
""")
.description("this is a example")
.force(true)
.build());
var defaultRolePolicyAttachment = new RolePolicyAttachment("defaultRolePolicyAttachment", RolePolicyAttachmentArgs.builder()
.roleName(defaultRole.name())
.policyName("AliyunMNSNotificationRolePolicy")
.policyType("System")
.build());
var defaultService = new Service("defaultService", ServiceArgs.builder()
.description("example-value")
.internetAccess(false)
.build());
var defaultBucket = new Bucket("defaultBucket", BucketArgs.builder()
.bucket(defaultRandomInteger.result().applyValue(result -> String.format("terraform-example-%s", result)))
.build());
var defaultBucketObject = new BucketObject("defaultBucketObject", BucketObjectArgs.builder()
.bucket(defaultBucket.id())
.key("index.py")
.content("""
import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world' """)
.build());
var defaultFunction = new Function("defaultFunction", FunctionArgs.builder()
.service(defaultService.name())
.description("example")
.ossBucket(defaultBucket.id())
.ossKey(defaultBucketObject.key())
.memorySize("512")
.runtime("python3.10")
.handler("hello.handler")
.build());
var defaultTrigger = new Trigger("defaultTrigger", TriggerArgs.builder()
.service(defaultService.name())
.function(defaultFunction.name())
.role(defaultRole.arn())
.sourceArn(defaultTopic.name().applyValue(name -> String.format("acs:mns:%s:%s:/topics/%s", defaultRegions.applyValue(getRegionsResult -> getRegionsResult.regions()[0].id()),defaultAccount.applyValue(getAccountResult -> getAccountResult.id()),name)))
.type("mns_topic")
.configMns("""
{
"filterTag":"exampleTag",
"notifyContentFormat":"STREAM",
"notifyStrategy":"BACKOFF_RETRY"
}
""")
.build());
}
}
resources:
defaultRandomInteger:
type: random:RandomInteger
properties:
max: 99999
min: 10000
defaultTopic:
type: alicloud:mns:Topic
defaultRole:
type: alicloud:ram:Role
properties:
document: |2
{
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"mns.aliyuncs.com"
]
}
}
],
"Version": "1"
}
description: this is a example
force: true
defaultRolePolicyAttachment:
type: alicloud:ram:RolePolicyAttachment
properties:
roleName: ${defaultRole.name}
policyName: AliyunMNSNotificationRolePolicy
policyType: System
defaultService:
type: alicloud:fc:Service
properties:
description: example-value
internetAccess: false
defaultBucket:
type: alicloud:oss:Bucket
properties:
bucket: terraform-example-${defaultRandomInteger.result}
# If you upload the function by OSS Bucket, you need to specify path can't upload by content.
defaultBucketObject:
type: alicloud:oss:BucketObject
properties:
bucket: ${defaultBucket.id}
key: index.py
content: "import logging \ndef handler(event, context): \nlogger = logging.getLogger() \nlogger.info('hello world') \nreturn 'hello world'"
defaultFunction:
type: alicloud:fc:Function
properties:
service: ${defaultService.name}
description: example
ossBucket: ${defaultBucket.id}
ossKey: ${defaultBucketObject.key}
memorySize: '512'
runtime: python3.10
handler: hello.handler
defaultTrigger:
type: alicloud:fc:Trigger
properties:
service: ${defaultService.name}
function: ${defaultFunction.name}
role: ${defaultRole.arn}
sourceArn: acs:mns:${defaultRegions.regions[0].id}:${defaultAccount.id}:/topics/${defaultTopic.name}
type: mns_topic
configMns: |2
{
"filterTag":"exampleTag",
"notifyContentFormat":"STREAM",
"notifyStrategy":"BACKOFF_RETRY"
}
variables:
defaultAccount:
fn::invoke:
Function: alicloud:getAccount
Arguments: {}
defaultRegions:
fn::invoke:
Function: alicloud:getRegions
Arguments:
current: true
CDN events trigger:
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
const defaultAccount = alicloud.getAccount({});
const defaultRandomInteger = new random.RandomInteger("defaultRandomInteger", {
max: 99999,
min: 10000,
});
const defaultDomainNew = new alicloud.cdn.DomainNew("defaultDomainNew", {
domainName: pulumi.interpolate`example${defaultRandomInteger.result}.tf.com`,
cdnType: "web",
scope: "overseas",
sources: [{
content: "1.1.1.1",
type: "ipaddr",
priority: 20,
port: 80,
weight: 10,
}],
});
const defaultService = new alicloud.fc.Service("defaultService", {
description: "example-value",
internetAccess: false,
});
const defaultRole = new alicloud.ram.Role("defaultRole", {
document: ` {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"cdn.aliyuncs.com"
]
}
}
],
"Version": "1"
}
`,
description: "this is a example",
force: true,
});
const defaultPolicy = new alicloud.ram.Policy("defaultPolicy", {
policyName: pulumi.interpolate`fcservicepolicy-${defaultRandomInteger.result}`,
policyDocument: pulumi.interpolate` {
"Version": "1",
"Statement": [
{
"Action": [
"fc:InvokeFunction"
],
"Resource": [
"acs:fc:*:*:services/${defaultService.name}/functions/*",
"acs:fc:*:*:services/${defaultService.name}.*/functions/*"
],
"Effect": "Allow"
}
]
}
`,
description: "this is a example",
force: true,
});
const defaultRolePolicyAttachment = new alicloud.ram.RolePolicyAttachment("defaultRolePolicyAttachment", {
roleName: defaultRole.name,
policyName: defaultPolicy.name,
policyType: "Custom",
});
const defaultBucket = new alicloud.oss.Bucket("defaultBucket", {bucket: pulumi.interpolate`terraform-example-${defaultRandomInteger.result}`});
// If you upload the function by OSS Bucket, you need to specify path can't upload by content.
const defaultBucketObject = new alicloud.oss.BucketObject("defaultBucketObject", {
bucket: defaultBucket.id,
key: "index.py",
content: `import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world'`,
});
const defaultFunction = new alicloud.fc.Function("defaultFunction", {
service: defaultService.name,
description: "example",
ossBucket: defaultBucket.id,
ossKey: defaultBucketObject.key,
memorySize: 512,
runtime: "python3.10",
handler: "hello.handler",
});
const defaultTrigger = new alicloud.fc.Trigger("defaultTrigger", {
service: defaultService.name,
"function": defaultFunction.name,
role: defaultRole.arn,
sourceArn: defaultAccount.then(defaultAccount => `acs:cdn:*:${defaultAccount.id}`),
type: "cdn_events",
config: pulumi.interpolate` {"eventName":"LogFileCreated",
"eventVersion":"1.0.0",
"notes":"cdn events trigger",
"filter":{
"domain": ["${defaultDomainNew.domainName}"]
}
}
`,
});
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
default_account = alicloud.get_account()
default_random_integer = random.RandomInteger("defaultRandomInteger",
max=99999,
min=10000)
default_domain_new = alicloud.cdn.DomainNew("defaultDomainNew",
domain_name=default_random_integer.result.apply(lambda result: f"example{result}.tf.com"),
cdn_type="web",
scope="overseas",
sources=[alicloud.cdn.DomainNewSourceArgs(
content="1.1.1.1",
type="ipaddr",
priority=20,
port=80,
weight=10,
)])
default_service = alicloud.fc.Service("defaultService",
description="example-value",
internet_access=False)
default_role = alicloud.ram.Role("defaultRole",
document=""" {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"cdn.aliyuncs.com"
]
}
}
],
"Version": "1"
}
""",
description="this is a example",
force=True)
default_policy = alicloud.ram.Policy("defaultPolicy",
policy_name=default_random_integer.result.apply(lambda result: f"fcservicepolicy-{result}"),
policy_document=pulumi.Output.all(default_service.name, default_service.name).apply(lambda defaultServiceName, defaultServiceName1: f""" {{
"Version": "1",
"Statement": [
{{
"Action": [
"fc:InvokeFunction"
],
"Resource": [
"acs:fc:*:*:services/{default_service_name}/functions/*",
"acs:fc:*:*:services/{default_service_name1}.*/functions/*"
],
"Effect": "Allow"
}}
]
}}
"""),
description="this is a example",
force=True)
default_role_policy_attachment = alicloud.ram.RolePolicyAttachment("defaultRolePolicyAttachment",
role_name=default_role.name,
policy_name=default_policy.name,
policy_type="Custom")
default_bucket = alicloud.oss.Bucket("defaultBucket", bucket=default_random_integer.result.apply(lambda result: f"terraform-example-{result}"))
# If you upload the function by OSS Bucket, you need to specify path can't upload by content.
default_bucket_object = alicloud.oss.BucketObject("defaultBucketObject",
bucket=default_bucket.id,
key="index.py",
content="""import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world'""")
default_function = alicloud.fc.Function("defaultFunction",
service=default_service.name,
description="example",
oss_bucket=default_bucket.id,
oss_key=default_bucket_object.key,
memory_size=512,
runtime="python3.10",
handler="hello.handler")
default_trigger = alicloud.fc.Trigger("defaultTrigger",
service=default_service.name,
function=default_function.name,
role=default_role.arn,
source_arn=f"acs:cdn:*:{default_account.id}",
type="cdn_events",
config=default_domain_new.domain_name.apply(lambda domain_name: f""" {{"eventName":"LogFileCreated",
"eventVersion":"1.0.0",
"notes":"cdn events trigger",
"filter":{{
"domain": ["{domain_name}"]
}}
}}
"""))
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cdn"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/fc"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/oss"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ram"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
defaultAccount, err := alicloud.GetAccount(ctx, nil, nil)
if err != nil {
return err
}
defaultRandomInteger, err := random.NewRandomInteger(ctx, "defaultRandomInteger", &random.RandomIntegerArgs{
Max: pulumi.Int(99999),
Min: pulumi.Int(10000),
})
if err != nil {
return err
}
defaultDomainNew, err := cdn.NewDomainNew(ctx, "defaultDomainNew", &cdn.DomainNewArgs{
DomainName: defaultRandomInteger.Result.ApplyT(func(result int) (string, error) {
return fmt.Sprintf("example%v.tf.com", result), nil
}).(pulumi.StringOutput),
CdnType: pulumi.String("web"),
Scope: pulumi.String("overseas"),
Sources: cdn.DomainNewSourceArray{
&cdn.DomainNewSourceArgs{
Content: pulumi.String("1.1.1.1"),
Type: pulumi.String("ipaddr"),
Priority: pulumi.Int(20),
Port: pulumi.Int(80),
Weight: pulumi.Int(10),
},
},
})
if err != nil {
return err
}
defaultService, err := fc.NewService(ctx, "defaultService", &fc.ServiceArgs{
Description: pulumi.String("example-value"),
InternetAccess: pulumi.Bool(false),
})
if err != nil {
return err
}
defaultRole, err := ram.NewRole(ctx, "defaultRole", &ram.RoleArgs{
Document: pulumi.String(` {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"cdn.aliyuncs.com"
]
}
}
],
"Version": "1"
}
`),
Description: pulumi.String("this is a example"),
Force: pulumi.Bool(true),
})
if err != nil {
return err
}
defaultPolicy, err := ram.NewPolicy(ctx, "defaultPolicy", &ram.PolicyArgs{
PolicyName: defaultRandomInteger.Result.ApplyT(func(result int) (string, error) {
return fmt.Sprintf("fcservicepolicy-%v", result), nil
}).(pulumi.StringOutput),
PolicyDocument: pulumi.All(defaultService.Name, defaultService.Name).ApplyT(func(_args []interface{}) (string, error) {
defaultServiceName := _args[0].(string)
defaultServiceName1 := _args[1].(string)
return fmt.Sprintf(` {
"Version": "1",
"Statement": [
{
"Action": [
"fc:InvokeFunction"
],
"Resource": [
"acs:fc:*:*:services/%v/functions/*",
"acs:fc:*:*:services/%v.*/functions/*"
],
"Effect": "Allow"
}
]
}
`, defaultServiceName, defaultServiceName1), nil
}).(pulumi.StringOutput),
Description: pulumi.String("this is a example"),
Force: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = ram.NewRolePolicyAttachment(ctx, "defaultRolePolicyAttachment", &ram.RolePolicyAttachmentArgs{
RoleName: defaultRole.Name,
PolicyName: defaultPolicy.Name,
PolicyType: pulumi.String("Custom"),
})
if err != nil {
return err
}
defaultBucket, err := oss.NewBucket(ctx, "defaultBucket", &oss.BucketArgs{
Bucket: defaultRandomInteger.Result.ApplyT(func(result int) (string, error) {
return fmt.Sprintf("terraform-example-%v", result), nil
}).(pulumi.StringOutput),
})
if err != nil {
return err
}
// If you upload the function by OSS Bucket, you need to specify path can't upload by content.
defaultBucketObject, err := oss.NewBucketObject(ctx, "defaultBucketObject", &oss.BucketObjectArgs{
Bucket: defaultBucket.ID(),
Key: pulumi.String("index.py"),
Content: pulumi.String("import logging \ndef handler(event, context): \nlogger = logging.getLogger() \nlogger.info('hello world') \nreturn 'hello world'"),
})
if err != nil {
return err
}
defaultFunction, err := fc.NewFunction(ctx, "defaultFunction", &fc.FunctionArgs{
Service: defaultService.Name,
Description: pulumi.String("example"),
OssBucket: defaultBucket.ID(),
OssKey: defaultBucketObject.Key,
MemorySize: pulumi.Int(512),
Runtime: pulumi.String("python3.10"),
Handler: pulumi.String("hello.handler"),
})
if err != nil {
return err
}
_, err = fc.NewTrigger(ctx, "defaultTrigger", &fc.TriggerArgs{
Service: defaultService.Name,
Function: defaultFunction.Name,
Role: defaultRole.Arn,
SourceArn: pulumi.String(fmt.Sprintf("acs:cdn:*:%v", defaultAccount.Id)),
Type: pulumi.String("cdn_events"),
Config: defaultDomainNew.DomainName.ApplyT(func(domainName string) (string, error) {
return fmt.Sprintf(` {"eventName":"LogFileCreated",
"eventVersion":"1.0.0",
"notes":"cdn events trigger",
"filter":{
"domain": ["%v"]
}
}
`, domainName), nil
}).(pulumi.StringOutput),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var defaultAccount = AliCloud.GetAccount.Invoke();
var defaultRandomInteger = new Random.RandomInteger("defaultRandomInteger", new()
{
Max = 99999,
Min = 10000,
});
var defaultDomainNew = new AliCloud.Cdn.DomainNew("defaultDomainNew", new()
{
DomainName = defaultRandomInteger.Result.Apply(result => $"example{result}.tf.com"),
CdnType = "web",
Scope = "overseas",
Sources = new[]
{
new AliCloud.Cdn.Inputs.DomainNewSourceArgs
{
Content = "1.1.1.1",
Type = "ipaddr",
Priority = 20,
Port = 80,
Weight = 10,
},
},
});
var defaultService = new AliCloud.FC.Service("defaultService", new()
{
Description = "example-value",
InternetAccess = false,
});
var defaultRole = new AliCloud.Ram.Role("defaultRole", new()
{
Document = @" {
""Statement"": [
{
""Action"": ""sts:AssumeRole"",
""Effect"": ""Allow"",
""Principal"": {
""Service"": [
""cdn.aliyuncs.com""
]
}
}
],
""Version"": ""1""
}
",
Description = "this is a example",
Force = true,
});
var defaultPolicy = new AliCloud.Ram.Policy("defaultPolicy", new()
{
PolicyName = defaultRandomInteger.Result.Apply(result => $"fcservicepolicy-{result}"),
PolicyDocument = Output.Tuple(defaultService.Name, defaultService.Name).Apply(values =>
{
var defaultServiceName = values.Item1;
var defaultServiceName1 = values.Item2;
return @$" {{
""Version"": ""1"",
""Statement"": [
{{
""Action"": [
""fc:InvokeFunction""
],
""Resource"": [
""acs:fc:*:*:services/{defaultServiceName}/functions/*"",
""acs:fc:*:*:services/{defaultServiceName1}.*/functions/*""
],
""Effect"": ""Allow""
}}
]
}}
";
}),
Description = "this is a example",
Force = true,
});
var defaultRolePolicyAttachment = new AliCloud.Ram.RolePolicyAttachment("defaultRolePolicyAttachment", new()
{
RoleName = defaultRole.Name,
PolicyName = defaultPolicy.Name,
PolicyType = "Custom",
});
var defaultBucket = new AliCloud.Oss.Bucket("defaultBucket", new()
{
BucketName = defaultRandomInteger.Result.Apply(result => $"terraform-example-{result}"),
});
// If you upload the function by OSS Bucket, you need to specify path can't upload by content.
var defaultBucketObject = new AliCloud.Oss.BucketObject("defaultBucketObject", new()
{
Bucket = defaultBucket.Id,
Key = "index.py",
Content = @"import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world'",
});
var defaultFunction = new AliCloud.FC.Function("defaultFunction", new()
{
Service = defaultService.Name,
Description = "example",
OssBucket = defaultBucket.Id,
OssKey = defaultBucketObject.Key,
MemorySize = 512,
Runtime = "python3.10",
Handler = "hello.handler",
});
var defaultTrigger = new AliCloud.FC.Trigger("defaultTrigger", new()
{
Service = defaultService.Name,
Function = defaultFunction.Name,
Role = defaultRole.Arn,
SourceArn = $"acs:cdn:*:{defaultAccount.Apply(getAccountResult => getAccountResult.Id)}",
Type = "cdn_events",
Config = defaultDomainNew.DomainName.Apply(domainName => @$" {{""eventName"":""LogFileCreated"",
""eventVersion"":""1.0.0"",
""notes"":""cdn events trigger"",
""filter"":{{
""domain"": [""{domainName}""]
}}
}}
"),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.random.RandomInteger;
import com.pulumi.random.RandomIntegerArgs;
import com.pulumi.alicloud.cdn.DomainNew;
import com.pulumi.alicloud.cdn.DomainNewArgs;
import com.pulumi.alicloud.cdn.inputs.DomainNewSourceArgs;
import com.pulumi.alicloud.fc.Service;
import com.pulumi.alicloud.fc.ServiceArgs;
import com.pulumi.alicloud.ram.Role;
import com.pulumi.alicloud.ram.RoleArgs;
import com.pulumi.alicloud.ram.Policy;
import com.pulumi.alicloud.ram.PolicyArgs;
import com.pulumi.alicloud.ram.RolePolicyAttachment;
import com.pulumi.alicloud.ram.RolePolicyAttachmentArgs;
import com.pulumi.alicloud.oss.Bucket;
import com.pulumi.alicloud.oss.BucketArgs;
import com.pulumi.alicloud.oss.BucketObject;
import com.pulumi.alicloud.oss.BucketObjectArgs;
import com.pulumi.alicloud.fc.Function;
import com.pulumi.alicloud.fc.FunctionArgs;
import com.pulumi.alicloud.fc.Trigger;
import com.pulumi.alicloud.fc.TriggerArgs;
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) {
final var defaultAccount = AlicloudFunctions.getAccount();
var defaultRandomInteger = new RandomInteger("defaultRandomInteger", RandomIntegerArgs.builder()
.max(99999)
.min(10000)
.build());
var defaultDomainNew = new DomainNew("defaultDomainNew", DomainNewArgs.builder()
.domainName(defaultRandomInteger.result().applyValue(result -> String.format("example%s.tf.com", result)))
.cdnType("web")
.scope("overseas")
.sources(DomainNewSourceArgs.builder()
.content("1.1.1.1")
.type("ipaddr")
.priority(20)
.port(80)
.weight(10)
.build())
.build());
var defaultService = new Service("defaultService", ServiceArgs.builder()
.description("example-value")
.internetAccess(false)
.build());
var defaultRole = new Role("defaultRole", RoleArgs.builder()
.document("""
{
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"cdn.aliyuncs.com"
]
}
}
],
"Version": "1"
}
""")
.description("this is a example")
.force(true)
.build());
var defaultPolicy = new Policy("defaultPolicy", PolicyArgs.builder()
.policyName(defaultRandomInteger.result().applyValue(result -> String.format("fcservicepolicy-%s", result)))
.policyDocument(Output.tuple(defaultService.name(), defaultService.name()).applyValue(values -> {
var defaultServiceName = values.t1;
var defaultServiceName1 = values.t2;
return """
{
"Version": "1",
"Statement": [
{
"Action": [
"fc:InvokeFunction"
],
"Resource": [
"acs:fc:*:*:services/%s/functions/*",
"acs:fc:*:*:services/%s.*/functions/*"
],
"Effect": "Allow"
}
]
}
", defaultServiceName,defaultServiceName1);
}))
.description("this is a example")
.force(true)
.build());
var defaultRolePolicyAttachment = new RolePolicyAttachment("defaultRolePolicyAttachment", RolePolicyAttachmentArgs.builder()
.roleName(defaultRole.name())
.policyName(defaultPolicy.name())
.policyType("Custom")
.build());
var defaultBucket = new Bucket("defaultBucket", BucketArgs.builder()
.bucket(defaultRandomInteger.result().applyValue(result -> String.format("terraform-example-%s", result)))
.build());
var defaultBucketObject = new BucketObject("defaultBucketObject", BucketObjectArgs.builder()
.bucket(defaultBucket.id())
.key("index.py")
.content("""
import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world' """)
.build());
var defaultFunction = new Function("defaultFunction", FunctionArgs.builder()
.service(defaultService.name())
.description("example")
.ossBucket(defaultBucket.id())
.ossKey(defaultBucketObject.key())
.memorySize("512")
.runtime("python3.10")
.handler("hello.handler")
.build());
var defaultTrigger = new Trigger("defaultTrigger", TriggerArgs.builder()
.service(defaultService.name())
.function(defaultFunction.name())
.role(defaultRole.arn())
.sourceArn(String.format("acs:cdn:*:%s", defaultAccount.applyValue(getAccountResult -> getAccountResult.id())))
.type("cdn_events")
.config(defaultDomainNew.domainName().applyValue(domainName -> """
{"eventName":"LogFileCreated",
"eventVersion":"1.0.0",
"notes":"cdn events trigger",
"filter":{
"domain": ["%s"]
}
}
", domainName)))
.build());
}
}
resources:
defaultRandomInteger:
type: random:RandomInteger
properties:
max: 99999
min: 10000
defaultDomainNew:
type: alicloud:cdn:DomainNew
properties:
domainName: example${defaultRandomInteger.result}.tf.com
cdnType: web
scope: overseas
sources:
- content: 1.1.1.1
type: ipaddr
priority: 20
port: 80
weight: 10
defaultService:
type: alicloud:fc:Service
properties:
description: example-value
internetAccess: false
defaultRole:
type: alicloud:ram:Role
properties:
document: |2
{
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"cdn.aliyuncs.com"
]
}
}
],
"Version": "1"
}
description: this is a example
force: true
defaultPolicy:
type: alicloud:ram:Policy
properties:
policyName: fcservicepolicy-${defaultRandomInteger.result}
policyDocument: |2
{
"Version": "1",
"Statement": [
{
"Action": [
"fc:InvokeFunction"
],
"Resource": [
"acs:fc:*:*:services/${defaultService.name}/functions/*",
"acs:fc:*:*:services/${defaultService.name}.*/functions/*"
],
"Effect": "Allow"
}
]
}
description: this is a example
force: true
defaultRolePolicyAttachment:
type: alicloud:ram:RolePolicyAttachment
properties:
roleName: ${defaultRole.name}
policyName: ${defaultPolicy.name}
policyType: Custom
defaultBucket:
type: alicloud:oss:Bucket
properties:
bucket: terraform-example-${defaultRandomInteger.result}
# If you upload the function by OSS Bucket, you need to specify path can't upload by content.
defaultBucketObject:
type: alicloud:oss:BucketObject
properties:
bucket: ${defaultBucket.id}
key: index.py
content: "import logging \ndef handler(event, context): \nlogger = logging.getLogger() \nlogger.info('hello world') \nreturn 'hello world'"
defaultFunction:
type: alicloud:fc:Function
properties:
service: ${defaultService.name}
description: example
ossBucket: ${defaultBucket.id}
ossKey: ${defaultBucketObject.key}
memorySize: '512'
runtime: python3.10
handler: hello.handler
defaultTrigger:
type: alicloud:fc:Trigger
properties:
service: ${defaultService.name}
function: ${defaultFunction.name}
role: ${defaultRole.arn}
sourceArn: acs:cdn:*:${defaultAccount.id}
type: cdn_events
config: |2
{"eventName":"LogFileCreated",
"eventVersion":"1.0.0",
"notes":"cdn events trigger",
"filter":{
"domain": ["${defaultDomainNew.domainName}"]
}
}
variables:
defaultAccount:
fn::invoke:
Function: alicloud:getAccount
Arguments: {}
EventBridge trigger:
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
const defaultAccount = alicloud.getAccount({});
const defaultRegions = alicloud.getRegions({
current: true,
});
const defaultRandomInteger = new random.RandomInteger("defaultRandomInteger", {
max: 99999,
min: 10000,
});
const serviceLinkedRole = new alicloud.eventbridge.ServiceLinkedRole("serviceLinkedRole", {productName: "AliyunServiceRoleForEventBridgeSendToFC"});
const defaultService = new alicloud.fc.Service("defaultService", {
description: "example-value",
internetAccess: false,
});
const defaultBucket = new alicloud.oss.Bucket("defaultBucket", {bucket: pulumi.interpolate`terraform-example-${defaultRandomInteger.result}`});
// If you upload the function by OSS Bucket, you need to specify path can't upload by content.
const defaultBucketObject = new alicloud.oss.BucketObject("defaultBucketObject", {
bucket: defaultBucket.id,
key: "index.py",
content: `import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world'`,
});
const defaultFunction = new alicloud.fc.Function("defaultFunction", {
service: defaultService.name,
description: "example",
ossBucket: defaultBucket.id,
ossKey: defaultBucketObject.key,
memorySize: 512,
runtime: "python3.10",
handler: "hello.handler",
});
const ossTrigger = new alicloud.fc.Trigger("ossTrigger", {
service: defaultService.name,
"function": defaultFunction.name,
type: "eventbridge",
config: ` {
"triggerEnable": false,
"asyncInvocationType": false,
"eventRuleFilterPattern": {
"source":[
"acs.oss"
],
"type":[
"oss:BucketCreated:PutBucket"
]
},
"eventSourceConfig": {
"eventSourceType": "Default"
}
}
`,
});
const mnsTrigger = new alicloud.fc.Trigger("mnsTrigger", {
service: defaultService.name,
"function": defaultFunction.name,
type: "eventbridge",
config: ` {
"triggerEnable": false,
"asyncInvocationType": false,
"eventRuleFilterPattern": "{}",
"eventSourceConfig": {
"eventSourceType": "MNS",
"eventSourceParameters": {
"sourceMNSParameters": {
"RegionId": "cn-hangzhou",
"QueueName": "mns-queue",
"IsBase64Decode": true
}
}
}
}
`,
});
const defaultInstance = new alicloud.rocketmq.Instance("defaultInstance", {
instanceName: pulumi.interpolate`terraform-example-${defaultRandomInteger.result}`,
remark: "terraform-example",
});
const defaultGroup = new alicloud.rocketmq.Group("defaultGroup", {
groupName: "GID-example",
instanceId: defaultInstance.id,
remark: "terraform-example",
});
const defaultTopic = new alicloud.rocketmq.Topic("defaultTopic", {
topicName: "mytopic",
instanceId: defaultInstance.id,
messageType: 0,
remark: "terraform-example",
});
const rocketmqTrigger = new alicloud.fc.Trigger("rocketmqTrigger", {
service: defaultService.name,
"function": defaultFunction.name,
type: "eventbridge",
config: pulumi.all([defaultRegions, defaultInstance.id, defaultGroup.groupName, defaultTopic.topicName]).apply(([defaultRegions, id, groupName, topicName]) => ` {
"triggerEnable": false,
"asyncInvocationType": false,
"eventRuleFilterPattern": "{}",
"eventSourceConfig": {
"eventSourceType": "RocketMQ",
"eventSourceParameters": {
"sourceRocketMQParameters": {
"RegionId": "${defaultRegions.regions?.[0]?.id}",
"InstanceId": "${id}",
"GroupID": "${groupName}",
"Topic": "${topicName}",
"Timestamp": 1686296162,
"Tag": "example-tag",
"Offset": "CONSUME_FROM_LAST_OFFSET"
}
}
}
}
`),
});
const defaultAmqp_instanceInstance = new alicloud.amqp.Instance("defaultAmqp/instanceInstance", {
instanceName: pulumi.interpolate`terraform-example-${defaultRandomInteger.result}`,
instanceType: "professional",
maxTps: "1000",
queueCapacity: "50",
supportEip: true,
maxEipTps: "128",
paymentType: "Subscription",
period: 1,
});
const defaultVirtualHost = new alicloud.amqp.VirtualHost("defaultVirtualHost", {
instanceId: defaultAmqp / instanceInstance.id,
virtualHostName: "example-VirtualHost",
});
const defaultQueue = new alicloud.amqp.Queue("defaultQueue", {
instanceId: defaultVirtualHost.instanceId,
queueName: "example-queue",
virtualHostName: defaultVirtualHost.virtualHostName,
});
const rabbitmqTrigger = new alicloud.fc.Trigger("rabbitmqTrigger", {
service: defaultService.name,
"function": defaultFunction.name,
type: "eventbridge",
config: pulumi.all([defaultRegions, defaultVirtualHost.virtualHostName, defaultQueue.queueName]).apply(([defaultRegions, virtualHostName, queueName]) => ` {
"triggerEnable": false,
"asyncInvocationType": false,
"eventRuleFilterPattern": "{}",
"eventSourceConfig": {
"eventSourceType": "RabbitMQ",
"eventSourceParameters": {
"sourceRabbitMQParameters": {
"RegionId": "${defaultRegions.regions?.[0]?.id}",
"InstanceId": "${defaultAmqp / instanceInstance.id}",
"VirtualHostName": "${virtualHostName}",
"QueueName": "${queueName}"
}
}
}
}
`),
});
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
default_account = alicloud.get_account()
default_regions = alicloud.get_regions(current=True)
default_random_integer = random.RandomInteger("defaultRandomInteger",
max=99999,
min=10000)
service_linked_role = alicloud.eventbridge.ServiceLinkedRole("serviceLinkedRole", product_name="AliyunServiceRoleForEventBridgeSendToFC")
default_service = alicloud.fc.Service("defaultService",
description="example-value",
internet_access=False)
default_bucket = alicloud.oss.Bucket("defaultBucket", bucket=default_random_integer.result.apply(lambda result: f"terraform-example-{result}"))
# If you upload the function by OSS Bucket, you need to specify path can't upload by content.
default_bucket_object = alicloud.oss.BucketObject("defaultBucketObject",
bucket=default_bucket.id,
key="index.py",
content="""import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world'""")
default_function = alicloud.fc.Function("defaultFunction",
service=default_service.name,
description="example",
oss_bucket=default_bucket.id,
oss_key=default_bucket_object.key,
memory_size=512,
runtime="python3.10",
handler="hello.handler")
oss_trigger = alicloud.fc.Trigger("ossTrigger",
service=default_service.name,
function=default_function.name,
type="eventbridge",
config=""" {
"triggerEnable": false,
"asyncInvocationType": false,
"eventRuleFilterPattern": {
"source":[
"acs.oss"
],
"type":[
"oss:BucketCreated:PutBucket"
]
},
"eventSourceConfig": {
"eventSourceType": "Default"
}
}
""")
mns_trigger = alicloud.fc.Trigger("mnsTrigger",
service=default_service.name,
function=default_function.name,
type="eventbridge",
config=""" {
"triggerEnable": false,
"asyncInvocationType": false,
"eventRuleFilterPattern": "{}",
"eventSourceConfig": {
"eventSourceType": "MNS",
"eventSourceParameters": {
"sourceMNSParameters": {
"RegionId": "cn-hangzhou",
"QueueName": "mns-queue",
"IsBase64Decode": true
}
}
}
}
""")
default_instance = alicloud.rocketmq.Instance("defaultInstance",
instance_name=default_random_integer.result.apply(lambda result: f"terraform-example-{result}"),
remark="terraform-example")
default_group = alicloud.rocketmq.Group("defaultGroup",
group_name="GID-example",
instance_id=default_instance.id,
remark="terraform-example")
default_topic = alicloud.rocketmq.Topic("defaultTopic",
topic_name="mytopic",
instance_id=default_instance.id,
message_type=0,
remark="terraform-example")
rocketmq_trigger = alicloud.fc.Trigger("rocketmqTrigger",
service=default_service.name,
function=default_function.name,
type="eventbridge",
config=pulumi.Output.all(default_instance.id, default_group.group_name, default_topic.topic_name).apply(lambda id, group_name, topic_name: f""" {{
"triggerEnable": false,
"asyncInvocationType": false,
"eventRuleFilterPattern": "{{}}",
"eventSourceConfig": {{
"eventSourceType": "RocketMQ",
"eventSourceParameters": {{
"sourceRocketMQParameters": {{
"RegionId": "{default_regions.regions[0].id}",
"InstanceId": "{id}",
"GroupID": "{group_name}",
"Topic": "{topic_name}",
"Timestamp": 1686296162,
"Tag": "example-tag",
"Offset": "CONSUME_FROM_LAST_OFFSET"
}}
}}
}}
}}
"""))
default_amqp_instance_instance = alicloud.amqp.Instance("defaultAmqp/instanceInstance",
instance_name=default_random_integer.result.apply(lambda result: f"terraform-example-{result}"),
instance_type="professional",
max_tps="1000",
queue_capacity="50",
support_eip=True,
max_eip_tps="128",
payment_type="Subscription",
period=1)
default_virtual_host = alicloud.amqp.VirtualHost("defaultVirtualHost",
instance_id=default_amqp / instance_instance["id"],
virtual_host_name="example-VirtualHost")
default_queue = alicloud.amqp.Queue("defaultQueue",
instance_id=default_virtual_host.instance_id,
queue_name="example-queue",
virtual_host_name=default_virtual_host.virtual_host_name)
rabbitmq_trigger = alicloud.fc.Trigger("rabbitmqTrigger",
service=default_service.name,
function=default_function.name,
type="eventbridge",
config=pulumi.Output.all(default_virtual_host.virtual_host_name, default_queue.queue_name).apply(lambda virtual_host_name, queue_name: f""" {{
"triggerEnable": false,
"asyncInvocationType": false,
"eventRuleFilterPattern": "{{}}",
"eventSourceConfig": {{
"eventSourceType": "RabbitMQ",
"eventSourceParameters": {{
"sourceRabbitMQParameters": {{
"RegionId": "{default_regions.regions[0].id}",
"InstanceId": "{default_amqp / instance_instance["id"]}",
"VirtualHostName": "{virtual_host_name}",
"QueueName": "{queue_name}"
}}
}}
}}
}}
"""))
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/amqp"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/eventbridge"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/fc"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/oss"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/rocketmq"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := alicloud.GetAccount(ctx, nil, nil)
if err != nil {
return err
}
defaultRegions, err := alicloud.GetRegions(ctx, &alicloud.GetRegionsArgs{
Current: pulumi.BoolRef(true),
}, nil)
if err != nil {
return err
}
defaultRandomInteger, err := random.NewRandomInteger(ctx, "defaultRandomInteger", &random.RandomIntegerArgs{
Max: pulumi.Int(99999),
Min: pulumi.Int(10000),
})
if err != nil {
return err
}
_, err = eventbridge.NewServiceLinkedRole(ctx, "serviceLinkedRole", &eventbridge.ServiceLinkedRoleArgs{
ProductName: pulumi.String("AliyunServiceRoleForEventBridgeSendToFC"),
})
if err != nil {
return err
}
defaultService, err := fc.NewService(ctx, "defaultService", &fc.ServiceArgs{
Description: pulumi.String("example-value"),
InternetAccess: pulumi.Bool(false),
})
if err != nil {
return err
}
defaultBucket, err := oss.NewBucket(ctx, "defaultBucket", &oss.BucketArgs{
Bucket: defaultRandomInteger.Result.ApplyT(func(result int) (string, error) {
return fmt.Sprintf("terraform-example-%v", result), nil
}).(pulumi.StringOutput),
})
if err != nil {
return err
}
// If you upload the function by OSS Bucket, you need to specify path can't upload by content.
defaultBucketObject, err := oss.NewBucketObject(ctx, "defaultBucketObject", &oss.BucketObjectArgs{
Bucket: defaultBucket.ID(),
Key: pulumi.String("index.py"),
Content: pulumi.String("import logging \ndef handler(event, context): \nlogger = logging.getLogger() \nlogger.info('hello world') \nreturn 'hello world'"),
})
if err != nil {
return err
}
defaultFunction, err := fc.NewFunction(ctx, "defaultFunction", &fc.FunctionArgs{
Service: defaultService.Name,
Description: pulumi.String("example"),
OssBucket: defaultBucket.ID(),
OssKey: defaultBucketObject.Key,
MemorySize: pulumi.Int(512),
Runtime: pulumi.String("python3.10"),
Handler: pulumi.String("hello.handler"),
})
if err != nil {
return err
}
_, err = fc.NewTrigger(ctx, "ossTrigger", &fc.TriggerArgs{
Service: defaultService.Name,
Function: defaultFunction.Name,
Type: pulumi.String("eventbridge"),
Config: pulumi.String(` {
"triggerEnable": false,
"asyncInvocationType": false,
"eventRuleFilterPattern": {
"source":[
"acs.oss"
],
"type":[
"oss:BucketCreated:PutBucket"
]
},
"eventSourceConfig": {
"eventSourceType": "Default"
}
}
`),
})
if err != nil {
return err
}
_, err = fc.NewTrigger(ctx, "mnsTrigger", &fc.TriggerArgs{
Service: defaultService.Name,
Function: defaultFunction.Name,
Type: pulumi.String("eventbridge"),
Config: pulumi.String(` {
"triggerEnable": false,
"asyncInvocationType": false,
"eventRuleFilterPattern": "{}",
"eventSourceConfig": {
"eventSourceType": "MNS",
"eventSourceParameters": {
"sourceMNSParameters": {
"RegionId": "cn-hangzhou",
"QueueName": "mns-queue",
"IsBase64Decode": true
}
}
}
}
`),
})
if err != nil {
return err
}
defaultInstance, err := rocketmq.NewInstance(ctx, "defaultInstance", &rocketmq.InstanceArgs{
InstanceName: defaultRandomInteger.Result.ApplyT(func(result int) (string, error) {
return fmt.Sprintf("terraform-example-%v", result), nil
}).(pulumi.StringOutput),
Remark: pulumi.String("terraform-example"),
})
if err != nil {
return err
}
defaultGroup, err := rocketmq.NewGroup(ctx, "defaultGroup", &rocketmq.GroupArgs{
GroupName: pulumi.String("GID-example"),
InstanceId: defaultInstance.ID(),
Remark: pulumi.String("terraform-example"),
})
if err != nil {
return err
}
defaultTopic, err := rocketmq.NewTopic(ctx, "defaultTopic", &rocketmq.TopicArgs{
TopicName: pulumi.String("mytopic"),
InstanceId: defaultInstance.ID(),
MessageType: pulumi.Int(0),
Remark: pulumi.String("terraform-example"),
})
if err != nil {
return err
}
_, err = fc.NewTrigger(ctx, "rocketmqTrigger", &fc.TriggerArgs{
Service: defaultService.Name,
Function: defaultFunction.Name,
Type: pulumi.String("eventbridge"),
Config: pulumi.All(defaultInstance.ID(), defaultGroup.GroupName, defaultTopic.TopicName).ApplyT(func(_args []interface{}) (string, error) {
id := _args[0].(string)
groupName := _args[1].(string)
topicName := _args[2].(string)
return fmt.Sprintf(` {
"triggerEnable": false,
"asyncInvocationType": false,
"eventRuleFilterPattern": "{}",
"eventSourceConfig": {
"eventSourceType": "RocketMQ",
"eventSourceParameters": {
"sourceRocketMQParameters": {
"RegionId": "%v",
"InstanceId": "%v",
"GroupID": "%v",
"Topic": "%v",
"Timestamp": 1686296162,
"Tag": "example-tag",
"Offset": "CONSUME_FROM_LAST_OFFSET"
}
}
}
}
`, defaultRegions.Regions[0].Id, id, groupName, topicName), nil
}).(pulumi.StringOutput),
})
if err != nil {
return err
}
_, err = amqp.NewInstance(ctx, "defaultAmqp/instanceInstance", &amqp.InstanceArgs{
InstanceName: defaultRandomInteger.Result.ApplyT(func(result int) (string, error) {
return fmt.Sprintf("terraform-example-%v", result), nil
}).(pulumi.StringOutput),
InstanceType: pulumi.String("professional"),
MaxTps: pulumi.String("1000"),
QueueCapacity: pulumi.String("50"),
SupportEip: pulumi.Bool(true),
MaxEipTps: pulumi.String("128"),
PaymentType: pulumi.String("Subscription"),
Period: pulumi.Int(1),
})
if err != nil {
return err
}
defaultVirtualHost, err := amqp.NewVirtualHost(ctx, "defaultVirtualHost", &amqp.VirtualHostArgs{
InstanceId: defaultAmqp / instanceInstance.Id,
VirtualHostName: pulumi.String("example-VirtualHost"),
})
if err != nil {
return err
}
defaultQueue, err := amqp.NewQueue(ctx, "defaultQueue", &amqp.QueueArgs{
InstanceId: defaultVirtualHost.InstanceId,
QueueName: pulumi.String("example-queue"),
VirtualHostName: defaultVirtualHost.VirtualHostName,
})
if err != nil {
return err
}
_, err = fc.NewTrigger(ctx, "rabbitmqTrigger", &fc.TriggerArgs{
Service: defaultService.Name,
Function: defaultFunction.Name,
Type: pulumi.String("eventbridge"),
Config: pulumi.All(defaultVirtualHost.VirtualHostName, defaultQueue.QueueName).ApplyT(func(_args []interface{}) (string, error) {
virtualHostName := _args[0].(string)
queueName := _args[1].(string)
return fmt.Sprintf(` {
"triggerEnable": false,
"asyncInvocationType": false,
"eventRuleFilterPattern": "{}",
"eventSourceConfig": {
"eventSourceType": "RabbitMQ",
"eventSourceParameters": {
"sourceRabbitMQParameters": {
"RegionId": "%v",
"InstanceId": "%v",
"VirtualHostName": "%v",
"QueueName": "%v"
}
}
}
}
`, defaultRegions.Regions[0].Id, defaultAmqp/instanceInstance.Id, virtualHostName, queueName), nil
}).(pulumi.StringOutput),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var defaultAccount = AliCloud.GetAccount.Invoke();
var defaultRegions = AliCloud.GetRegions.Invoke(new()
{
Current = true,
});
var defaultRandomInteger = new Random.RandomInteger("defaultRandomInteger", new()
{
Max = 99999,
Min = 10000,
});
var serviceLinkedRole = new AliCloud.EventBridge.ServiceLinkedRole("serviceLinkedRole", new()
{
ProductName = "AliyunServiceRoleForEventBridgeSendToFC",
});
var defaultService = new AliCloud.FC.Service("defaultService", new()
{
Description = "example-value",
InternetAccess = false,
});
var defaultBucket = new AliCloud.Oss.Bucket("defaultBucket", new()
{
BucketName = defaultRandomInteger.Result.Apply(result => $"terraform-example-{result}"),
});
// If you upload the function by OSS Bucket, you need to specify path can't upload by content.
var defaultBucketObject = new AliCloud.Oss.BucketObject("defaultBucketObject", new()
{
Bucket = defaultBucket.Id,
Key = "index.py",
Content = @"import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world'",
});
var defaultFunction = new AliCloud.FC.Function("defaultFunction", new()
{
Service = defaultService.Name,
Description = "example",
OssBucket = defaultBucket.Id,
OssKey = defaultBucketObject.Key,
MemorySize = 512,
Runtime = "python3.10",
Handler = "hello.handler",
});
var ossTrigger = new AliCloud.FC.Trigger("ossTrigger", new()
{
Service = defaultService.Name,
Function = defaultFunction.Name,
Type = "eventbridge",
Config = @" {
""triggerEnable"": false,
""asyncInvocationType"": false,
""eventRuleFilterPattern"": {
""source"":[
""acs.oss""
],
""type"":[
""oss:BucketCreated:PutBucket""
]
},
""eventSourceConfig"": {
""eventSourceType"": ""Default""
}
}
",
});
var mnsTrigger = new AliCloud.FC.Trigger("mnsTrigger", new()
{
Service = defaultService.Name,
Function = defaultFunction.Name,
Type = "eventbridge",
Config = @" {
""triggerEnable"": false,
""asyncInvocationType"": false,
""eventRuleFilterPattern"": ""{}"",
""eventSourceConfig"": {
""eventSourceType"": ""MNS"",
""eventSourceParameters"": {
""sourceMNSParameters"": {
""RegionId"": ""cn-hangzhou"",
""QueueName"": ""mns-queue"",
""IsBase64Decode"": true
}
}
}
}
",
});
var defaultInstance = new AliCloud.RocketMQ.Instance("defaultInstance", new()
{
InstanceName = defaultRandomInteger.Result.Apply(result => $"terraform-example-{result}"),
Remark = "terraform-example",
});
var defaultGroup = new AliCloud.RocketMQ.Group("defaultGroup", new()
{
GroupName = "GID-example",
InstanceId = defaultInstance.Id,
Remark = "terraform-example",
});
var defaultTopic = new AliCloud.RocketMQ.Topic("defaultTopic", new()
{
TopicName = "mytopic",
InstanceId = defaultInstance.Id,
MessageType = 0,
Remark = "terraform-example",
});
var rocketmqTrigger = new AliCloud.FC.Trigger("rocketmqTrigger", new()
{
Service = defaultService.Name,
Function = defaultFunction.Name,
Type = "eventbridge",
Config = Output.Tuple(defaultRegions, defaultInstance.Id, defaultGroup.GroupName, defaultTopic.TopicName).Apply(values =>
{
var defaultRegions = values.Item1;
var id = values.Item2;
var groupName = values.Item3;
var topicName = values.Item4;
return @$" {{
""triggerEnable"": false,
""asyncInvocationType"": false,
""eventRuleFilterPattern"": ""{{}}"",
""eventSourceConfig"": {{
""eventSourceType"": ""RocketMQ"",
""eventSourceParameters"": {{
""sourceRocketMQParameters"": {{
""RegionId"": ""{defaultRegions.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id)}"",
""InstanceId"": ""{id}"",
""GroupID"": ""{groupName}"",
""Topic"": ""{topicName}"",
""Timestamp"": 1686296162,
""Tag"": ""example-tag"",
""Offset"": ""CONSUME_FROM_LAST_OFFSET""
}}
}}
}}
}}
";
}),
});
var defaultAmqp_instanceInstance = new AliCloud.Amqp.Instance("defaultAmqp/instanceInstance", new()
{
InstanceName = defaultRandomInteger.Result.Apply(result => $"terraform-example-{result}"),
InstanceType = "professional",
MaxTps = "1000",
QueueCapacity = "50",
SupportEip = true,
MaxEipTps = "128",
PaymentType = "Subscription",
Period = 1,
});
var defaultVirtualHost = new AliCloud.Amqp.VirtualHost("defaultVirtualHost", new()
{
InstanceId = defaultAmqp / instanceInstance.Id,
VirtualHostName = "example-VirtualHost",
});
var defaultQueue = new AliCloud.Amqp.Queue("defaultQueue", new()
{
InstanceId = defaultVirtualHost.InstanceId,
QueueName = "example-queue",
VirtualHostName = defaultVirtualHost.VirtualHostName,
});
var rabbitmqTrigger = new AliCloud.FC.Trigger("rabbitmqTrigger", new()
{
Service = defaultService.Name,
Function = defaultFunction.Name,
Type = "eventbridge",
Config = Output.Tuple(defaultRegions, defaultVirtualHost.VirtualHostName, defaultQueue.QueueName).Apply(values =>
{
var defaultRegions = values.Item1;
var virtualHostName = values.Item2;
var queueName = values.Item3;
return @$" {{
""triggerEnable"": false,
""asyncInvocationType"": false,
""eventRuleFilterPattern"": ""{{}}"",
""eventSourceConfig"": {{
""eventSourceType"": ""RabbitMQ"",
""eventSourceParameters"": {{
""sourceRabbitMQParameters"": {{
""RegionId"": ""{defaultRegions.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id)}"",
""InstanceId"": ""{defaultAmqp / instanceInstance.Id}"",
""VirtualHostName"": ""{virtualHostName}"",
""QueueName"": ""{queueName}""
}}
}}
}}
}}
";
}),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetRegionsArgs;
import com.pulumi.random.RandomInteger;
import com.pulumi.random.RandomIntegerArgs;
import com.pulumi.alicloud.eventbridge.ServiceLinkedRole;
import com.pulumi.alicloud.eventbridge.ServiceLinkedRoleArgs;
import com.pulumi.alicloud.fc.Service;
import com.pulumi.alicloud.fc.ServiceArgs;
import com.pulumi.alicloud.oss.Bucket;
import com.pulumi.alicloud.oss.BucketArgs;
import com.pulumi.alicloud.oss.BucketObject;
import com.pulumi.alicloud.oss.BucketObjectArgs;
import com.pulumi.alicloud.fc.Function;
import com.pulumi.alicloud.fc.FunctionArgs;
import com.pulumi.alicloud.fc.Trigger;
import com.pulumi.alicloud.fc.TriggerArgs;
import com.pulumi.alicloud.rocketmq.Instance;
import com.pulumi.alicloud.rocketmq.InstanceArgs;
import com.pulumi.alicloud.rocketmq.Group;
import com.pulumi.alicloud.rocketmq.GroupArgs;
import com.pulumi.alicloud.rocketmq.Topic;
import com.pulumi.alicloud.rocketmq.TopicArgs;
import com.pulumi.alicloud.amqp.Instance;
import com.pulumi.alicloud.amqp.InstanceArgs;
import com.pulumi.alicloud.amqp.VirtualHost;
import com.pulumi.alicloud.amqp.VirtualHostArgs;
import com.pulumi.alicloud.amqp.Queue;
import com.pulumi.alicloud.amqp.QueueArgs;
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) {
final var defaultAccount = AlicloudFunctions.getAccount();
final var defaultRegions = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
.current(true)
.build());
var defaultRandomInteger = new RandomInteger("defaultRandomInteger", RandomIntegerArgs.builder()
.max(99999)
.min(10000)
.build());
var serviceLinkedRole = new ServiceLinkedRole("serviceLinkedRole", ServiceLinkedRoleArgs.builder()
.productName("AliyunServiceRoleForEventBridgeSendToFC")
.build());
var defaultService = new Service("defaultService", ServiceArgs.builder()
.description("example-value")
.internetAccess(false)
.build());
var defaultBucket = new Bucket("defaultBucket", BucketArgs.builder()
.bucket(defaultRandomInteger.result().applyValue(result -> String.format("terraform-example-%s", result)))
.build());
var defaultBucketObject = new BucketObject("defaultBucketObject", BucketObjectArgs.builder()
.bucket(defaultBucket.id())
.key("index.py")
.content("""
import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world' """)
.build());
var defaultFunction = new Function("defaultFunction", FunctionArgs.builder()
.service(defaultService.name())
.description("example")
.ossBucket(defaultBucket.id())
.ossKey(defaultBucketObject.key())
.memorySize("512")
.runtime("python3.10")
.handler("hello.handler")
.build());
var ossTrigger = new Trigger("ossTrigger", TriggerArgs.builder()
.service(defaultService.name())
.function(defaultFunction.name())
.type("eventbridge")
.config("""
{
"triggerEnable": false,
"asyncInvocationType": false,
"eventRuleFilterPattern": {
"source":[
"acs.oss"
],
"type":[
"oss:BucketCreated:PutBucket"
]
},
"eventSourceConfig": {
"eventSourceType": "Default"
}
}
""")
.build());
var mnsTrigger = new Trigger("mnsTrigger", TriggerArgs.builder()
.service(defaultService.name())
.function(defaultFunction.name())
.type("eventbridge")
.config("""
{
"triggerEnable": false,
"asyncInvocationType": false,
"eventRuleFilterPattern": "{}",
"eventSourceConfig": {
"eventSourceType": "MNS",
"eventSourceParameters": {
"sourceMNSParameters": {
"RegionId": "cn-hangzhou",
"QueueName": "mns-queue",
"IsBase64Decode": true
}
}
}
}
""")
.build());
var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
.instanceName(defaultRandomInteger.result().applyValue(result -> String.format("terraform-example-%s", result)))
.remark("terraform-example")
.build());
var defaultGroup = new Group("defaultGroup", GroupArgs.builder()
.groupName("GID-example")
.instanceId(defaultInstance.id())
.remark("terraform-example")
.build());
var defaultTopic = new Topic("defaultTopic", TopicArgs.builder()
.topicName("mytopic")
.instanceId(defaultInstance.id())
.messageType(0)
.remark("terraform-example")
.build());
var rocketmqTrigger = new Trigger("rocketmqTrigger", TriggerArgs.builder()
.service(defaultService.name())
.function(defaultFunction.name())
.type("eventbridge")
.config(Output.tuple(defaultInstance.id(), defaultGroup.groupName(), defaultTopic.topicName()).applyValue(values -> {
var id = values.t1;
var groupName = values.t2;
var topicName = values.t3;
return """
{
"triggerEnable": false,
"asyncInvocationType": false,
"eventRuleFilterPattern": "{}",
"eventSourceConfig": {
"eventSourceType": "RocketMQ",
"eventSourceParameters": {
"sourceRocketMQParameters": {
"RegionId": "%s",
"InstanceId": "%s",
"GroupID": "%s",
"Topic": "%s",
"Timestamp": 1686296162,
"Tag": "example-tag",
"Offset": "CONSUME_FROM_LAST_OFFSET"
}
}
}
}
", defaultRegions.applyValue(getRegionsResult -> getRegionsResult.regions()[0].id()),id,groupName,topicName);
}))
.build());
var defaultAmqp_instanceInstance = new Instance("defaultAmqp/instanceInstance", InstanceArgs.builder()
.instanceName(defaultRandomInteger.result().applyValue(result -> String.format("terraform-example-%s", result)))
.instanceType("professional")
.maxTps(1000)
.queueCapacity(50)
.supportEip(true)
.maxEipTps(128)
.paymentType("Subscription")
.period(1)
.build());
var defaultVirtualHost = new VirtualHost("defaultVirtualHost", VirtualHostArgs.builder()
.instanceId(defaultAmqp / instanceInstance.id())
.virtualHostName("example-VirtualHost")
.build());
var defaultQueue = new Queue("defaultQueue", QueueArgs.builder()
.instanceId(defaultVirtualHost.instanceId())
.queueName("example-queue")
.virtualHostName(defaultVirtualHost.virtualHostName())
.build());
var rabbitmqTrigger = new Trigger("rabbitmqTrigger", TriggerArgs.builder()
.service(defaultService.name())
.function(defaultFunction.name())
.type("eventbridge")
.config(Output.tuple(defaultVirtualHost.virtualHostName(), defaultQueue.queueName()).applyValue(values -> {
var virtualHostName = values.t1;
var queueName = values.t2;
return """
{
"triggerEnable": false,
"asyncInvocationType": false,
"eventRuleFilterPattern": "{}",
"eventSourceConfig": {
"eventSourceType": "RabbitMQ",
"eventSourceParameters": {
"sourceRabbitMQParameters": {
"RegionId": "%s",
"InstanceId": "%s",
"VirtualHostName": "%s",
"QueueName": "%s"
}
}
}
}
", defaultRegions.applyValue(getRegionsResult -> getRegionsResult.regions()[0].id()),defaultAmqp / instanceInstance.id(),virtualHostName,queueName);
}))
.build());
}
}
Coming soon!```
</pulumi-choosable>
</div>
## Module Support
You can use to the existing fc module
to create several triggers quickly.
## Create Trigger Resource {#create}
<div>
<pulumi-chooser type="language" options="typescript,python,go,csharp,java,yaml"></pulumi-chooser>
</div>
<div>
<pulumi-choosable type="language" values="javascript,typescript">
<div class="highlight"><pre class="chroma"><code class="language-typescript" data-lang="typescript"><span class="k">new </span><span class="nx">Trigger</span><span class="p">(</span><span class="nx">name</span><span class="p">:</span> <span class="nx">string</span><span class="p">,</span> <span class="nx">args</span><span class="p">:</span> <span class="nx"><a href="#inputs">TriggerArgs</a></span><span class="p">,</span> <span class="nx">opts</span><span class="p">?:</span> <span class="nx"><a href="/docs/reference/pkg/nodejs/pulumi/pulumi/#CustomResourceOptions">CustomResourceOptions</a></span><span class="p">);</span></code></pre></div>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="python">
<div class="highlight"><pre class="chroma"><code class="language-python" data-lang="python"><span class=nd>@overload</span>
<span class="k">def </span><span class="nx">Trigger</span><span class="p">(</span><span class="nx">resource_name</span><span class="p">:</span> <span class="nx">str</span><span class="p">,</span>
<span class="nx">opts</span><span class="p">:</span> <span class="nx"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">Optional[ResourceOptions]</a></span> = None<span class="p">,</span>
<span class="nx">config</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">config_mns</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">function</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">name</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">name_prefix</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">role</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">service</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">source_arn</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">type</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">)</span>
<span class=nd>@overload</span>
<span class="k">def </span><span class="nx">Trigger</span><span class="p">(</span><span class="nx">resource_name</span><span class="p">:</span> <span class="nx">str</span><span class="p">,</span>
<span class="nx">args</span><span class="p">:</span> <span class="nx"><a href="#inputs">TriggerArgs</a></span><span class="p">,</span>
<span class="nx">opts</span><span class="p">:</span> <span class="nx"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">Optional[ResourceOptions]</a></span> = None<span class="p">)</span></code></pre></div>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="go">
<div class="highlight"><pre class="chroma"><code class="language-go" data-lang="go"><span class="k">func </span><span class="nx">NewTrigger</span><span class="p">(</span><span class="nx">ctx</span><span class="p"> *</span><span class="nx"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#Context">Context</a></span><span class="p">,</span> <span class="nx">name</span><span class="p"> </span><span class="nx">string</span><span class="p">,</span> <span class="nx">args</span><span class="p"> </span><span class="nx"><a href="#inputs">TriggerArgs</a></span><span class="p">,</span> <span class="nx">opts</span><span class="p"> ...</span><span class="nx"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#ResourceOption">ResourceOption</a></span><span class="p">) (*<span class="nx">Trigger</span>, error)</span></code></pre></div>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="csharp">
<div class="highlight"><pre class="chroma"><code class="language-csharp" data-lang="csharp"><span class="k">public </span><span class="nx">Trigger</span><span class="p">(</span><span class="nx">string</span><span class="p"> </span><span class="nx">name<span class="p">,</span> <span class="nx"><a href="#inputs">TriggerArgs</a></span><span class="p"> </span><span class="nx">args<span class="p">,</span> <span class="nx"><a href="/docs/reference/pkg/dotnet/Pulumi/Pulumi.CustomResourceOptions.html">CustomResourceOptions</a></span><span class="p">? </span><span class="nx">opts = null<span class="p">)</span></code></pre></div>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="java">
<div class="highlight"><pre class="chroma">
<code class="language-java" data-lang="java"><span class="k">public </span><span class="nx">Trigger</span><span class="p">(</span><span class="nx">String</span><span class="p"> </span><span class="nx">name<span class="p">,</span> <span class="nx"><a href="#inputs">TriggerArgs</a></span><span class="p"> </span><span class="nx">args<span class="p">)</span>
<span class="k">public </span><span class="nx">Trigger</span><span class="p">(</span><span class="nx">String</span><span class="p"> </span><span class="nx">name<span class="p">,</span> <span class="nx"><a href="#inputs">TriggerArgs</a></span><span class="p"> </span><span class="nx">args<span class="p">,</span> <span class="nx">CustomResourceOptions</span><span class="p"> </span><span class="nx">options<span class="p">)</span>
</code></pre></div>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="yaml">
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">type: <span class="nx">alicloud:fc:Trigger</span><span class="p"></span>
<span class="p">properties</span><span class="p">: </span><span class="c"># The arguments to resource properties.</span>
<span class="p"></span><span class="p">options</span><span class="p">: </span><span class="c"># Bag of options to control resource's behavior.</span>
<span class="p"></span>
</code></pre></div>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="javascript,typescript">
<dl class="resources-properties"><dt
class="property-required" title="Required">
<span>name</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The unique name of the resource.</dd><dt
class="property-required" title="Required">
<span>args</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#inputs">TriggerArgs</a></span>
</dt>
<dd>The arguments to resource properties.</dd><dt
class="property-optional" title="Optional">
<span>opts</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="/docs/reference/pkg/nodejs/pulumi/pulumi/#CustomResourceOptions">CustomResourceOptions</a></span>
</dt>
<dd>Bag of options to control resource's behavior.</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="python">
<dl class="resources-properties"><dt
class="property-required" title="Required">
<span>resource_name</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>The unique name of the resource.</dd><dt
class="property-required" title="Required">
<span>args</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#inputs">TriggerArgs</a></span>
</dt>
<dd>The arguments to resource properties.</dd><dt
class="property-optional" title="Optional">
<span>opts</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">ResourceOptions</a></span>
</dt>
<dd>Bag of options to control resource's behavior.</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="go">
<dl class="resources-properties"><dt
class="property-optional" title="Optional">
<span>ctx</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#Context">Context</a></span>
</dt>
<dd>Context object for the current deployment.</dd><dt
class="property-required" title="Required">
<span>name</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The unique name of the resource.</dd><dt
class="property-required" title="Required">
<span>args</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#inputs">TriggerArgs</a></span>
</dt>
<dd>The arguments to resource properties.</dd><dt
class="property-optional" title="Optional">
<span>opts</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#ResourceOption">ResourceOption</a></span>
</dt>
<dd>Bag of options to control resource's behavior.</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="csharp">
<dl class="resources-properties"><dt
class="property-required" title="Required">
<span>name</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The unique name of the resource.</dd><dt
class="property-required" title="Required">
<span>args</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#inputs">TriggerArgs</a></span>
</dt>
<dd>The arguments to resource properties.</dd><dt
class="property-optional" title="Optional">
<span>opts</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="/docs/reference/pkg/dotnet/Pulumi/Pulumi.CustomResourceOptions.html">CustomResourceOptions</a></span>
</dt>
<dd>Bag of options to control resource's behavior.</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="java">
<dl class="resources-properties"><dt
class="property-required" title="Required">
<span>name</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The unique name of the resource.</dd><dt
class="property-required" title="Required">
<span>args</span>
<span class="property-indicator"></span>
<span class="property-type"><a href="#inputs">TriggerArgs</a></span>
</dt>
<dd>The arguments to resource properties.</dd><dt
class="property-optional" title="Optional">
<span>options</span>
<span class="property-indicator"></span>
<span class="property-type">CustomResourceOptions</span>
</dt>
<dd>Bag of options to control resource's behavior.</dd></dl>
</pulumi-choosable>
</div>
## Trigger Resource Properties {#properties}
To learn more about resource properties and how to use them, see [Inputs and Outputs](/docs/intro/concepts/inputs-outputs) in the Architecture and Concepts docs.
### Inputs
The Trigger resource accepts the following [input](/docs/intro/concepts/inputs-outputs) properties:
<div>
<pulumi-choosable type="language" values="csharp">
<dl class="resources-properties"><dt class="property-required property-replacement"
title="Required">
<span id="function_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#function_csharp" style="color: inherit; text-decoration: inherit;">Function</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute function name.</dd><dt class="property-required property-replacement"
title="Required">
<span id="service_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#service_csharp" style="color: inherit; text-decoration: inherit;">Service</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute service name.</dd><dt class="property-required property-replacement"
title="Required">
<span id="type_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#type_csharp" style="color: inherit; text-decoration: inherit;">Type</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd><p>The Type of the trigger. Valid values: ["oss", "log", "timer", "http", "mns_topic", "cdn_events", "eventbridge"].</p>
<blockquote>
<p><strong>NOTE:</strong> Config does not support modification when type is mns_topic.
<strong>NOTE:</strong> type = cdn_events, available in 1.47.0+.
<strong>NOTE:</strong> type = eventbridge, available in 1.173.0+.</p>
</blockquote>
</dd><dt class="property-optional"
title="Optional">
<span id="config_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#config_csharp" style="color: inherit; text-decoration: inherit;">Config</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The config of Function Compute trigger.It is valid when <code>type</code> is not "mns_topic".See <a href="https://www.alibabacloud.com/help/doc-detail/70140.htm">Configure triggers and events</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="configmns_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#configmns_csharp" style="color: inherit; text-decoration: inherit;">Config<wbr>Mns</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The config of Function Compute trigger when the type is "mns_topic".It is conflict with <code>config</code>.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="name_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#name_csharp" style="color: inherit; text-decoration: inherit;">Name</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute trigger name. It is the only in one service and is conflict with "name_prefix".</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="nameprefix_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#nameprefix_csharp" style="color: inherit; text-decoration: inherit;">Name<wbr>Prefix</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>Setting a prefix to get a only trigger name. It is conflict with "name".</dd><dt class="property-optional"
title="Optional">
<span id="role_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#role_csharp" style="color: inherit; text-decoration: inherit;">Role</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>RAM role arn attached to the Function Compute trigger. Role used by the event source to call the function. The value format is "acs:ram::$account-id:role/$role-name". See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="sourcearn_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#sourcearn_csharp" style="color: inherit; text-decoration: inherit;">Source<wbr>Arn</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>Event source resource address. See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="go">
<dl class="resources-properties"><dt class="property-required property-replacement"
title="Required">
<span id="function_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#function_go" style="color: inherit; text-decoration: inherit;">Function</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute function name.</dd><dt class="property-required property-replacement"
title="Required">
<span id="service_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#service_go" style="color: inherit; text-decoration: inherit;">Service</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute service name.</dd><dt class="property-required property-replacement"
title="Required">
<span id="type_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#type_go" style="color: inherit; text-decoration: inherit;">Type</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd><p>The Type of the trigger. Valid values: ["oss", "log", "timer", "http", "mns_topic", "cdn_events", "eventbridge"].</p>
<blockquote>
<p><strong>NOTE:</strong> Config does not support modification when type is mns_topic.
<strong>NOTE:</strong> type = cdn_events, available in 1.47.0+.
<strong>NOTE:</strong> type = eventbridge, available in 1.173.0+.</p>
</blockquote>
</dd><dt class="property-optional"
title="Optional">
<span id="config_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#config_go" style="color: inherit; text-decoration: inherit;">Config</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The config of Function Compute trigger.It is valid when <code>type</code> is not "mns_topic".See <a href="https://www.alibabacloud.com/help/doc-detail/70140.htm">Configure triggers and events</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="configmns_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#configmns_go" style="color: inherit; text-decoration: inherit;">Config<wbr>Mns</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The config of Function Compute trigger when the type is "mns_topic".It is conflict with <code>config</code>.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="name_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#name_go" style="color: inherit; text-decoration: inherit;">Name</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute trigger name. It is the only in one service and is conflict with "name_prefix".</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="nameprefix_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#nameprefix_go" style="color: inherit; text-decoration: inherit;">Name<wbr>Prefix</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>Setting a prefix to get a only trigger name. It is conflict with "name".</dd><dt class="property-optional"
title="Optional">
<span id="role_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#role_go" style="color: inherit; text-decoration: inherit;">Role</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>RAM role arn attached to the Function Compute trigger. Role used by the event source to call the function. The value format is "acs:ram::$account-id:role/$role-name". See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="sourcearn_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#sourcearn_go" style="color: inherit; text-decoration: inherit;">Source<wbr>Arn</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>Event source resource address. See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="java">
<dl class="resources-properties"><dt class="property-required property-replacement"
title="Required">
<span id="function_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#function_java" style="color: inherit; text-decoration: inherit;">function</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The Function Compute function name.</dd><dt class="property-required property-replacement"
title="Required">
<span id="service_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#service_java" style="color: inherit; text-decoration: inherit;">service</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The Function Compute service name.</dd><dt class="property-required property-replacement"
title="Required">
<span id="type_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#type_java" style="color: inherit; text-decoration: inherit;">type</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd><p>The Type of the trigger. Valid values: ["oss", "log", "timer", "http", "mns_topic", "cdn_events", "eventbridge"].</p>
<blockquote>
<p><strong>NOTE:</strong> Config does not support modification when type is mns_topic.
<strong>NOTE:</strong> type = cdn_events, available in 1.47.0+.
<strong>NOTE:</strong> type = eventbridge, available in 1.173.0+.</p>
</blockquote>
</dd><dt class="property-optional"
title="Optional">
<span id="config_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#config_java" style="color: inherit; text-decoration: inherit;">config</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The config of Function Compute trigger.It is valid when <code>type</code> is not "mns_topic".See <a href="https://www.alibabacloud.com/help/doc-detail/70140.htm">Configure triggers and events</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="configmns_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#configmns_java" style="color: inherit; text-decoration: inherit;">config<wbr>Mns</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The config of Function Compute trigger when the type is "mns_topic".It is conflict with <code>config</code>.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="name_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#name_java" style="color: inherit; text-decoration: inherit;">name</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The Function Compute trigger name. It is the only in one service and is conflict with "name_prefix".</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="nameprefix_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#nameprefix_java" style="color: inherit; text-decoration: inherit;">name<wbr>Prefix</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>Setting a prefix to get a only trigger name. It is conflict with "name".</dd><dt class="property-optional"
title="Optional">
<span id="role_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#role_java" style="color: inherit; text-decoration: inherit;">role</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>RAM role arn attached to the Function Compute trigger. Role used by the event source to call the function. The value format is "acs:ram::$account-id:role/$role-name". See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="sourcearn_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#sourcearn_java" style="color: inherit; text-decoration: inherit;">source<wbr>Arn</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>Event source resource address. See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="javascript,typescript">
<dl class="resources-properties"><dt class="property-required property-replacement"
title="Required">
<span id="function_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#function_nodejs" style="color: inherit; text-decoration: inherit;">function</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute function name.</dd><dt class="property-required property-replacement"
title="Required">
<span id="service_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#service_nodejs" style="color: inherit; text-decoration: inherit;">service</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute service name.</dd><dt class="property-required property-replacement"
title="Required">
<span id="type_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#type_nodejs" style="color: inherit; text-decoration: inherit;">type</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd><p>The Type of the trigger. Valid values: ["oss", "log", "timer", "http", "mns_topic", "cdn_events", "eventbridge"].</p>
<blockquote>
<p><strong>NOTE:</strong> Config does not support modification when type is mns_topic.
<strong>NOTE:</strong> type = cdn_events, available in 1.47.0+.
<strong>NOTE:</strong> type = eventbridge, available in 1.173.0+.</p>
</blockquote>
</dd><dt class="property-optional"
title="Optional">
<span id="config_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#config_nodejs" style="color: inherit; text-decoration: inherit;">config</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The config of Function Compute trigger.It is valid when <code>type</code> is not "mns_topic".See <a href="https://www.alibabacloud.com/help/doc-detail/70140.htm">Configure triggers and events</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="configmns_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#configmns_nodejs" style="color: inherit; text-decoration: inherit;">config<wbr>Mns</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The config of Function Compute trigger when the type is "mns_topic".It is conflict with <code>config</code>.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="name_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#name_nodejs" style="color: inherit; text-decoration: inherit;">name</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute trigger name. It is the only in one service and is conflict with "name_prefix".</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="nameprefix_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#nameprefix_nodejs" style="color: inherit; text-decoration: inherit;">name<wbr>Prefix</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>Setting a prefix to get a only trigger name. It is conflict with "name".</dd><dt class="property-optional"
title="Optional">
<span id="role_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#role_nodejs" style="color: inherit; text-decoration: inherit;">role</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>RAM role arn attached to the Function Compute trigger. Role used by the event source to call the function. The value format is "acs:ram::$account-id:role/$role-name". See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="sourcearn_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#sourcearn_nodejs" style="color: inherit; text-decoration: inherit;">source<wbr>Arn</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>Event source resource address. See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="python">
<dl class="resources-properties"><dt class="property-required property-replacement"
title="Required">
<span id="function_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#function_python" style="color: inherit; text-decoration: inherit;">function</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>The Function Compute function name.</dd><dt class="property-required property-replacement"
title="Required">
<span id="service_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#service_python" style="color: inherit; text-decoration: inherit;">service</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>The Function Compute service name.</dd><dt class="property-required property-replacement"
title="Required">
<span id="type_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#type_python" style="color: inherit; text-decoration: inherit;">type</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd><p>The Type of the trigger. Valid values: ["oss", "log", "timer", "http", "mns_topic", "cdn_events", "eventbridge"].</p>
<blockquote>
<p><strong>NOTE:</strong> Config does not support modification when type is mns_topic.
<strong>NOTE:</strong> type = cdn_events, available in 1.47.0+.
<strong>NOTE:</strong> type = eventbridge, available in 1.173.0+.</p>
</blockquote>
</dd><dt class="property-optional"
title="Optional">
<span id="config_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#config_python" style="color: inherit; text-decoration: inherit;">config</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>The config of Function Compute trigger.It is valid when <code>type</code> is not "mns_topic".See <a href="https://www.alibabacloud.com/help/doc-detail/70140.htm">Configure triggers and events</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="config_mns_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#config_mns_python" style="color: inherit; text-decoration: inherit;">config_<wbr>mns</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>The config of Function Compute trigger when the type is "mns_topic".It is conflict with <code>config</code>.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="name_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#name_python" style="color: inherit; text-decoration: inherit;">name</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>The Function Compute trigger name. It is the only in one service and is conflict with "name_prefix".</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="name_prefix_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#name_prefix_python" style="color: inherit; text-decoration: inherit;">name_<wbr>prefix</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>Setting a prefix to get a only trigger name. It is conflict with "name".</dd><dt class="property-optional"
title="Optional">
<span id="role_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#role_python" style="color: inherit; text-decoration: inherit;">role</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>RAM role arn attached to the Function Compute trigger. Role used by the event source to call the function. The value format is "acs:ram::$account-id:role/$role-name". See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="source_arn_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#source_arn_python" style="color: inherit; text-decoration: inherit;">source_<wbr>arn</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>Event source resource address. See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="yaml">
<dl class="resources-properties"><dt class="property-required property-replacement"
title="Required">
<span id="function_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#function_yaml" style="color: inherit; text-decoration: inherit;">function</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The Function Compute function name.</dd><dt class="property-required property-replacement"
title="Required">
<span id="service_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#service_yaml" style="color: inherit; text-decoration: inherit;">service</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The Function Compute service name.</dd><dt class="property-required property-replacement"
title="Required">
<span id="type_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#type_yaml" style="color: inherit; text-decoration: inherit;">type</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd><p>The Type of the trigger. Valid values: ["oss", "log", "timer", "http", "mns_topic", "cdn_events", "eventbridge"].</p>
<blockquote>
<p><strong>NOTE:</strong> Config does not support modification when type is mns_topic.
<strong>NOTE:</strong> type = cdn_events, available in 1.47.0+.
<strong>NOTE:</strong> type = eventbridge, available in 1.173.0+.</p>
</blockquote>
</dd><dt class="property-optional"
title="Optional">
<span id="config_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#config_yaml" style="color: inherit; text-decoration: inherit;">config</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The config of Function Compute trigger.It is valid when <code>type</code> is not "mns_topic".See <a href="https://www.alibabacloud.com/help/doc-detail/70140.htm">Configure triggers and events</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="configmns_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#configmns_yaml" style="color: inherit; text-decoration: inherit;">config<wbr>Mns</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The config of Function Compute trigger when the type is "mns_topic".It is conflict with <code>config</code>.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="name_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#name_yaml" style="color: inherit; text-decoration: inherit;">name</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The Function Compute trigger name. It is the only in one service and is conflict with "name_prefix".</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="nameprefix_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#nameprefix_yaml" style="color: inherit; text-decoration: inherit;">name<wbr>Prefix</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>Setting a prefix to get a only trigger name. It is conflict with "name".</dd><dt class="property-optional"
title="Optional">
<span id="role_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#role_yaml" style="color: inherit; text-decoration: inherit;">role</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>RAM role arn attached to the Function Compute trigger. Role used by the event source to call the function. The value format is "acs:ram::$account-id:role/$role-name". See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="sourcearn_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#sourcearn_yaml" style="color: inherit; text-decoration: inherit;">source<wbr>Arn</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>Event source resource address. See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd></dl>
</pulumi-choosable>
</div>
### Outputs
All [input](#inputs) properties are implicitly available as output properties. Additionally, the Trigger resource produces the following output properties:
<div>
<pulumi-choosable type="language" values="csharp">
<dl class="resources-properties"><dt class="property-"
title="">
<span id="id_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#id_csharp" style="color: inherit; text-decoration: inherit;">Id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The provider-assigned unique ID for this managed resource.</dd><dt class="property-"
title="">
<span id="lastmodified_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#lastmodified_csharp" style="color: inherit; text-decoration: inherit;">Last<wbr>Modified</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The date this resource was last modified.</dd><dt class="property-"
title="">
<span id="triggerid_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#triggerid_csharp" style="color: inherit; text-decoration: inherit;">Trigger<wbr>Id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute trigger ID.</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="go">
<dl class="resources-properties"><dt class="property-"
title="">
<span id="id_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#id_go" style="color: inherit; text-decoration: inherit;">Id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The provider-assigned unique ID for this managed resource.</dd><dt class="property-"
title="">
<span id="lastmodified_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#lastmodified_go" style="color: inherit; text-decoration: inherit;">Last<wbr>Modified</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The date this resource was last modified.</dd><dt class="property-"
title="">
<span id="triggerid_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#triggerid_go" style="color: inherit; text-decoration: inherit;">Trigger<wbr>Id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute trigger ID.</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="java">
<dl class="resources-properties"><dt class="property-"
title="">
<span id="id_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#id_java" style="color: inherit; text-decoration: inherit;">id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The provider-assigned unique ID for this managed resource.</dd><dt class="property-"
title="">
<span id="lastmodified_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#lastmodified_java" style="color: inherit; text-decoration: inherit;">last<wbr>Modified</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The date this resource was last modified.</dd><dt class="property-"
title="">
<span id="triggerid_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#triggerid_java" style="color: inherit; text-decoration: inherit;">trigger<wbr>Id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The Function Compute trigger ID.</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="javascript,typescript">
<dl class="resources-properties"><dt class="property-"
title="">
<span id="id_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#id_nodejs" style="color: inherit; text-decoration: inherit;">id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The provider-assigned unique ID for this managed resource.</dd><dt class="property-"
title="">
<span id="lastmodified_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#lastmodified_nodejs" style="color: inherit; text-decoration: inherit;">last<wbr>Modified</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The date this resource was last modified.</dd><dt class="property-"
title="">
<span id="triggerid_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#triggerid_nodejs" style="color: inherit; text-decoration: inherit;">trigger<wbr>Id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute trigger ID.</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="python">
<dl class="resources-properties"><dt class="property-"
title="">
<span id="id_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#id_python" style="color: inherit; text-decoration: inherit;">id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>The provider-assigned unique ID for this managed resource.</dd><dt class="property-"
title="">
<span id="last_modified_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#last_modified_python" style="color: inherit; text-decoration: inherit;">last_<wbr>modified</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>The date this resource was last modified.</dd><dt class="property-"
title="">
<span id="trigger_id_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#trigger_id_python" style="color: inherit; text-decoration: inherit;">trigger_<wbr>id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>The Function Compute trigger ID.</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="yaml">
<dl class="resources-properties"><dt class="property-"
title="">
<span id="id_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#id_yaml" style="color: inherit; text-decoration: inherit;">id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The provider-assigned unique ID for this managed resource.</dd><dt class="property-"
title="">
<span id="lastmodified_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#lastmodified_yaml" style="color: inherit; text-decoration: inherit;">last<wbr>Modified</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The date this resource was last modified.</dd><dt class="property-"
title="">
<span id="triggerid_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#triggerid_yaml" style="color: inherit; text-decoration: inherit;">trigger<wbr>Id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The Function Compute trigger ID.</dd></dl>
</pulumi-choosable>
</div>
## Look up Existing Trigger Resource {#look-up}
Get an existing Trigger resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
<div>
<pulumi-chooser type="language" options="typescript,python,go,csharp,java,yaml"></pulumi-chooser>
</div>
<div>
<pulumi-choosable type="language" values="javascript,typescript">
<div class="highlight"><pre class="chroma"><code class="language-typescript" data-lang="typescript"><span class="k">public static </span><span class="nf">get</span><span class="p">(</span><span class="nx">name</span><span class="p">:</span> <span class="nx">string</span><span class="p">,</span> <span class="nx">id</span><span class="p">:</span> <span class="nx"><a href="/docs/reference/pkg/nodejs/pulumi/pulumi/#ID">Input<ID></a></span><span class="p">,</span> <span class="nx">state</span><span class="p">?:</span> <span class="nx">TriggerState</span><span class="p">,</span> <span class="nx">opts</span><span class="p">?:</span> <span class="nx"><a href="/docs/reference/pkg/nodejs/pulumi/pulumi/#CustomResourceOptions">CustomResourceOptions</a></span><span class="p">): </span><span class="nx">Trigger</span></code></pre></div>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="python">
<div class="highlight"><pre class="chroma"><code class="language-python" data-lang="python"><span class=nd>@staticmethod</span>
<span class="k">def </span><span class="nf">get</span><span class="p">(</span><span class="nx">resource_name</span><span class="p">:</span> <span class="nx">str</span><span class="p">,</span>
<span class="nx">id</span><span class="p">:</span> <span class="nx">str</span><span class="p">,</span>
<span class="nx">opts</span><span class="p">:</span> <span class="nx"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">Optional[ResourceOptions]</a></span> = None<span class="p">,</span>
<span class="nx">config</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">config_mns</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">function</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">last_modified</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">name</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">name_prefix</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">role</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">service</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">source_arn</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">trigger_id</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">,</span>
<span class="nx">type</span><span class="p">:</span> <span class="nx">Optional[str]</span> = None<span class="p">) -></span> Trigger</code></pre></div>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="go">
<div class="highlight"><pre class="chroma"><code class="language-go" data-lang="go"><span class="k">func </span>GetTrigger<span class="p">(</span><span class="nx">ctx</span><span class="p"> *</span><span class="nx"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#Context">Context</a></span><span class="p">,</span> <span class="nx">name</span><span class="p"> </span><span class="nx">string</span><span class="p">,</span> <span class="nx">id</span><span class="p"> </span><span class="nx"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#IDInput">IDInput</a></span><span class="p">,</span> <span class="nx">state</span><span class="p"> *</span><span class="nx">TriggerState</span><span class="p">,</span> <span class="nx">opts</span><span class="p"> ...</span><span class="nx"><a href="https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi?tab=doc#ResourceOption">ResourceOption</a></span><span class="p">) (*<span class="nx">Trigger</span>, error)</span></code></pre></div>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="csharp">
<div class="highlight"><pre class="chroma"><code class="language-csharp" data-lang="csharp"><span class="k">public static </span><span class="nx">Trigger</span><span class="nf"> Get</span><span class="p">(</span><span class="nx">string</span><span class="p"> </span><span class="nx">name<span class="p">,</span> <span class="nx"><a href="/docs/reference/pkg/dotnet/Pulumi/Pulumi.Input-1.html">Input<string></a></span><span class="p"> </span><span class="nx">id<span class="p">,</span> <span class="nx">TriggerState</span><span class="p">? </span><span class="nx">state<span class="p">,</span> <span class="nx"><a href="/docs/reference/pkg/dotnet/Pulumi/Pulumi.CustomResourceOptions.html">CustomResourceOptions</a></span><span class="p">? </span><span class="nx">opts = null<span class="p">)</span></code></pre></div>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="java">
<div class="highlight"><pre class="chroma"><code class="language-java" data-lang="java"><span class="k">public static </span><span class="nx">Trigger</span><span class="nf"> get</span><span class="p">(</span><span class="nx">String</span><span class="p"> </span><span class="nx">name<span class="p">,</span> <span class="nx">Output<String></span><span class="p"> </span><span class="nx">id<span class="p">,</span> <span class="nx">TriggerState</span><span class="p"> </span><span class="nx">state<span class="p">,</span> <span class="nx">CustomResourceOptions</span><span class="p"> </span><span class="nx">options<span class="p">)</span></code></pre></div>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="yaml">
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">Resource lookup is not supported in YAML</code></pre></div>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="javascript,typescript">
<dl class="resources-properties">
<dt class="property-required" title="Required">
<span>name</span>
<span class="property-indicator"></span>
</dt>
<dd>The unique name of the resulting resource.</dd>
<dt class="property-required" title="Required">
<span>id</span>
<span class="property-indicator"></span>
</dt>
<dd>The <em>unique</em> provider ID of the resource to lookup.</dd>
<dt class="property-optional" title="Optional">
<span>state</span>
<span class="property-indicator"></span>
</dt>
<dd>Any extra arguments used during the lookup.</dd>
<dt class="property-optional" title="Optional">
<span>opts</span>
<span class="property-indicator"></span>
</dt>
<dd>A bag of options that control this resource's behavior.</dd>
</dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="python">
<dl class="resources-properties">
<dt class="property-required" title="Required">
<span>resource_name</span>
<span class="property-indicator"></span>
</dt>
<dd>The unique name of the resulting resource.</dd>
<dt class="property-required" title="Optional">
<span>id</span>
<span class="property-indicator"></span>
</dt>
<dd>The <em>unique</em> provider ID of the resource to lookup.</dd>
</dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="go">
<dl class="resources-properties">
<dt class="property-required" title="Required">
<span>name</span>
<span class="property-indicator"></span>
</dt>
<dd>The unique name of the resulting resource.</dd>
<dt class="property-required" title="Required">
<span>id</span>
<span class="property-indicator"></span>
</dt>
<dd>The <em>unique</em> provider ID of the resource to lookup.</dd>
<dt class="property-optional" title="Optional">
<span>state</span>
<span class="property-indicator"></span>
</dt>
<dd>Any extra arguments used during the lookup.</dd>
<dt class="property-optional" title="Optional">
<span>opts</span>
<span class="property-indicator"></span>
</dt>
<dd>A bag of options that control this resource's behavior.</dd>
</dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="csharp">
<dl class="resources-properties">
<dt class="property-required" title="Required">
<span>name</span>
<span class="property-indicator"></span>
</dt>
<dd>The unique name of the resulting resource.</dd>
<dt class="property-required" title="Required">
<span>id</span>
<span class="property-indicator"></span>
</dt>
<dd>The <em>unique</em> provider ID of the resource to lookup.</dd>
<dt class="property-optional" title="Optional">
<span>state</span>
<span class="property-indicator"></span>
</dt>
<dd>Any extra arguments used during the lookup.</dd>
<dt class="property-optional" title="Optional">
<span>opts</span>
<span class="property-indicator"></span>
</dt>
<dd>A bag of options that control this resource's behavior.</dd>
</dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="java">
<dl class="resources-properties">
<dt class="property-required" title="Required">
<span>name</span>
<span class="property-indicator"></span>
</dt>
<dd>The unique name of the resulting resource.</dd>
<dt class="property-required" title="Required">
<span>id</span>
<span class="property-indicator"></span>
</dt>
<dd>The <em>unique</em> provider ID of the resource to lookup.</dd>
<dt class="property-optional" title="Optional">
<span>state</span>
<span class="property-indicator"></span>
</dt>
<dd>Any extra arguments used during the lookup.</dd>
<dt class="property-optional" title="Optional">
<span>opts</span>
<span class="property-indicator"></span>
</dt>
<dd>A bag of options that control this resource's behavior.</dd>
</dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="typescript,javascript,python,go,csharp,java">
The following state arguments are supported:
<div>
<pulumi-choosable type="language" values="csharp">
<dl class="resources-properties"><dt class="property-optional"
title="Optional">
<span id="state_config_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_config_csharp" style="color: inherit; text-decoration: inherit;">Config</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The config of Function Compute trigger.It is valid when <code>type</code> is not "mns_topic".See <a href="https://www.alibabacloud.com/help/doc-detail/70140.htm">Configure triggers and events</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_configmns_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_configmns_csharp" style="color: inherit; text-decoration: inherit;">Config<wbr>Mns</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The config of Function Compute trigger when the type is "mns_topic".It is conflict with <code>config</code>.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_function_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_function_csharp" style="color: inherit; text-decoration: inherit;">Function</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute function name.</dd><dt class="property-optional"
title="Optional">
<span id="state_lastmodified_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_lastmodified_csharp" style="color: inherit; text-decoration: inherit;">Last<wbr>Modified</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The date this resource was last modified.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_name_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_name_csharp" style="color: inherit; text-decoration: inherit;">Name</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute trigger name. It is the only in one service and is conflict with "name_prefix".</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_nameprefix_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_nameprefix_csharp" style="color: inherit; text-decoration: inherit;">Name<wbr>Prefix</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>Setting a prefix to get a only trigger name. It is conflict with "name".</dd><dt class="property-optional"
title="Optional">
<span id="state_role_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_role_csharp" style="color: inherit; text-decoration: inherit;">Role</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>RAM role arn attached to the Function Compute trigger. Role used by the event source to call the function. The value format is "acs:ram::$account-id:role/$role-name". See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_service_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_service_csharp" style="color: inherit; text-decoration: inherit;">Service</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute service name.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_sourcearn_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_sourcearn_csharp" style="color: inherit; text-decoration: inherit;">Source<wbr>Arn</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>Event source resource address. See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd><dt class="property-optional"
title="Optional">
<span id="state_triggerid_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_triggerid_csharp" style="color: inherit; text-decoration: inherit;">Trigger<wbr>Id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute trigger ID.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_type_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_type_csharp" style="color: inherit; text-decoration: inherit;">Type</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd><p>The Type of the trigger. Valid values: ["oss", "log", "timer", "http", "mns_topic", "cdn_events", "eventbridge"].</p>
<blockquote>
<p><strong>NOTE:</strong> Config does not support modification when type is mns_topic.
<strong>NOTE:</strong> type = cdn_events, available in 1.47.0+.
<strong>NOTE:</strong> type = eventbridge, available in 1.173.0+.</p>
</blockquote>
</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="go">
<dl class="resources-properties"><dt class="property-optional"
title="Optional">
<span id="state_config_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_config_go" style="color: inherit; text-decoration: inherit;">Config</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The config of Function Compute trigger.It is valid when <code>type</code> is not "mns_topic".See <a href="https://www.alibabacloud.com/help/doc-detail/70140.htm">Configure triggers and events</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_configmns_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_configmns_go" style="color: inherit; text-decoration: inherit;">Config<wbr>Mns</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The config of Function Compute trigger when the type is "mns_topic".It is conflict with <code>config</code>.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_function_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_function_go" style="color: inherit; text-decoration: inherit;">Function</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute function name.</dd><dt class="property-optional"
title="Optional">
<span id="state_lastmodified_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_lastmodified_go" style="color: inherit; text-decoration: inherit;">Last<wbr>Modified</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The date this resource was last modified.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_name_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_name_go" style="color: inherit; text-decoration: inherit;">Name</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute trigger name. It is the only in one service and is conflict with "name_prefix".</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_nameprefix_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_nameprefix_go" style="color: inherit; text-decoration: inherit;">Name<wbr>Prefix</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>Setting a prefix to get a only trigger name. It is conflict with "name".</dd><dt class="property-optional"
title="Optional">
<span id="state_role_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_role_go" style="color: inherit; text-decoration: inherit;">Role</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>RAM role arn attached to the Function Compute trigger. Role used by the event source to call the function. The value format is "acs:ram::$account-id:role/$role-name". See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_service_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_service_go" style="color: inherit; text-decoration: inherit;">Service</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute service name.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_sourcearn_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_sourcearn_go" style="color: inherit; text-decoration: inherit;">Source<wbr>Arn</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>Event source resource address. See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd><dt class="property-optional"
title="Optional">
<span id="state_triggerid_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_triggerid_go" style="color: inherit; text-decoration: inherit;">Trigger<wbr>Id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute trigger ID.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_type_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_type_go" style="color: inherit; text-decoration: inherit;">Type</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd><p>The Type of the trigger. Valid values: ["oss", "log", "timer", "http", "mns_topic", "cdn_events", "eventbridge"].</p>
<blockquote>
<p><strong>NOTE:</strong> Config does not support modification when type is mns_topic.
<strong>NOTE:</strong> type = cdn_events, available in 1.47.0+.
<strong>NOTE:</strong> type = eventbridge, available in 1.173.0+.</p>
</blockquote>
</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="java">
<dl class="resources-properties"><dt class="property-optional"
title="Optional">
<span id="state_config_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_config_java" style="color: inherit; text-decoration: inherit;">config</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The config of Function Compute trigger.It is valid when <code>type</code> is not "mns_topic".See <a href="https://www.alibabacloud.com/help/doc-detail/70140.htm">Configure triggers and events</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_configmns_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_configmns_java" style="color: inherit; text-decoration: inherit;">config<wbr>Mns</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The config of Function Compute trigger when the type is "mns_topic".It is conflict with <code>config</code>.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_function_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_function_java" style="color: inherit; text-decoration: inherit;">function</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The Function Compute function name.</dd><dt class="property-optional"
title="Optional">
<span id="state_lastmodified_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_lastmodified_java" style="color: inherit; text-decoration: inherit;">last<wbr>Modified</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The date this resource was last modified.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_name_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_name_java" style="color: inherit; text-decoration: inherit;">name</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The Function Compute trigger name. It is the only in one service and is conflict with "name_prefix".</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_nameprefix_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_nameprefix_java" style="color: inherit; text-decoration: inherit;">name<wbr>Prefix</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>Setting a prefix to get a only trigger name. It is conflict with "name".</dd><dt class="property-optional"
title="Optional">
<span id="state_role_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_role_java" style="color: inherit; text-decoration: inherit;">role</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>RAM role arn attached to the Function Compute trigger. Role used by the event source to call the function. The value format is "acs:ram::$account-id:role/$role-name". See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_service_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_service_java" style="color: inherit; text-decoration: inherit;">service</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The Function Compute service name.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_sourcearn_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_sourcearn_java" style="color: inherit; text-decoration: inherit;">source<wbr>Arn</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>Event source resource address. See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd><dt class="property-optional"
title="Optional">
<span id="state_triggerid_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_triggerid_java" style="color: inherit; text-decoration: inherit;">trigger<wbr>Id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The Function Compute trigger ID.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_type_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_type_java" style="color: inherit; text-decoration: inherit;">type</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd><p>The Type of the trigger. Valid values: ["oss", "log", "timer", "http", "mns_topic", "cdn_events", "eventbridge"].</p>
<blockquote>
<p><strong>NOTE:</strong> Config does not support modification when type is mns_topic.
<strong>NOTE:</strong> type = cdn_events, available in 1.47.0+.
<strong>NOTE:</strong> type = eventbridge, available in 1.173.0+.</p>
</blockquote>
</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="javascript,typescript">
<dl class="resources-properties"><dt class="property-optional"
title="Optional">
<span id="state_config_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_config_nodejs" style="color: inherit; text-decoration: inherit;">config</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The config of Function Compute trigger.It is valid when <code>type</code> is not "mns_topic".See <a href="https://www.alibabacloud.com/help/doc-detail/70140.htm">Configure triggers and events</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_configmns_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_configmns_nodejs" style="color: inherit; text-decoration: inherit;">config<wbr>Mns</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The config of Function Compute trigger when the type is "mns_topic".It is conflict with <code>config</code>.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_function_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_function_nodejs" style="color: inherit; text-decoration: inherit;">function</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute function name.</dd><dt class="property-optional"
title="Optional">
<span id="state_lastmodified_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_lastmodified_nodejs" style="color: inherit; text-decoration: inherit;">last<wbr>Modified</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The date this resource was last modified.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_name_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_name_nodejs" style="color: inherit; text-decoration: inherit;">name</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute trigger name. It is the only in one service and is conflict with "name_prefix".</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_nameprefix_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_nameprefix_nodejs" style="color: inherit; text-decoration: inherit;">name<wbr>Prefix</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>Setting a prefix to get a only trigger name. It is conflict with "name".</dd><dt class="property-optional"
title="Optional">
<span id="state_role_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_role_nodejs" style="color: inherit; text-decoration: inherit;">role</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>RAM role arn attached to the Function Compute trigger. Role used by the event source to call the function. The value format is "acs:ram::$account-id:role/$role-name". See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_service_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_service_nodejs" style="color: inherit; text-decoration: inherit;">service</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute service name.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_sourcearn_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_sourcearn_nodejs" style="color: inherit; text-decoration: inherit;">source<wbr>Arn</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>Event source resource address. See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd><dt class="property-optional"
title="Optional">
<span id="state_triggerid_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_triggerid_nodejs" style="color: inherit; text-decoration: inherit;">trigger<wbr>Id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd>The Function Compute trigger ID.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_type_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_type_nodejs" style="color: inherit; text-decoration: inherit;">type</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd><p>The Type of the trigger. Valid values: ["oss", "log", "timer", "http", "mns_topic", "cdn_events", "eventbridge"].</p>
<blockquote>
<p><strong>NOTE:</strong> Config does not support modification when type is mns_topic.
<strong>NOTE:</strong> type = cdn_events, available in 1.47.0+.
<strong>NOTE:</strong> type = eventbridge, available in 1.173.0+.</p>
</blockquote>
</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="python">
<dl class="resources-properties"><dt class="property-optional"
title="Optional">
<span id="state_config_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_config_python" style="color: inherit; text-decoration: inherit;">config</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>The config of Function Compute trigger.It is valid when <code>type</code> is not "mns_topic".See <a href="https://www.alibabacloud.com/help/doc-detail/70140.htm">Configure triggers and events</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_config_mns_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_config_mns_python" style="color: inherit; text-decoration: inherit;">config_<wbr>mns</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>The config of Function Compute trigger when the type is "mns_topic".It is conflict with <code>config</code>.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_function_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_function_python" style="color: inherit; text-decoration: inherit;">function</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>The Function Compute function name.</dd><dt class="property-optional"
title="Optional">
<span id="state_last_modified_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_last_modified_python" style="color: inherit; text-decoration: inherit;">last_<wbr>modified</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>The date this resource was last modified.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_name_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_name_python" style="color: inherit; text-decoration: inherit;">name</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>The Function Compute trigger name. It is the only in one service and is conflict with "name_prefix".</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_name_prefix_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_name_prefix_python" style="color: inherit; text-decoration: inherit;">name_<wbr>prefix</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>Setting a prefix to get a only trigger name. It is conflict with "name".</dd><dt class="property-optional"
title="Optional">
<span id="state_role_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_role_python" style="color: inherit; text-decoration: inherit;">role</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>RAM role arn attached to the Function Compute trigger. Role used by the event source to call the function. The value format is "acs:ram::$account-id:role/$role-name". See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_service_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_service_python" style="color: inherit; text-decoration: inherit;">service</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>The Function Compute service name.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_source_arn_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_source_arn_python" style="color: inherit; text-decoration: inherit;">source_<wbr>arn</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>Event source resource address. See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd><dt class="property-optional"
title="Optional">
<span id="state_trigger_id_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_trigger_id_python" style="color: inherit; text-decoration: inherit;">trigger_<wbr>id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd>The Function Compute trigger ID.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_type_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_type_python" style="color: inherit; text-decoration: inherit;">type</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd><p>The Type of the trigger. Valid values: ["oss", "log", "timer", "http", "mns_topic", "cdn_events", "eventbridge"].</p>
<blockquote>
<p><strong>NOTE:</strong> Config does not support modification when type is mns_topic.
<strong>NOTE:</strong> type = cdn_events, available in 1.47.0+.
<strong>NOTE:</strong> type = eventbridge, available in 1.173.0+.</p>
</blockquote>
</dd></dl>
</pulumi-choosable>
</div>
<div>
<pulumi-choosable type="language" values="yaml">
<dl class="resources-properties"><dt class="property-optional"
title="Optional">
<span id="state_config_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_config_yaml" style="color: inherit; text-decoration: inherit;">config</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The config of Function Compute trigger.It is valid when <code>type</code> is not "mns_topic".See <a href="https://www.alibabacloud.com/help/doc-detail/70140.htm">Configure triggers and events</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_configmns_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_configmns_yaml" style="color: inherit; text-decoration: inherit;">config<wbr>Mns</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The config of Function Compute trigger when the type is "mns_topic".It is conflict with <code>config</code>.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_function_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_function_yaml" style="color: inherit; text-decoration: inherit;">function</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The Function Compute function name.</dd><dt class="property-optional"
title="Optional">
<span id="state_lastmodified_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_lastmodified_yaml" style="color: inherit; text-decoration: inherit;">last<wbr>Modified</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The date this resource was last modified.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_name_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_name_yaml" style="color: inherit; text-decoration: inherit;">name</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The Function Compute trigger name. It is the only in one service and is conflict with "name_prefix".</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_nameprefix_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_nameprefix_yaml" style="color: inherit; text-decoration: inherit;">name<wbr>Prefix</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>Setting a prefix to get a only trigger name. It is conflict with "name".</dd><dt class="property-optional"
title="Optional">
<span id="state_role_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_role_yaml" style="color: inherit; text-decoration: inherit;">role</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>RAM role arn attached to the Function Compute trigger. Role used by the event source to call the function. The value format is "acs:ram::$account-id:role/$role-name". See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_service_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_service_yaml" style="color: inherit; text-decoration: inherit;">service</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The Function Compute service name.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_sourcearn_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_sourcearn_yaml" style="color: inherit; text-decoration: inherit;">source<wbr>Arn</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>Event source resource address. See <a href="https://www.alibabacloud.com/help/doc-detail/53102.htm">Create a trigger</a> for more details.</dd><dt class="property-optional"
title="Optional">
<span id="state_triggerid_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_triggerid_yaml" style="color: inherit; text-decoration: inherit;">trigger<wbr>Id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd>The Function Compute trigger ID.</dd><dt class="property-optional property-replacement"
title="Optional">
<span id="state_type_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#state_type_yaml" style="color: inherit; text-decoration: inherit;">type</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd><p>The Type of the trigger. Valid values: ["oss", "log", "timer", "http", "mns_topic", "cdn_events", "eventbridge"].</p>
<blockquote>
<p><strong>NOTE:</strong> Config does not support modification when type is mns_topic.
<strong>NOTE:</strong> type = cdn_events, available in 1.47.0+.
<strong>NOTE:</strong> type = eventbridge, available in 1.173.0+.</p>
</blockquote>
</dd></dl>
</pulumi-choosable>
</div>
</pulumi-choosable>
</div>
## Import
Function Compute trigger can be imported using the id, e.g.
```sh
$ pulumi import alicloud:fc/trigger:Trigger foo my-fc-service:hello-world:hello-trigger
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.