Application Args
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
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
const config = new pulumi.Config();
const region = config.get("region") || "cn-hangzhou";
const name = config.get("name") || "tf-example";
const defaultInteger = new random.index.Integer("default", {
max: 99999,
min: 10000,
});
const default = alicloud.getRegions({
current: true,
});
const defaultGetZones = alicloud.getZones({
availableResourceCreation: "VSwitch",
});
const defaultNetwork = new alicloud.vpc.Network("default", {
vpcName: name,
cidrBlock: "10.4.0.0/16",
});
const defaultSwitch = new alicloud.vpc.Switch("default", {
vswitchName: name,
cidrBlock: "10.4.0.0/24",
vpcId: defaultNetwork.id,
zoneId: defaultGetZones.then(defaultGetZones => defaultGetZones.zones?.[0]?.id),
});
const defaultSecurityGroup = new alicloud.ecs.SecurityGroup("default", {vpcId: defaultNetwork.id});
const defaultNamespace = new alicloud.sae.Namespace("default", {
namespaceId: _default.then(_default => `${_default.regions?.[0]?.id}:example${defaultInteger.result}`),
namespaceName: name,
namespaceDescription: name,
enableMicroRegistration: false,
});
const defaultApplication = new alicloud.sae.Application("default", {
appDescription: name,
appName: `${name}-${defaultInteger.result}`,
namespaceId: defaultNamespace.id,
imageUrl: _default.then(_default => `registry-vpc.${_default.regions?.[0]?.id}.aliyuncs.com/sae-demo-image/consumer:1.0`),
packageType: "Image",
securityGroupId: defaultSecurityGroup.id,
vpcId: defaultNetwork.id,
vswitchId: defaultSwitch.id,
timezone: "Asia/Beijing",
replicas: 5,
cpu: 500,
memory: 2048,
});import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
config = pulumi.Config()
region = config.get("region")
if region is None:
region = "cn-hangzhou"
name = config.get("name")
if name is None:
name = "tf-example"
default_integer = random.index.Integer("default",
max=99999,
min=10000)
default = alicloud.get_regions(current=True)
default_get_zones = alicloud.get_zones(available_resource_creation="VSwitch")
default_network = alicloud.vpc.Network("default",
vpc_name=name,
cidr_block="10.4.0.0/16")
default_switch = alicloud.vpc.Switch("default",
vswitch_name=name,
cidr_block="10.4.0.0/24",
vpc_id=default_network.id,
zone_id=default_get_zones.zones[0].id)
default_security_group = alicloud.ecs.SecurityGroup("default", vpc_id=default_network.id)
default_namespace = alicloud.sae.Namespace("default",
namespace_id=f"{default.regions[0].id}:example{default_integer['result']}",
namespace_name=name,
namespace_description=name,
enable_micro_registration=False)
default_application = alicloud.sae.Application("default",
app_description=name,
app_name=f"{name}-{default_integer['result']}",
namespace_id=default_namespace.id,
image_url=f"registry-vpc.{default.regions[0].id}.aliyuncs.com/sae-demo-image/consumer:1.0",
package_type="Image",
security_group_id=default_security_group.id,
vpc_id=default_network.id,
vswitch_id=default_switch.id,
timezone="Asia/Beijing",
replicas=5,
cpu=500,
memory=2048)using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var region = config.Get("region") ?? "cn-hangzhou";
var name = config.Get("name") ?? "tf-example";
var defaultInteger = new Random.Index.Integer("default", new()
{
Max = 99999,
Min = 10000,
});
var @default = AliCloud.GetRegions.Invoke(new()
{
Current = true,
});
var defaultGetZones = AliCloud.GetZones.Invoke(new()
{
AvailableResourceCreation = "VSwitch",
});
var defaultNetwork = new AliCloud.Vpc.Network("default", new()
{
VpcName = name,
CidrBlock = "10.4.0.0/16",
});
var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
{
VswitchName = name,
CidrBlock = "10.4.0.0/24",
VpcId = defaultNetwork.Id,
ZoneId = defaultGetZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
});
var defaultSecurityGroup = new AliCloud.Ecs.SecurityGroup("default", new()
{
VpcId = defaultNetwork.Id,
});
var defaultNamespace = new AliCloud.Sae.Namespace("default", new()
{
NamespaceId = @default.Apply(@default => $"{@default.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id)}:example{defaultInteger.Result}"),
NamespaceName = name,
NamespaceDescription = name,
EnableMicroRegistration = false,
});
var defaultApplication = new AliCloud.Sae.Application("default", new()
{
AppDescription = name,
AppName = $"{name}-{defaultInteger.Result}",
NamespaceId = defaultNamespace.Id,
ImageUrl = @default.Apply(@default => $"registry-vpc.{@default.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id)}.aliyuncs.com/sae-demo-image/consumer:1.0"),
PackageType = "Image",
SecurityGroupId = defaultSecurityGroup.Id,
VpcId = defaultNetwork.Id,
VswitchId = defaultSwitch.Id,
Timezone = "Asia/Beijing",
Replicas = 5,
Cpu = 500,
Memory = 2048,
});
});package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/sae"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"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, "")
region := "cn-hangzhou"
if param := cfg.Get("region"); param != "" {
region = param
}
name := "tf-example"
if param := cfg.Get("name"); param != "" {
name = param
}
defaultInteger, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
Max: 99999,
Min: 10000,
})
if err != nil {
return err
}
_default, err := alicloud.GetRegions(ctx, &alicloud.GetRegionsArgs{
Current: pulumi.BoolRef(true),
}, nil)
if err != nil {
return err
}
defaultGetZones, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
AvailableResourceCreation: pulumi.StringRef("VSwitch"),
}, nil)
if err != nil {
return err
}
defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
VpcName: pulumi.String(name),
CidrBlock: pulumi.String("10.4.0.0/16"),
})
if err != nil {
return err
}
defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
VswitchName: pulumi.String(name),
CidrBlock: pulumi.String("10.4.0.0/24"),
VpcId: defaultNetwork.ID(),
ZoneId: pulumi.String(defaultGetZones.Zones[0].Id),
})
if err != nil {
return err
}
defaultSecurityGroup, err := ecs.NewSecurityGroup(ctx, "default", &ecs.SecurityGroupArgs{
VpcId: defaultNetwork.ID(),
})
if err != nil {
return err
}
defaultNamespace, err := sae.NewNamespace(ctx, "default", &sae.NamespaceArgs{
NamespaceId: pulumi.String(fmt.Sprintf("%v:example%v", _default.Regions[0].Id, defaultInteger.Result)),
NamespaceName: pulumi.String(name),
NamespaceDescription: pulumi.String(name),
EnableMicroRegistration: pulumi.Bool(false),
})
if err != nil {
return err
}
_, err = sae.NewApplication(ctx, "default", &sae.ApplicationArgs{
AppDescription: pulumi.String(name),
AppName: pulumi.String(fmt.Sprintf("%v-%v", name, defaultInteger.Result)),
NamespaceId: defaultNamespace.ID(),
ImageUrl: pulumi.String(fmt.Sprintf("registry-vpc.%v.aliyuncs.com/sae-demo-image/consumer:1.0", _default.Regions[0].Id)),
PackageType: pulumi.String("Image"),
SecurityGroupId: defaultSecurityGroup.ID(),
VpcId: defaultNetwork.ID(),
VswitchId: defaultSwitch.ID(),
Timezone: pulumi.String("Asia/Beijing"),
Replicas: pulumi.Int(5),
Cpu: pulumi.Int(500),
Memory: pulumi.Int(2048),
})
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.random.integer;
import com.pulumi.random.IntegerArgs;
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");
var defaultInteger = new Integer("defaultInteger", IntegerArgs.builder()
.max(99999)
.min(10000)
.build());
final var default = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
.current(true)
.build());
final var defaultGetZones = 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(defaultGetZones.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%s", default_.regions()[0].id(),defaultInteger.result()))
.namespaceName(name)
.namespaceDescription(name)
.enableMicroRegistration(false)
.build());
var defaultApplication = new Application("defaultApplication", ApplicationArgs.builder()
.appDescription(name)
.appName(String.format("%s-%s", name,defaultInteger.result()))
.namespaceId(defaultNamespace.id())
.imageUrl(String.format("registry-vpc.%s.aliyuncs.com/sae-demo-image/consumer:1.0", default_.regions()[0].id()))
.packageType("Image")
.securityGroupId(defaultSecurityGroup.id())
.vpcId(defaultNetwork.id())
.vswitchId(defaultSwitch.id())
.timezone("Asia/Beijing")
.replicas("5")
.cpu("500")
.memory("2048")
.build());
}
}configuration:
region:
type: string
default: cn-hangzhou
name:
type: string
default: tf-example
resources:
defaultInteger:
type: random:integer
name: default
properties:
max: 99999
min: 10000
defaultNetwork:
type: alicloud:vpc:Network
name: default
properties:
vpcName: ${name}
cidrBlock: 10.4.0.0/16
defaultSwitch:
type: alicloud:vpc:Switch
name: default
properties:
vswitchName: ${name}
cidrBlock: 10.4.0.0/24
vpcId: ${defaultNetwork.id}
zoneId: ${defaultGetZones.zones[0].id}
defaultSecurityGroup:
type: alicloud:ecs:SecurityGroup
name: default
properties:
vpcId: ${defaultNetwork.id}
defaultNamespace:
type: alicloud:sae:Namespace
name: default
properties:
namespaceId: ${default.regions[0].id}:example${defaultInteger.result}
namespaceName: ${name}
namespaceDescription: ${name}
enableMicroRegistration: false
defaultApplication:
type: alicloud:sae:Application
name: default
properties:
appDescription: ${name}
appName: ${name}-${defaultInteger.result}
namespaceId: ${defaultNamespace.id}
imageUrl: registry-vpc.${default.regions[0].id}.aliyuncs.com/sae-demo-image/consumer:1.0
packageType: Image
securityGroupId: ${defaultSecurityGroup.id}
vpcId: ${defaultNetwork.id}
vswitchId: ${defaultSwitch.id}
timezone: Asia/Beijing
replicas: '5'
cpu: '500'
memory: '2048'
variables:
default:
fn::invoke:
Function: alicloud:getRegions
Arguments:
current: true
defaultGetZones:
fn::invoke:
Function: alicloud:getZones
Arguments:
availableResourceCreation: VSwitchImport
Serverless App Engine (SAE) Application can be imported using the id, e.g.
$ pulumi import alicloud:sae/application:Application example <id>Constructors
Functions
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.