alicloud.fc.Function
Explore with Pulumi AI
Provides a Alicloud Function Compute Function resource. Function allows you to trigger execution of code in response to events in Alibaba Cloud. The Function itself includes source code and runtime configuration. 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.10.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
const _default = new random.index.Integer("default", {
max: 99999,
min: 10000,
});
const defaultProject = new alicloud.log.Project("default", {projectName: `example-value-${_default.result}`});
const defaultStore = new alicloud.log.Store("default", {
projectName: defaultProject.name,
logstoreName: "example-value",
});
const defaultRole = new alicloud.ram.Role("default", {
name: `fcservicerole-${_default.result}`,
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("default", {
roleName: defaultRole.name,
policyName: "AliyunLogFullAccess",
policyType: "System",
});
const defaultService = new alicloud.fc.Service("default", {
name: `example-value-${_default.result}`,
description: "example-value",
role: defaultRole.arn,
logConfig: {
project: defaultProject.name,
logstore: defaultStore.name,
enableInstanceMetrics: true,
enableRequestMetrics: true,
},
});
const defaultBucket = new alicloud.oss.Bucket("default", {bucket: `terraform-example-${_default.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("default", {
bucket: defaultBucket.id,
key: "index.py",
content: `import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world'`,
});
const foo = new alicloud.fc.Function("foo", {
service: defaultService.name,
name: "terraform-example",
description: "example",
ossBucket: defaultBucket.id,
ossKey: defaultBucketObject.key,
memorySize: 512,
runtime: "python3.10",
handler: "hello.handler",
environmentVariables: {
prefix: "terraform",
},
});
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
default = random.index.Integer("default",
max=99999,
min=10000)
default_project = alicloud.log.Project("default", project_name=f"example-value-{default['result']}")
default_store = alicloud.log.Store("default",
project_name=default_project.name,
logstore_name="example-value")
default_role = alicloud.ram.Role("default",
name=f"fcservicerole-{default['result']}",
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("default",
role_name=default_role.name,
policy_name="AliyunLogFullAccess",
policy_type="System")
default_service = alicloud.fc.Service("default",
name=f"example-value-{default['result']}",
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("default", bucket=f"terraform-example-{default['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("default",
bucket=default_bucket.id,
key="index.py",
content="""import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world'""")
foo = alicloud.fc.Function("foo",
service=default_service.name,
name="terraform-example",
description="example",
oss_bucket=default_bucket.id,
oss_key=default_bucket_object.key,
memory_size=512,
runtime="python3.10",
handler="hello.handler",
environment_variables={
"prefix": "terraform",
})
package main
import (
"fmt"
"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 {
_, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
Max: 99999,
Min: 10000,
})
if err != nil {
return err
}
defaultProject, err := log.NewProject(ctx, "default", &log.ProjectArgs{
ProjectName: pulumi.String(fmt.Sprintf("example-value-%v", _default.Result)),
})
if err != nil {
return err
}
defaultStore, err := log.NewStore(ctx, "default", &log.StoreArgs{
ProjectName: defaultProject.Name,
LogstoreName: pulumi.String("example-value"),
})
if err != nil {
return err
}
defaultRole, err := ram.NewRole(ctx, "default", &ram.RoleArgs{
Name: pulumi.String(fmt.Sprintf("fcservicerole-%v", _default.Result)),
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, "default", &ram.RolePolicyAttachmentArgs{
RoleName: defaultRole.Name,
PolicyName: pulumi.String("AliyunLogFullAccess"),
PolicyType: pulumi.String("System"),
})
if err != nil {
return err
}
defaultService, err := fc.NewService(ctx, "default", &fc.ServiceArgs{
Name: pulumi.String(fmt.Sprintf("example-value-%v", _default.Result)),
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, "default", &oss.BucketArgs{
Bucket: pulumi.String(fmt.Sprintf("terraform-example-%v", _default.Result)),
})
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, "default", &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
}
_, err = fc.NewFunction(ctx, "foo", &fc.FunctionArgs{
Service: defaultService.Name,
Name: pulumi.String("terraform-example"),
Description: pulumi.String("example"),
OssBucket: defaultBucket.ID(),
OssKey: defaultBucketObject.Key,
MemorySize: pulumi.Int(512),
Runtime: pulumi.String("python3.10"),
Handler: pulumi.String("hello.handler"),
EnvironmentVariables: pulumi.Map{
"prefix": pulumi.Any("terraform"),
},
})
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 @default = new Random.Index.Integer("default", new()
{
Max = 99999,
Min = 10000,
});
var defaultProject = new AliCloud.Log.Project("default", new()
{
ProjectName = $"example-value-{@default.Result}",
});
var defaultStore = new AliCloud.Log.Store("default", new()
{
ProjectName = defaultProject.Name,
LogstoreName = "example-value",
});
var defaultRole = new AliCloud.Ram.Role("default", new()
{
Name = $"fcservicerole-{@default.Result}",
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("default", new()
{
RoleName = defaultRole.Name,
PolicyName = "AliyunLogFullAccess",
PolicyType = "System",
});
var defaultService = new AliCloud.FC.Service("default", new()
{
Name = $"example-value-{@default.Result}",
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("default", new()
{
BucketName = $"terraform-example-{@default.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("default", 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 foo = new AliCloud.FC.Function("foo", new()
{
Service = defaultService.Name,
Name = "terraform-example",
Description = "example",
OssBucket = defaultBucket.Id,
OssKey = defaultBucketObject.Key,
MemorySize = 512,
Runtime = "python3.10",
Handler = "hello.handler",
EnvironmentVariables =
{
{ "prefix", "terraform" },
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.integer;
import com.pulumi.random.IntegerArgs;
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 java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var default_ = new Integer("default", IntegerArgs.builder()
.max(99999)
.min(10000)
.build());
var defaultProject = new Project("defaultProject", ProjectArgs.builder()
.projectName(String.format("example-value-%s", default_.result()))
.build());
var defaultStore = new Store("defaultStore", StoreArgs.builder()
.projectName(defaultProject.name())
.logstoreName("example-value")
.build());
var defaultRole = new Role("defaultRole", RoleArgs.builder()
.name(String.format("fcservicerole-%s", default_.result()))
.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()
.name(String.format("example-value-%s", default_.result()))
.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(String.format("terraform-example-%s", default_.result()))
.build());
// If you upload the function by OSS Bucket, you need to specify path can't upload by content.
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 foo = new Function("foo", FunctionArgs.builder()
.service(defaultService.name())
.name("terraform-example")
.description("example")
.ossBucket(defaultBucket.id())
.ossKey(defaultBucketObject.key())
.memorySize("512")
.runtime("python3.10")
.handler("hello.handler")
.environmentVariables(Map.of("prefix", "terraform"))
.build());
}
}
resources:
default:
type: random:integer
properties:
max: 99999
min: 10000
defaultProject:
type: alicloud:log:Project
name: default
properties:
projectName: example-value-${default.result}
defaultStore:
type: alicloud:log:Store
name: default
properties:
projectName: ${defaultProject.name}
logstoreName: example-value
defaultRole:
type: alicloud:ram:Role
name: default
properties:
name: fcservicerole-${default.result}
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
name: default
properties:
roleName: ${defaultRole.name}
policyName: AliyunLogFullAccess
policyType: System
defaultService:
type: alicloud:fc:Service
name: default
properties:
name: example-value-${default.result}
description: example-value
role: ${defaultRole.arn}
logConfig:
project: ${defaultProject.name}
logstore: ${defaultStore.name}
enableInstanceMetrics: true
enableRequestMetrics: true
defaultBucket:
type: alicloud:oss:Bucket
name: default
properties:
bucket: terraform-example-${default.result}
# If you upload the function by OSS Bucket, you need to specify path can't upload by content.
defaultBucketObject:
type: alicloud:oss:BucketObject
name: default
properties:
bucket: ${defaultBucket.id}
key: index.py
content: "import logging \ndef handler(event, context): \nlogger = logging.getLogger() \nlogger.info('hello world') \nreturn 'hello world'"
foo:
type: alicloud:fc:Function
properties:
service: ${defaultService.name}
name: terraform-example
description: example
ossBucket: ${defaultBucket.id}
ossKey: ${defaultBucketObject.key}
memorySize: '512'
runtime: python3.10
handler: hello.handler
environmentVariables:
prefix: terraform
Module Support
You can use to the existing fc module to create a function quickly and set several triggers for it.
Create Function Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Function(name: string, args: FunctionArgs, opts?: CustomResourceOptions);
@overload
def Function(resource_name: str,
args: FunctionArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Function(resource_name: str,
opts: Optional[ResourceOptions] = None,
handler: Optional[str] = None,
service: Optional[str] = None,
runtime: Optional[str] = None,
instance_type: Optional[str] = None,
memory_size: Optional[int] = None,
filename: Optional[str] = None,
description: Optional[str] = None,
initialization_timeout: Optional[int] = None,
initializer: Optional[str] = None,
instance_concurrency: Optional[int] = None,
ca_port: Optional[int] = None,
layers: Optional[Sequence[str]] = None,
environment_variables: Optional[Mapping[str, Any]] = None,
name: Optional[str] = None,
name_prefix: Optional[str] = None,
oss_bucket: Optional[str] = None,
oss_key: Optional[str] = None,
custom_container_config: Optional[FunctionCustomContainerConfigArgs] = None,
code_checksum: Optional[str] = None,
timeout: Optional[int] = None)
func NewFunction(ctx *Context, name string, args FunctionArgs, opts ...ResourceOption) (*Function, error)
public Function(string name, FunctionArgs args, CustomResourceOptions? opts = null)
public Function(String name, FunctionArgs args)
public Function(String name, FunctionArgs args, CustomResourceOptions options)
type: alicloud:fc:Function
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var functionResource = new AliCloud.FC.Function("functionResource", new()
{
Handler = "string",
Service = "string",
Runtime = "string",
InstanceType = "string",
MemorySize = 0,
Filename = "string",
Description = "string",
InitializationTimeout = 0,
Initializer = "string",
InstanceConcurrency = 0,
CaPort = 0,
Layers = new[]
{
"string",
},
EnvironmentVariables =
{
{ "string", "any" },
},
Name = "string",
NamePrefix = "string",
OssBucket = "string",
OssKey = "string",
CustomContainerConfig = new AliCloud.FC.Inputs.FunctionCustomContainerConfigArgs
{
Image = "string",
Args = "string",
Command = "string",
},
CodeChecksum = "string",
Timeout = 0,
});
example, err := fc.NewFunction(ctx, "functionResource", &fc.FunctionArgs{
Handler: pulumi.String("string"),
Service: pulumi.String("string"),
Runtime: pulumi.String("string"),
InstanceType: pulumi.String("string"),
MemorySize: pulumi.Int(0),
Filename: pulumi.String("string"),
Description: pulumi.String("string"),
InitializationTimeout: pulumi.Int(0),
Initializer: pulumi.String("string"),
InstanceConcurrency: pulumi.Int(0),
CaPort: pulumi.Int(0),
Layers: pulumi.StringArray{
pulumi.String("string"),
},
EnvironmentVariables: pulumi.Map{
"string": pulumi.Any("any"),
},
Name: pulumi.String("string"),
NamePrefix: pulumi.String("string"),
OssBucket: pulumi.String("string"),
OssKey: pulumi.String("string"),
CustomContainerConfig: &fc.FunctionCustomContainerConfigArgs{
Image: pulumi.String("string"),
Args: pulumi.String("string"),
Command: pulumi.String("string"),
},
CodeChecksum: pulumi.String("string"),
Timeout: pulumi.Int(0),
})
var functionResource = new Function("functionResource", FunctionArgs.builder()
.handler("string")
.service("string")
.runtime("string")
.instanceType("string")
.memorySize(0)
.filename("string")
.description("string")
.initializationTimeout(0)
.initializer("string")
.instanceConcurrency(0)
.caPort(0)
.layers("string")
.environmentVariables(Map.of("string", "any"))
.name("string")
.namePrefix("string")
.ossBucket("string")
.ossKey("string")
.customContainerConfig(FunctionCustomContainerConfigArgs.builder()
.image("string")
.args("string")
.command("string")
.build())
.codeChecksum("string")
.timeout(0)
.build());
function_resource = alicloud.fc.Function("functionResource",
handler="string",
service="string",
runtime="string",
instance_type="string",
memory_size=0,
filename="string",
description="string",
initialization_timeout=0,
initializer="string",
instance_concurrency=0,
ca_port=0,
layers=["string"],
environment_variables={
"string": "any",
},
name="string",
name_prefix="string",
oss_bucket="string",
oss_key="string",
custom_container_config=alicloud.fc.FunctionCustomContainerConfigArgs(
image="string",
args="string",
command="string",
),
code_checksum="string",
timeout=0)
const functionResource = new alicloud.fc.Function("functionResource", {
handler: "string",
service: "string",
runtime: "string",
instanceType: "string",
memorySize: 0,
filename: "string",
description: "string",
initializationTimeout: 0,
initializer: "string",
instanceConcurrency: 0,
caPort: 0,
layers: ["string"],
environmentVariables: {
string: "any",
},
name: "string",
namePrefix: "string",
ossBucket: "string",
ossKey: "string",
customContainerConfig: {
image: "string",
args: "string",
command: "string",
},
codeChecksum: "string",
timeout: 0,
});
type: alicloud:fc:Function
properties:
caPort: 0
codeChecksum: string
customContainerConfig:
args: string
command: string
image: string
description: string
environmentVariables:
string: any
filename: string
handler: string
initializationTimeout: 0
initializer: string
instanceConcurrency: 0
instanceType: string
layers:
- string
memorySize: 0
name: string
namePrefix: string
ossBucket: string
ossKey: string
runtime: string
service: string
timeout: 0
Function Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Function resource accepts the following input properties:
- Handler string
- The function entry point in your code.
- Runtime string
- See [Runtimes][https://www.alibabacloud.com/help/zh/function-compute/latest/manage-functions#multiTask3514] for valid values.
- Service string
- The Function Compute service name.
- Ca
Port int - The port that the function listen to, only valid for custom runtime and custom container runtime.
- Code
Checksum string The checksum (crc64) of the function code.Used to trigger updates.The value can be generated by data source alicloud_file_crc64_checksum.
NOTE: For more information, see Limits.
- Custom
Container Pulumi.Config Ali Cloud. FC. Inputs. Function Custom Container Config - The configuration for custom container runtime.See
custom_container_config
below. - Description string
- The Function Compute function description.
- Environment
Variables Dictionary<string, object> - A map that defines environment variables for the function.
- Filename string
- The path to the function's deployment package within the local filesystem. It is conflict with the
oss_
-prefixed options. - Initialization
Timeout int - The maximum length of time, in seconds, that the function's initialization should be run for.
- Initializer string
- The entry point of the function's initialization.
- Instance
Concurrency int - The maximum number of requests can be executed concurrently within the single function instance.
- Instance
Type string - The instance type of the function.
- Layers List<string>
- The configuration for layers.
- Memory
Size int - Amount of memory in MB your function can use at runtime. Defaults to
128
. Limits to [128, 32768]. - Name string
- The Function Compute function name. It is the only in one service and is conflict with "name_prefix".
- Name
Prefix string - Setting a prefix to get a only function name. It is conflict with "name".
- Oss
Bucket string - The OSS bucket location containing the function's deployment package. Conflicts with
filename
. This bucket must reside in the same Alibaba Cloud region where you are creating the function. - Oss
Key string - The OSS key of an object containing the function's deployment package. Conflicts with
filename
. - Timeout int
- The amount of time your function has to run in seconds.
- Handler string
- The function entry point in your code.
- Runtime string
- See [Runtimes][https://www.alibabacloud.com/help/zh/function-compute/latest/manage-functions#multiTask3514] for valid values.
- Service string
- The Function Compute service name.
- Ca
Port int - The port that the function listen to, only valid for custom runtime and custom container runtime.
- Code
Checksum string The checksum (crc64) of the function code.Used to trigger updates.The value can be generated by data source alicloud_file_crc64_checksum.
NOTE: For more information, see Limits.
- Custom
Container FunctionConfig Custom Container Config Args - The configuration for custom container runtime.See
custom_container_config
below. - Description string
- The Function Compute function description.
- Environment
Variables map[string]interface{} - A map that defines environment variables for the function.
- Filename string
- The path to the function's deployment package within the local filesystem. It is conflict with the
oss_
-prefixed options. - Initialization
Timeout int - The maximum length of time, in seconds, that the function's initialization should be run for.
- Initializer string
- The entry point of the function's initialization.
- Instance
Concurrency int - The maximum number of requests can be executed concurrently within the single function instance.
- Instance
Type string - The instance type of the function.
- Layers []string
- The configuration for layers.
- Memory
Size int - Amount of memory in MB your function can use at runtime. Defaults to
128
. Limits to [128, 32768]. - Name string
- The Function Compute function name. It is the only in one service and is conflict with "name_prefix".
- Name
Prefix string - Setting a prefix to get a only function name. It is conflict with "name".
- Oss
Bucket string - The OSS bucket location containing the function's deployment package. Conflicts with
filename
. This bucket must reside in the same Alibaba Cloud region where you are creating the function. - Oss
Key string - The OSS key of an object containing the function's deployment package. Conflicts with
filename
. - Timeout int
- The amount of time your function has to run in seconds.
- handler String
- The function entry point in your code.
- runtime String
- See [Runtimes][https://www.alibabacloud.com/help/zh/function-compute/latest/manage-functions#multiTask3514] for valid values.
- service String
- The Function Compute service name.
- ca
Port Integer - The port that the function listen to, only valid for custom runtime and custom container runtime.
- code
Checksum String The checksum (crc64) of the function code.Used to trigger updates.The value can be generated by data source alicloud_file_crc64_checksum.
NOTE: For more information, see Limits.
- custom
Container FunctionConfig Custom Container Config - The configuration for custom container runtime.See
custom_container_config
below. - description String
- The Function Compute function description.
- environment
Variables Map<String,Object> - A map that defines environment variables for the function.
- filename String
- The path to the function's deployment package within the local filesystem. It is conflict with the
oss_
-prefixed options. - initialization
Timeout Integer - The maximum length of time, in seconds, that the function's initialization should be run for.
- initializer String
- The entry point of the function's initialization.
- instance
Concurrency Integer - The maximum number of requests can be executed concurrently within the single function instance.
- instance
Type String - The instance type of the function.
- layers List<String>
- The configuration for layers.
- memory
Size Integer - Amount of memory in MB your function can use at runtime. Defaults to
128
. Limits to [128, 32768]. - name String
- The Function Compute function name. It is the only in one service and is conflict with "name_prefix".
- name
Prefix String - Setting a prefix to get a only function name. It is conflict with "name".
- oss
Bucket String - The OSS bucket location containing the function's deployment package. Conflicts with
filename
. This bucket must reside in the same Alibaba Cloud region where you are creating the function. - oss
Key String - The OSS key of an object containing the function's deployment package. Conflicts with
filename
. - timeout Integer
- The amount of time your function has to run in seconds.
- handler string
- The function entry point in your code.
- runtime string
- See [Runtimes][https://www.alibabacloud.com/help/zh/function-compute/latest/manage-functions#multiTask3514] for valid values.
- service string
- The Function Compute service name.
- ca
Port number - The port that the function listen to, only valid for custom runtime and custom container runtime.
- code
Checksum string The checksum (crc64) of the function code.Used to trigger updates.The value can be generated by data source alicloud_file_crc64_checksum.
NOTE: For more information, see Limits.
- custom
Container FunctionConfig Custom Container Config - The configuration for custom container runtime.See
custom_container_config
below. - description string
- The Function Compute function description.
- environment
Variables {[key: string]: any} - A map that defines environment variables for the function.
- filename string
- The path to the function's deployment package within the local filesystem. It is conflict with the
oss_
-prefixed options. - initialization
Timeout number - The maximum length of time, in seconds, that the function's initialization should be run for.
- initializer string
- The entry point of the function's initialization.
- instance
Concurrency number - The maximum number of requests can be executed concurrently within the single function instance.
- instance
Type string - The instance type of the function.
- layers string[]
- The configuration for layers.
- memory
Size number - Amount of memory in MB your function can use at runtime. Defaults to
128
. Limits to [128, 32768]. - name string
- The Function Compute function name. It is the only in one service and is conflict with "name_prefix".
- name
Prefix string - Setting a prefix to get a only function name. It is conflict with "name".
- oss
Bucket string - The OSS bucket location containing the function's deployment package. Conflicts with
filename
. This bucket must reside in the same Alibaba Cloud region where you are creating the function. - oss
Key string - The OSS key of an object containing the function's deployment package. Conflicts with
filename
. - timeout number
- The amount of time your function has to run in seconds.
- handler str
- The function entry point in your code.
- runtime str
- See [Runtimes][https://www.alibabacloud.com/help/zh/function-compute/latest/manage-functions#multiTask3514] for valid values.
- service str
- The Function Compute service name.
- ca_
port int - The port that the function listen to, only valid for custom runtime and custom container runtime.
- code_
checksum str The checksum (crc64) of the function code.Used to trigger updates.The value can be generated by data source alicloud_file_crc64_checksum.
NOTE: For more information, see Limits.
- custom_
container_ Functionconfig Custom Container Config Args - The configuration for custom container runtime.See
custom_container_config
below. - description str
- The Function Compute function description.
- environment_
variables Mapping[str, Any] - A map that defines environment variables for the function.
- filename str
- The path to the function's deployment package within the local filesystem. It is conflict with the
oss_
-prefixed options. - initialization_
timeout int - The maximum length of time, in seconds, that the function's initialization should be run for.
- initializer str
- The entry point of the function's initialization.
- instance_
concurrency int - The maximum number of requests can be executed concurrently within the single function instance.
- instance_
type str - The instance type of the function.
- layers Sequence[str]
- The configuration for layers.
- memory_
size int - Amount of memory in MB your function can use at runtime. Defaults to
128
. Limits to [128, 32768]. - name str
- The Function Compute function name. It is the only in one service and is conflict with "name_prefix".
- name_
prefix str - Setting a prefix to get a only function name. It is conflict with "name".
- oss_
bucket str - The OSS bucket location containing the function's deployment package. Conflicts with
filename
. This bucket must reside in the same Alibaba Cloud region where you are creating the function. - oss_
key str - The OSS key of an object containing the function's deployment package. Conflicts with
filename
. - timeout int
- The amount of time your function has to run in seconds.
- handler String
- The function entry point in your code.
- runtime String
- See [Runtimes][https://www.alibabacloud.com/help/zh/function-compute/latest/manage-functions#multiTask3514] for valid values.
- service String
- The Function Compute service name.
- ca
Port Number - The port that the function listen to, only valid for custom runtime and custom container runtime.
- code
Checksum String The checksum (crc64) of the function code.Used to trigger updates.The value can be generated by data source alicloud_file_crc64_checksum.
NOTE: For more information, see Limits.
- custom
Container Property MapConfig - The configuration for custom container runtime.See
custom_container_config
below. - description String
- The Function Compute function description.
- environment
Variables Map<Any> - A map that defines environment variables for the function.
- filename String
- The path to the function's deployment package within the local filesystem. It is conflict with the
oss_
-prefixed options. - initialization
Timeout Number - The maximum length of time, in seconds, that the function's initialization should be run for.
- initializer String
- The entry point of the function's initialization.
- instance
Concurrency Number - The maximum number of requests can be executed concurrently within the single function instance.
- instance
Type String - The instance type of the function.
- layers List<String>
- The configuration for layers.
- memory
Size Number - Amount of memory in MB your function can use at runtime. Defaults to
128
. Limits to [128, 32768]. - name String
- The Function Compute function name. It is the only in one service and is conflict with "name_prefix".
- name
Prefix String - Setting a prefix to get a only function name. It is conflict with "name".
- oss
Bucket String - The OSS bucket location containing the function's deployment package. Conflicts with
filename
. This bucket must reside in the same Alibaba Cloud region where you are creating the function. - oss
Key String - The OSS key of an object containing the function's deployment package. Conflicts with
filename
. - timeout Number
- The amount of time your function has to run in seconds.
Outputs
All input properties are implicitly available as output properties. Additionally, the Function resource produces the following output properties:
- Function
Id string - The Function Compute service ID.
- Id string
- The provider-assigned unique ID for this managed resource.
- Last
Modified string - The date this resource was last modified.
- Function
Id string - The Function Compute service ID.
- Id string
- The provider-assigned unique ID for this managed resource.
- Last
Modified string - The date this resource was last modified.
- function
Id String - The Function Compute service ID.
- id String
- The provider-assigned unique ID for this managed resource.
- last
Modified String - The date this resource was last modified.
- function
Id string - The Function Compute service ID.
- id string
- The provider-assigned unique ID for this managed resource.
- last
Modified string - The date this resource was last modified.
- function_
id str - The Function Compute service ID.
- id str
- The provider-assigned unique ID for this managed resource.
- last_
modified str - The date this resource was last modified.
- function
Id String - The Function Compute service ID.
- id String
- The provider-assigned unique ID for this managed resource.
- last
Modified String - The date this resource was last modified.
Look up Existing Function Resource
Get an existing Function resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: FunctionState, opts?: CustomResourceOptions): Function
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
ca_port: Optional[int] = None,
code_checksum: Optional[str] = None,
custom_container_config: Optional[FunctionCustomContainerConfigArgs] = None,
description: Optional[str] = None,
environment_variables: Optional[Mapping[str, Any]] = None,
filename: Optional[str] = None,
function_id: Optional[str] = None,
handler: Optional[str] = None,
initialization_timeout: Optional[int] = None,
initializer: Optional[str] = None,
instance_concurrency: Optional[int] = None,
instance_type: Optional[str] = None,
last_modified: Optional[str] = None,
layers: Optional[Sequence[str]] = None,
memory_size: Optional[int] = None,
name: Optional[str] = None,
name_prefix: Optional[str] = None,
oss_bucket: Optional[str] = None,
oss_key: Optional[str] = None,
runtime: Optional[str] = None,
service: Optional[str] = None,
timeout: Optional[int] = None) -> Function
func GetFunction(ctx *Context, name string, id IDInput, state *FunctionState, opts ...ResourceOption) (*Function, error)
public static Function Get(string name, Input<string> id, FunctionState? state, CustomResourceOptions? opts = null)
public static Function get(String name, Output<String> id, FunctionState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Ca
Port int - The port that the function listen to, only valid for custom runtime and custom container runtime.
- Code
Checksum string The checksum (crc64) of the function code.Used to trigger updates.The value can be generated by data source alicloud_file_crc64_checksum.
NOTE: For more information, see Limits.
- Custom
Container Pulumi.Config Ali Cloud. FC. Inputs. Function Custom Container Config - The configuration for custom container runtime.See
custom_container_config
below. - Description string
- The Function Compute function description.
- Environment
Variables Dictionary<string, object> - A map that defines environment variables for the function.
- Filename string
- The path to the function's deployment package within the local filesystem. It is conflict with the
oss_
-prefixed options. - Function
Id string - The Function Compute service ID.
- Handler string
- The function entry point in your code.
- Initialization
Timeout int - The maximum length of time, in seconds, that the function's initialization should be run for.
- Initializer string
- The entry point of the function's initialization.
- Instance
Concurrency int - The maximum number of requests can be executed concurrently within the single function instance.
- Instance
Type string - The instance type of the function.
- Last
Modified string - The date this resource was last modified.
- Layers List<string>
- The configuration for layers.
- Memory
Size int - Amount of memory in MB your function can use at runtime. Defaults to
128
. Limits to [128, 32768]. - Name string
- The Function Compute function name. It is the only in one service and is conflict with "name_prefix".
- Name
Prefix string - Setting a prefix to get a only function name. It is conflict with "name".
- Oss
Bucket string - The OSS bucket location containing the function's deployment package. Conflicts with
filename
. This bucket must reside in the same Alibaba Cloud region where you are creating the function. - Oss
Key string - The OSS key of an object containing the function's deployment package. Conflicts with
filename
. - Runtime string
- See [Runtimes][https://www.alibabacloud.com/help/zh/function-compute/latest/manage-functions#multiTask3514] for valid values.
- Service string
- The Function Compute service name.
- Timeout int
- The amount of time your function has to run in seconds.
- Ca
Port int - The port that the function listen to, only valid for custom runtime and custom container runtime.
- Code
Checksum string The checksum (crc64) of the function code.Used to trigger updates.The value can be generated by data source alicloud_file_crc64_checksum.
NOTE: For more information, see Limits.
- Custom
Container FunctionConfig Custom Container Config Args - The configuration for custom container runtime.See
custom_container_config
below. - Description string
- The Function Compute function description.
- Environment
Variables map[string]interface{} - A map that defines environment variables for the function.
- Filename string
- The path to the function's deployment package within the local filesystem. It is conflict with the
oss_
-prefixed options. - Function
Id string - The Function Compute service ID.
- Handler string
- The function entry point in your code.
- Initialization
Timeout int - The maximum length of time, in seconds, that the function's initialization should be run for.
- Initializer string
- The entry point of the function's initialization.
- Instance
Concurrency int - The maximum number of requests can be executed concurrently within the single function instance.
- Instance
Type string - The instance type of the function.
- Last
Modified string - The date this resource was last modified.
- Layers []string
- The configuration for layers.
- Memory
Size int - Amount of memory in MB your function can use at runtime. Defaults to
128
. Limits to [128, 32768]. - Name string
- The Function Compute function name. It is the only in one service and is conflict with "name_prefix".
- Name
Prefix string - Setting a prefix to get a only function name. It is conflict with "name".
- Oss
Bucket string - The OSS bucket location containing the function's deployment package. Conflicts with
filename
. This bucket must reside in the same Alibaba Cloud region where you are creating the function. - Oss
Key string - The OSS key of an object containing the function's deployment package. Conflicts with
filename
. - Runtime string
- See [Runtimes][https://www.alibabacloud.com/help/zh/function-compute/latest/manage-functions#multiTask3514] for valid values.
- Service string
- The Function Compute service name.
- Timeout int
- The amount of time your function has to run in seconds.
- ca
Port Integer - The port that the function listen to, only valid for custom runtime and custom container runtime.
- code
Checksum String The checksum (crc64) of the function code.Used to trigger updates.The value can be generated by data source alicloud_file_crc64_checksum.
NOTE: For more information, see Limits.
- custom
Container FunctionConfig Custom Container Config - The configuration for custom container runtime.See
custom_container_config
below. - description String
- The Function Compute function description.
- environment
Variables Map<String,Object> - A map that defines environment variables for the function.
- filename String
- The path to the function's deployment package within the local filesystem. It is conflict with the
oss_
-prefixed options. - function
Id String - The Function Compute service ID.
- handler String
- The function entry point in your code.
- initialization
Timeout Integer - The maximum length of time, in seconds, that the function's initialization should be run for.
- initializer String
- The entry point of the function's initialization.
- instance
Concurrency Integer - The maximum number of requests can be executed concurrently within the single function instance.
- instance
Type String - The instance type of the function.
- last
Modified String - The date this resource was last modified.
- layers List<String>
- The configuration for layers.
- memory
Size Integer - Amount of memory in MB your function can use at runtime. Defaults to
128
. Limits to [128, 32768]. - name String
- The Function Compute function name. It is the only in one service and is conflict with "name_prefix".
- name
Prefix String - Setting a prefix to get a only function name. It is conflict with "name".
- oss
Bucket String - The OSS bucket location containing the function's deployment package. Conflicts with
filename
. This bucket must reside in the same Alibaba Cloud region where you are creating the function. - oss
Key String - The OSS key of an object containing the function's deployment package. Conflicts with
filename
. - runtime String
- See [Runtimes][https://www.alibabacloud.com/help/zh/function-compute/latest/manage-functions#multiTask3514] for valid values.
- service String
- The Function Compute service name.
- timeout Integer
- The amount of time your function has to run in seconds.
- ca
Port number - The port that the function listen to, only valid for custom runtime and custom container runtime.
- code
Checksum string The checksum (crc64) of the function code.Used to trigger updates.The value can be generated by data source alicloud_file_crc64_checksum.
NOTE: For more information, see Limits.
- custom
Container FunctionConfig Custom Container Config - The configuration for custom container runtime.See
custom_container_config
below. - description string
- The Function Compute function description.
- environment
Variables {[key: string]: any} - A map that defines environment variables for the function.
- filename string
- The path to the function's deployment package within the local filesystem. It is conflict with the
oss_
-prefixed options. - function
Id string - The Function Compute service ID.
- handler string
- The function entry point in your code.
- initialization
Timeout number - The maximum length of time, in seconds, that the function's initialization should be run for.
- initializer string
- The entry point of the function's initialization.
- instance
Concurrency number - The maximum number of requests can be executed concurrently within the single function instance.
- instance
Type string - The instance type of the function.
- last
Modified string - The date this resource was last modified.
- layers string[]
- The configuration for layers.
- memory
Size number - Amount of memory in MB your function can use at runtime. Defaults to
128
. Limits to [128, 32768]. - name string
- The Function Compute function name. It is the only in one service and is conflict with "name_prefix".
- name
Prefix string - Setting a prefix to get a only function name. It is conflict with "name".
- oss
Bucket string - The OSS bucket location containing the function's deployment package. Conflicts with
filename
. This bucket must reside in the same Alibaba Cloud region where you are creating the function. - oss
Key string - The OSS key of an object containing the function's deployment package. Conflicts with
filename
. - runtime string
- See [Runtimes][https://www.alibabacloud.com/help/zh/function-compute/latest/manage-functions#multiTask3514] for valid values.
- service string
- The Function Compute service name.
- timeout number
- The amount of time your function has to run in seconds.
- ca_
port int - The port that the function listen to, only valid for custom runtime and custom container runtime.
- code_
checksum str The checksum (crc64) of the function code.Used to trigger updates.The value can be generated by data source alicloud_file_crc64_checksum.
NOTE: For more information, see Limits.
- custom_
container_ Functionconfig Custom Container Config Args - The configuration for custom container runtime.See
custom_container_config
below. - description str
- The Function Compute function description.
- environment_
variables Mapping[str, Any] - A map that defines environment variables for the function.
- filename str
- The path to the function's deployment package within the local filesystem. It is conflict with the
oss_
-prefixed options. - function_
id str - The Function Compute service ID.
- handler str
- The function entry point in your code.
- initialization_
timeout int - The maximum length of time, in seconds, that the function's initialization should be run for.
- initializer str
- The entry point of the function's initialization.
- instance_
concurrency int - The maximum number of requests can be executed concurrently within the single function instance.
- instance_
type str - The instance type of the function.
- last_
modified str - The date this resource was last modified.
- layers Sequence[str]
- The configuration for layers.
- memory_
size int - Amount of memory in MB your function can use at runtime. Defaults to
128
. Limits to [128, 32768]. - name str
- The Function Compute function name. It is the only in one service and is conflict with "name_prefix".
- name_
prefix str - Setting a prefix to get a only function name. It is conflict with "name".
- oss_
bucket str - The OSS bucket location containing the function's deployment package. Conflicts with
filename
. This bucket must reside in the same Alibaba Cloud region where you are creating the function. - oss_
key str - The OSS key of an object containing the function's deployment package. Conflicts with
filename
. - runtime str
- See [Runtimes][https://www.alibabacloud.com/help/zh/function-compute/latest/manage-functions#multiTask3514] for valid values.
- service str
- The Function Compute service name.
- timeout int
- The amount of time your function has to run in seconds.
- ca
Port Number - The port that the function listen to, only valid for custom runtime and custom container runtime.
- code
Checksum String The checksum (crc64) of the function code.Used to trigger updates.The value can be generated by data source alicloud_file_crc64_checksum.
NOTE: For more information, see Limits.
- custom
Container Property MapConfig - The configuration for custom container runtime.See
custom_container_config
below. - description String
- The Function Compute function description.
- environment
Variables Map<Any> - A map that defines environment variables for the function.
- filename String
- The path to the function's deployment package within the local filesystem. It is conflict with the
oss_
-prefixed options. - function
Id String - The Function Compute service ID.
- handler String
- The function entry point in your code.
- initialization
Timeout Number - The maximum length of time, in seconds, that the function's initialization should be run for.
- initializer String
- The entry point of the function's initialization.
- instance
Concurrency Number - The maximum number of requests can be executed concurrently within the single function instance.
- instance
Type String - The instance type of the function.
- last
Modified String - The date this resource was last modified.
- layers List<String>
- The configuration for layers.
- memory
Size Number - Amount of memory in MB your function can use at runtime. Defaults to
128
. Limits to [128, 32768]. - name String
- The Function Compute function name. It is the only in one service and is conflict with "name_prefix".
- name
Prefix String - Setting a prefix to get a only function name. It is conflict with "name".
- oss
Bucket String - The OSS bucket location containing the function's deployment package. Conflicts with
filename
. This bucket must reside in the same Alibaba Cloud region where you are creating the function. - oss
Key String - The OSS key of an object containing the function's deployment package. Conflicts with
filename
. - runtime String
- See [Runtimes][https://www.alibabacloud.com/help/zh/function-compute/latest/manage-functions#multiTask3514] for valid values.
- service String
- The Function Compute service name.
- timeout Number
- The amount of time your function has to run in seconds.
Supporting Types
FunctionCustomContainerConfig, FunctionCustomContainerConfigArgs
Import
Function Compute function can be imported using the id, e.g.
$ pulumi import alicloud:fc/function:Function foo my-fc-service:hello-world
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.