alicloud logo
Alibaba Cloud v3.37.0, May 15 23

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.

Module Support

You can use to the existing fc module to create a function quickly and set several triggers for it.

Example Usage

Basic Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var name = config.Get("name") ?? "alicloudfcfunctionconfig";
    var defaultProject = new AliCloud.Log.Project("defaultProject", new()
    {
        Description = "tf unit test",
    });

    var defaultStore = new AliCloud.Log.Store("defaultStore", new()
    {
        Project = defaultProject.Name,
        RetentionPeriod = 3000,
        ShardCount = 1,
    });

    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 test",
        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 = "tf unit test",
        LogConfig = new AliCloud.FC.Inputs.ServiceLogConfigArgs
        {
            Project = defaultProject.Name,
            Logstore = defaultStore.Name,
        },
        Role = defaultRole.Arn,
    }, new CustomResourceOptions
    {
        DependsOn = new[]
        {
            defaultRolePolicyAttachment,
        },
    });

    var defaultBucket = new AliCloud.Oss.Bucket("defaultBucket", new()
    {
        BucketName = name,
    });

    // 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 = "fc/hello.zip",
        Source = "./hello.zip",
    });

    var foo = new AliCloud.FC.Function("foo", new()
    {
        Service = defaultService.Name,
        Description = "tf",
        OssBucket = defaultBucket.Id,
        OssKey = defaultBucketObject.Key,
        MemorySize = 512,
        Runtime = "python2.7",
        Handler = "hello.handler",
        EnvironmentVariables = 
        {
            { "prefix", "terraform" },
        },
    });

});
package main

import (
	"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/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		name := "alicloudfcfunctionconfig"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		defaultProject, err := log.NewProject(ctx, "defaultProject", &log.ProjectArgs{
			Description: pulumi.String("tf unit test"),
		})
		if err != nil {
			return err
		}
		defaultStore, err := log.NewStore(ctx, "defaultStore", &log.StoreArgs{
			Project:         defaultProject.Name,
			RetentionPeriod: pulumi.Int(3000),
			ShardCount:      pulumi.Int(1),
		})
		if err != nil {
			return err
		}
		defaultRole, err := ram.NewRole(ctx, "defaultRole", &ram.RoleArgs{
			Document:    pulumi.String("        {\n          \"Statement\": [\n            {\n              \"Action\": \"sts:AssumeRole\",\n              \"Effect\": \"Allow\",\n              \"Principal\": {\n                \"Service\": [\n                  \"fc.aliyuncs.com\"\n                ]\n              }\n            }\n          ],\n          \"Version\": \"1\"\n        }\n    \n"),
			Description: pulumi.String("this is a test"),
			Force:       pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		defaultRolePolicyAttachment, 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("tf unit test"),
			LogConfig: &fc.ServiceLogConfigArgs{
				Project:  defaultProject.Name,
				Logstore: defaultStore.Name,
			},
			Role: defaultRole.Arn,
		}, pulumi.DependsOn([]pulumi.Resource{
			defaultRolePolicyAttachment,
		}))
		if err != nil {
			return err
		}
		defaultBucket, err := oss.NewBucket(ctx, "defaultBucket", &oss.BucketArgs{
			Bucket: pulumi.String(name),
		})
		if err != nil {
			return err
		}
		defaultBucketObject, err := oss.NewBucketObject(ctx, "defaultBucketObject", &oss.BucketObjectArgs{
			Bucket: defaultBucket.ID(),
			Key:    pulumi.String("fc/hello.zip"),
			Source: pulumi.String("./hello.zip"),
		})
		if err != nil {
			return err
		}
		_, err = fc.NewFunction(ctx, "foo", &fc.FunctionArgs{
			Service:     defaultService.Name,
			Description: pulumi.String("tf"),
			OssBucket:   defaultBucket.ID(),
			OssKey:      defaultBucketObject.Key,
			MemorySize:  pulumi.Int(512),
			Runtime:     pulumi.String("python2.7"),
			Handler:     pulumi.String("hello.handler"),
			EnvironmentVariables: pulumi.AnyMap{
				"prefix": pulumi.Any("terraform"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
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.resources.CustomResourceOptions;
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 config = ctx.config();
        final var name = config.get("name").orElse("alicloudfcfunctionconfig");
        var defaultProject = new Project("defaultProject", ProjectArgs.builder()        
            .description("tf unit test")
            .build());

        var defaultStore = new Store("defaultStore", StoreArgs.builder()        
            .project(defaultProject.name())
            .retentionPeriod("3000")
            .shardCount(1)
            .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 test")
            .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("tf unit test")
            .logConfig(ServiceLogConfigArgs.builder()
                .project(defaultProject.name())
                .logstore(defaultStore.name())
                .build())
            .role(defaultRole.arn())
            .build(), CustomResourceOptions.builder()
                .dependsOn(defaultRolePolicyAttachment)
                .build());

        var defaultBucket = new Bucket("defaultBucket", BucketArgs.builder()        
            .bucket(name)
            .build());

        var defaultBucketObject = new BucketObject("defaultBucketObject", BucketObjectArgs.builder()        
            .bucket(defaultBucket.id())
            .key("fc/hello.zip")
            .source("./hello.zip")
            .build());

        var foo = new Function("foo", FunctionArgs.builder()        
            .service(defaultService.name())
            .description("tf")
            .ossBucket(defaultBucket.id())
            .ossKey(defaultBucketObject.key())
            .memorySize("512")
            .runtime("python2.7")
            .handler("hello.handler")
            .environmentVariables(Map.of("prefix", "terraform"))
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "alicloudfcfunctionconfig"
default_project = alicloud.log.Project("defaultProject", description="tf unit test")
default_store = alicloud.log.Store("defaultStore",
    project=default_project.name,
    retention_period=3000,
    shard_count=1)
default_role = alicloud.ram.Role("defaultRole",
    document="""        {
          "Statement": [
            {
              "Action": "sts:AssumeRole",
              "Effect": "Allow",
              "Principal": {
                "Service": [
                  "fc.aliyuncs.com"
                ]
              }
            }
          ],
          "Version": "1"
        }
    
""",
    description="this is a test",
    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="tf unit test",
    log_config=alicloud.fc.ServiceLogConfigArgs(
        project=default_project.name,
        logstore=default_store.name,
    ),
    role=default_role.arn,
    opts=pulumi.ResourceOptions(depends_on=[default_role_policy_attachment]))
default_bucket = alicloud.oss.Bucket("defaultBucket", bucket=name)
# 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="fc/hello.zip",
    source="./hello.zip")
foo = alicloud.fc.Function("foo",
    service=default_service.name,
    description="tf",
    oss_bucket=default_bucket.id,
    oss_key=default_bucket_object.key,
    memory_size=512,
    runtime="python2.7",
    handler="hello.handler",
    environment_variables={
        "prefix": "terraform",
    })
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const name = config.get("name") || "alicloudfcfunctionconfig";
const defaultProject = new alicloud.log.Project("defaultProject", {description: "tf unit test"});
const defaultStore = new alicloud.log.Store("defaultStore", {
    project: defaultProject.name,
    retentionPeriod: 3000,
    shardCount: 1,
});
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 test",
    force: true,
});
const defaultRolePolicyAttachment = new alicloud.ram.RolePolicyAttachment("defaultRolePolicyAttachment", {
    roleName: defaultRole.name,
    policyName: "AliyunLogFullAccess",
    policyType: "System",
});
const defaultService = new alicloud.fc.Service("defaultService", {
    description: "tf unit test",
    logConfig: {
        project: defaultProject.name,
        logstore: defaultStore.name,
    },
    role: defaultRole.arn,
}, {
    dependsOn: [defaultRolePolicyAttachment],
});
const defaultBucket = new alicloud.oss.Bucket("defaultBucket", {bucket: name});
// 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: "fc/hello.zip",
    source: "./hello.zip",
});
const foo = new alicloud.fc.Function("foo", {
    service: defaultService.name,
    description: "tf",
    ossBucket: defaultBucket.id,
    ossKey: defaultBucketObject.key,
    memorySize: 512,
    runtime: "python2.7",
    handler: "hello.handler",
    environmentVariables: {
        prefix: "terraform",
    },
});
configuration:
  name:
    type: string
    default: alicloudfcfunctionconfig
resources:
  defaultProject:
    type: alicloud:log:Project
    properties:
      description: tf unit test
  defaultStore:
    type: alicloud:log:Store
    properties:
      project: ${defaultProject.name}
      retentionPeriod: '3000'
      shardCount: 1
  defaultService:
    type: alicloud:fc:Service
    properties:
      description: tf unit test
      logConfig:
        project: ${defaultProject.name}
        logstore: ${defaultStore.name}
      role: ${defaultRole.arn}
    options:
      dependson:
        - ${defaultRolePolicyAttachment}
  defaultBucket:
    type: alicloud:oss:Bucket
    properties:
      bucket: ${name}
  # 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: fc/hello.zip
      source: ./hello.zip
  defaultRole:
    type: alicloud:ram:Role
    properties:
      document: "        {\n          \"Statement\": [\n            {\n              \"Action\": \"sts:AssumeRole\",\n              \"Effect\": \"Allow\",\n              \"Principal\": {\n                \"Service\": [\n                  \"fc.aliyuncs.com\"\n                ]\n              }\n            }\n          ],\n          \"Version\": \"1\"\n        }\n    \n"
      description: this is a test
      force: true
  defaultRolePolicyAttachment:
    type: alicloud:ram:RolePolicyAttachment
    properties:
      roleName: ${defaultRole.name}
      policyName: AliyunLogFullAccess
      policyType: System
  foo:
    type: alicloud:fc:Function
    properties:
      service: ${defaultService.name}
      description: tf
      ossBucket: ${defaultBucket.id}
      ossKey: ${defaultBucketObject.key}
      memorySize: '512'
      runtime: python2.7
      handler: hello.handler
      environmentVariables:
        prefix: terraform

Create Function Resource

new Function(name: string, args: FunctionArgs, opts?: CustomResourceOptions);
@overload
def Function(resource_name: 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,
             handler: Optional[str] = None,
             initialization_timeout: Optional[int] = None,
             initializer: Optional[str] = None,
             instance_concurrency: Optional[int] = None,
             instance_type: 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)
@overload
def Function(resource_name: str,
             args: FunctionArgs,
             opts: Optional[ResourceOptions] = 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.

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.

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.

CaPort int

The port that the function listen to, only valid for custom runtime and custom container runtime.

CodeChecksum 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.

CustomContainerConfig Pulumi.AliCloud.FC.Inputs.FunctionCustomContainerConfigArgs

The configuration for custom container runtime.

Description string

The Function Compute function description.

EnvironmentVariables 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.

InitializationTimeout 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.

InstanceConcurrency int

The maximum number of requests can be executed concurrently within the single function instance.

InstanceType string

The instance type of the function.

Layers List<string>

The configuration for layers.

MemorySize 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".

NamePrefix string

Setting a prefix to get a only function name. It is conflict with "name".

OssBucket 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.

OssKey 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.

CaPort int

The port that the function listen to, only valid for custom runtime and custom container runtime.

CodeChecksum 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.

CustomContainerConfig FunctionCustomContainerConfigArgs

The configuration for custom container runtime.

Description string

The Function Compute function description.

EnvironmentVariables 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.

InitializationTimeout 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.

InstanceConcurrency int

The maximum number of requests can be executed concurrently within the single function instance.

InstanceType string

The instance type of the function.

Layers []string

The configuration for layers.

MemorySize 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".

NamePrefix string

Setting a prefix to get a only function name. It is conflict with "name".

OssBucket 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.

OssKey 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.

caPort Integer

The port that the function listen to, only valid for custom runtime and custom container runtime.

codeChecksum 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.

customContainerConfig FunctionCustomContainerConfigArgs

The configuration for custom container runtime.

description String

The Function Compute function description.

environmentVariables 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.

initializationTimeout 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.

instanceConcurrency Integer

The maximum number of requests can be executed concurrently within the single function instance.

instanceType String

The instance type of the function.

layers List<String>

The configuration for layers.

memorySize 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".

namePrefix String

Setting a prefix to get a only function name. It is conflict with "name".

ossBucket 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.

ossKey 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.

caPort number

The port that the function listen to, only valid for custom runtime and custom container runtime.

codeChecksum 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.

customContainerConfig FunctionCustomContainerConfigArgs

The configuration for custom container runtime.

description string

The Function Compute function description.

environmentVariables {[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.

initializationTimeout 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.

instanceConcurrency number

The maximum number of requests can be executed concurrently within the single function instance.

instanceType string

The instance type of the function.

layers string[]

The configuration for layers.

memorySize 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".

namePrefix string

Setting a prefix to get a only function name. It is conflict with "name".

ossBucket 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.

ossKey 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_config FunctionCustomContainerConfigArgs

The configuration for custom container runtime.

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.

caPort Number

The port that the function listen to, only valid for custom runtime and custom container runtime.

codeChecksum 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.

customContainerConfig Property Map

The configuration for custom container runtime.

description String

The Function Compute function description.

environmentVariables 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.

initializationTimeout 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.

instanceConcurrency Number

The maximum number of requests can be executed concurrently within the single function instance.

instanceType String

The instance type of the function.

layers List<String>

The configuration for layers.

memorySize 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".

namePrefix String

Setting a prefix to get a only function name. It is conflict with "name".

ossBucket 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.

ossKey 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:

FunctionId string

The Function Compute service ID.

Id string

The provider-assigned unique ID for this managed resource.

LastModified string

The date this resource was last modified.

FunctionId string

The Function Compute service ID.

Id string

The provider-assigned unique ID for this managed resource.

LastModified string

The date this resource was last modified.

functionId String

The Function Compute service ID.

id String

The provider-assigned unique ID for this managed resource.

lastModified String

The date this resource was last modified.

functionId string

The Function Compute service ID.

id string

The provider-assigned unique ID for this managed resource.

lastModified 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.

functionId String

The Function Compute service ID.

id String

The provider-assigned unique ID for this managed resource.

lastModified 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.
The following state arguments are supported:
CaPort int

The port that the function listen to, only valid for custom runtime and custom container runtime.

CodeChecksum 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.

CustomContainerConfig Pulumi.AliCloud.FC.Inputs.FunctionCustomContainerConfigArgs

The configuration for custom container runtime.

Description string

The Function Compute function description.

EnvironmentVariables 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.

FunctionId string

The Function Compute service ID.

Handler string

The function entry point in your code.

InitializationTimeout 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.

InstanceConcurrency int

The maximum number of requests can be executed concurrently within the single function instance.

InstanceType string

The instance type of the function.

LastModified string

The date this resource was last modified.

Layers List<string>

The configuration for layers.

MemorySize 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".

NamePrefix string

Setting a prefix to get a only function name. It is conflict with "name".

OssBucket 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.

OssKey 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.

CaPort int

The port that the function listen to, only valid for custom runtime and custom container runtime.

CodeChecksum 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.

CustomContainerConfig FunctionCustomContainerConfigArgs

The configuration for custom container runtime.

Description string

The Function Compute function description.

EnvironmentVariables 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.

FunctionId string

The Function Compute service ID.

Handler string

The function entry point in your code.

InitializationTimeout 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.

InstanceConcurrency int

The maximum number of requests can be executed concurrently within the single function instance.

InstanceType string

The instance type of the function.

LastModified string

The date this resource was last modified.

Layers []string

The configuration for layers.

MemorySize 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".

NamePrefix string

Setting a prefix to get a only function name. It is conflict with "name".

OssBucket 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.

OssKey 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.

caPort Integer

The port that the function listen to, only valid for custom runtime and custom container runtime.

codeChecksum 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.

customContainerConfig FunctionCustomContainerConfigArgs

The configuration for custom container runtime.

description String

The Function Compute function description.

environmentVariables 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.

functionId String

The Function Compute service ID.

handler String

The function entry point in your code.

initializationTimeout 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.

instanceConcurrency Integer

The maximum number of requests can be executed concurrently within the single function instance.

instanceType String

The instance type of the function.

lastModified String

The date this resource was last modified.

layers List<String>

The configuration for layers.

memorySize 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".

namePrefix String

Setting a prefix to get a only function name. It is conflict with "name".

ossBucket 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.

ossKey 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.

caPort number

The port that the function listen to, only valid for custom runtime and custom container runtime.

codeChecksum 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.

customContainerConfig FunctionCustomContainerConfigArgs

The configuration for custom container runtime.

description string

The Function Compute function description.

environmentVariables {[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.

functionId string

The Function Compute service ID.

handler string

The function entry point in your code.

initializationTimeout 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.

instanceConcurrency number

The maximum number of requests can be executed concurrently within the single function instance.

instanceType string

The instance type of the function.

lastModified string

The date this resource was last modified.

layers string[]

The configuration for layers.

memorySize 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".

namePrefix string

Setting a prefix to get a only function name. It is conflict with "name".

ossBucket 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.

ossKey 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_config FunctionCustomContainerConfigArgs

The configuration for custom container runtime.

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.

caPort Number

The port that the function listen to, only valid for custom runtime and custom container runtime.

codeChecksum 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.

customContainerConfig Property Map

The configuration for custom container runtime.

description String

The Function Compute function description.

environmentVariables 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.

functionId String

The Function Compute service ID.

handler String

The function entry point in your code.

initializationTimeout 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.

instanceConcurrency Number

The maximum number of requests can be executed concurrently within the single function instance.

instanceType String

The instance type of the function.

lastModified String

The date this resource was last modified.

layers List<String>

The configuration for layers.

memorySize 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".

namePrefix String

Setting a prefix to get a only function name. It is conflict with "name".

ossBucket 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.

ossKey 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

Image string

The container image address.

Args string

The args field specifies the arguments passed to the command.

Command string

The entry point of the container, which specifies the actual command run by the container.

Image string

The container image address.

Args string

The args field specifies the arguments passed to the command.

Command string

The entry point of the container, which specifies the actual command run by the container.

image String

The container image address.

args String

The args field specifies the arguments passed to the command.

command String

The entry point of the container, which specifies the actual command run by the container.

image string

The container image address.

args string

The args field specifies the arguments passed to the command.

command string

The entry point of the container, which specifies the actual command run by the container.

image str

The container image address.

args str

The args field specifies the arguments passed to the command.

command str

The entry point of the container, which specifies the actual command run by the container.

image String

The container image address.

args String

The args field specifies the arguments passed to the command.

command String

The entry point of the container, which specifies the actual command run by the container.

Import

Function Compute function can be imported using the id, e.g.

 $ pulumi import alicloud:fc/function:Function foo my-fc-service:hello-world

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.