Service Args
Provides a Alicloud Function Compute Service resource. The resource is the base of launching Function and Trigger 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: If you happen the error "Argument 'internetAccess' is not supported", you need to log on web console and click button "Apply VPC Function" which is in the upper of Function Service Web Console page. NOTE: Currently not all regions support Function Compute Service. For more details supported regions, see Service endpoints NOTE: Available since v1.93.0.
Example Usage
Basic Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.RandomInteger;
import com.pulumi.random.RandomIntegerArgs;
import com.pulumi.alicloud.log.Project;
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 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 defaultRandomInteger = new RandomInteger("defaultRandomInteger", RandomIntegerArgs.builder()
.max(99999)
.min(10000)
.build());
var defaultProject = new Project("defaultProject");
var defaultStore = new Store("defaultStore", StoreArgs.builder()
.project(defaultProject.name())
.build());
var defaultRole = new Role("defaultRole", RoleArgs.builder()
.document("""
{
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"fc.aliyuncs.com"
]
}
}
],
"Version": "1"
}
""")
.description("this is a example")
.force(true)
.build());
var defaultRolePolicyAttachment = new RolePolicyAttachment("defaultRolePolicyAttachment", RolePolicyAttachmentArgs.builder()
.roleName(defaultRole.name())
.policyName("AliyunLogFullAccess")
.policyType("System")
.build());
var defaultService = new Service("defaultService", ServiceArgs.builder()
.description("example-value")
.role(defaultRole.arn())
.logConfig(ServiceLogConfigArgs.builder()
.project(defaultProject.name())
.logstore(defaultStore.name())
.enableInstanceMetrics(true)
.enableRequestMetrics(true)
.build())
.build());
}
}
Module Support
You can use to the existing fc module to create a service and a function quickly and then set several triggers for it.
Import
Function Compute Service can be imported using the id or name, e.g.
$ pulumi import alicloud:fc/service:Service foo my-fc-service
Constructors
Functions
Properties
Provide this to store your Function Compute Service logs. Fields documented below. See Create a Service. log_config
requires the following: (NOTE: If both project
and logstore
are empty, log_config is considered to be empty or unset.). See log_config
below.
Provide NAS configuration to allow Function Compute Service to access your NAS resources. See nas_config
below.
RAM role arn attached to the Function Compute Service. This governs both who / what can invoke your Function, as well as what resources our Function has access to. See User Permissions for more details.
Provide this to allow your Function Compute to report tracing information. Fields documented below. See Function Compute Tracing Config. tracing_config
requires the following: (NOTE: If both type
and params
are empty, tracing_config is considered to be empty or unset.). See tracing_config
below.
Provide this to allow your Function Compute Service to access your VPC. Fields documented below. See Function Compute Service in VPC. vpc_config
requires the following: (NOTE: If both vswitch_ids
and security_group_id
are empty, vpc_config is considered to be empty or unset.). See vpc_config
below.