Application
Provides a Serverless App Engine (SAE) Application resource. For information about Serverless App Engine (SAE) Application and how to use it, see What is Application.
NOTE: Available since v1.161.0.
Example Usage
Basic Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetRegionsArgs;
import com.pulumi.alicloud.inputs.GetZonesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.ecs.SecurityGroup;
import com.pulumi.alicloud.ecs.SecurityGroupArgs;
import com.pulumi.alicloud.sae.Namespace;
import com.pulumi.alicloud.sae.NamespaceArgs;
import com.pulumi.alicloud.sae.Application;
import com.pulumi.alicloud.sae.ApplicationArgs;
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 region = config.get("region").orElse("cn-hangzhou");
final var name = config.get("name").orElse("tf-example");
final var defaultRegions = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
.current(true)
.build());
final var defaultZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
.availableResourceCreation("VSwitch")
.build());
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("10.4.0.0/16")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vswitchName(name)
.cidrBlock("10.4.0.0/24")
.vpcId(defaultNetwork.id())
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.build());
var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder()
.vpcId(defaultNetwork.id())
.build());
var defaultNamespace = new Namespace("defaultNamespace", NamespaceArgs.builder()
.namespaceId(String.format("%s:example", defaultRegions.applyValue(getRegionsResult -> getRegionsResult.regions()[0].id())))
.namespaceName(name)
.namespaceDescription(name)
.enableMicroRegistration(false)
.build());
var defaultApplication = new Application("defaultApplication", ApplicationArgs.builder()
.appDescription(name)
.appName(name)
.namespaceId(defaultNamespace.id())
.imageUrl(String.format("registry-vpc.%s.aliyuncs.com/sae-demo-image/consumer:1.0", defaultRegions.applyValue(getRegionsResult -> getRegionsResult.regions()[0].id())))
.packageType("Image")
.securityGroupId(defaultSecurityGroup.id())
.vpcId(defaultNetwork.id())
.vswitchId(defaultSwitch.id())
.timezone("Asia/Beijing")
.replicas("5")
.cpu("500")
.memory("2048")
.build());
}
}
Import
Serverless App Engine (SAE) Application can be imported using the id, e.g.
$ pulumi import alicloud:sae/application:Application example <id>
Properties
Minimum Survival Instance Percentage. NOTE: When min_ready_instances
and min_ready_instance_ratio
are passed at the same time, and the value of min_ready_instance_ratio
is not -1, the min_ready_instance_ratio
parameter shall prevail. Assuming that min_ready_instances
is 5 and min_ready_instance_ratio
is 50, 50 is used to calculate the minimum number of surviving instances.The value description is as follows:
Application package type. Valid values: FatJar
, War
, Image
, PhpZip
, IMAGE_PHP_5_4
, IMAGE_PHP_5_4_ALPINE
, IMAGE_PHP_5_5
, IMAGE_PHP_5_5_ALPINE
, IMAGE_PHP_5_6
, IMAGE_PHP_5_6_ALPINE
, IMAGE_PHP_7_0
, IMAGE_PHP_7_0_ALPINE
, IMAGE_PHP_7_1
, IMAGE_PHP_7_1_ALPINE
, IMAGE_PHP_7_2
, IMAGE_PHP_7_2_ALPINE
, IMAGE_PHP_7_3
, IMAGE_PHP_7_3_ALPINE
, PythonZip
.
Application startup status checks, containers that fail multiple health checks will be shut down and restarted. Containers that do not pass the health check will not receive SLB traffic. For example: {exec
:{command
:`sh`,"-c","cat /home/admin/start.sh"},initialDelaySeconds
:30,periodSeconds
:30,"timeoutSeconds ":2}. Valid values: command
, initialDelaySeconds
, periodSeconds
, timeoutSeconds
. NOTE: Field readiness
has been deprecated from provider version 1.211.0. New field readiness_v2
instead.
Tomcat file configuration, set to "{}" means to delete the configuration: useDefaultConfig: Whether to use a custom configuration, if it is true, it means that the custom configuration is not used; if it is false, it means that the custom configuration is used. If you do not use custom configuration, the following parameter configuration will not take effect. contextInputType: Select the access path of the application. war: No need to fill in the custom path, the access path of the application is the WAR package name. root: No need to fill in the custom path, the access path of the application is /. custom: You need to fill in the custom path in the custom path below. contextPath: custom path, this parameter only needs to be configured when the contextInputType type is custom. httpPort: The port range is 1024~65535. Ports less than 1024 need Root permission to operate. Because the container is configured with Admin permissions, please fill in a port greater than 1024. If not configured, the default is 8080. maxThreads: Configure the number of connections in the connection pool, the default size is 400. uriEncoding: Tomcat encoding format, including UTF-8, ISO-8859-1, GBK and GB2312. If not set, the default is ISO-8859-1. useBodyEncoding: Whether to use BodyEncoding for URL. Valid values: contextInputType
, contextPath
, httpPort
, maxThreads
, uriEncoding
, useBodyEncoding
, useDefaultConfig
. NOTE: Field tomcat_config
has been deprecated from provider version 1.211.0. New field tomcat_config_v2
instead.