published on Thursday, Sep 17, 2026 by Pulumi
published on Thursday, Sep 17, 2026 by Pulumi
Provides a ESA Routine resource.
For information about ESA Routine and how to use it, see What is Routine.
NOTE: Available since v1.251.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const _default = new alicloud.esa.Routine("default", {
description: name,
name: name,
code: "addEventListener('fetch', e => e.respondWith(new Response('hello world')))",
codeDescription: "initial version",
deployEnv: "staging",
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = alicloud.esa.Routine("default",
description=name,
name=name,
code="addEventListener('fetch', e => e.respondWith(new Response('hello world')))",
code_description="initial version",
deploy_env="staging")
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/esa"
"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 := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_, err := esa.NewRoutine(ctx, "default", &esa.RoutineArgs{
Description: pulumi.String(name),
Name: pulumi.String(name),
Code: pulumi.String("addEventListener('fetch', e => e.respondWith(new Response('hello world')))"),
CodeDescription: pulumi.String("initial version"),
DeployEnv: pulumi.String("staging"),
})
if err != nil {
return err
}
return nil
})
}
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") ?? "terraform-example";
var @default = new AliCloud.Esa.Routine("default", new()
{
Description = name,
Name = name,
Code = "addEventListener('fetch', e => e.respondWith(new Response('hello world')))",
CodeDescription = "initial version",
DeployEnv = "staging",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.esa.Routine;
import com.pulumi.alicloud.esa.RoutineArgs;
import java.util.ArrayList;
import java.util.Arrays;
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("terraform-example");
var default_ = new Routine("default", RoutineArgs.builder()
.description(name)
.name(name)
.code("addEventListener('fetch', e => e.respondWith(new Response('hello world')))")
.codeDescription("initial version")
.deployEnv("staging")
.build());
}
}
configuration:
name:
type: string
default: terraform-example
resources:
default:
type: alicloud:esa:Routine
properties:
description: ${name}
name: ${name}
code: addEventListener('fetch', e => e.respondWith(new Response('hello world')))
codeDescription: initial version
deployEnv: staging
pulumi {
required_providers {
alicloud = {
source = "pulumi/alicloud"
}
}
}
resource "alicloud_esa_routine" "default" {
description = var.name
name = var.name
code = "addEventListener('fetch', e => e.respondWith(new Response('hello world')))"
code_description = "initial version"
deploy_env = "staging"
}
variable "name" {
type = string
default = "terraform-example"
}
Manage the routine code from a local file:
Create Routine Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Routine(name: string, args?: RoutineArgs, opts?: CustomResourceOptions);@overload
def Routine(resource_name: str,
args: Optional[RoutineArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def Routine(resource_name: str,
opts: Optional[ResourceOptions] = None,
code: Optional[str] = None,
code_description: Optional[str] = None,
deploy_env: Optional[str] = None,
description: Optional[str] = None,
name: Optional[str] = None)func NewRoutine(ctx *Context, name string, args *RoutineArgs, opts ...ResourceOption) (*Routine, error)public Routine(string name, RoutineArgs? args = null, CustomResourceOptions? opts = null)
public Routine(String name, RoutineArgs args)
public Routine(String name, RoutineArgs args, CustomResourceOptions options)
type: alicloud:esa:Routine
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "alicloud_esa_routine" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args RoutineArgs
- 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 RoutineArgs
- 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 RoutineArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RoutineArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RoutineArgs
- 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 routineResource = new AliCloud.Esa.Routine("routineResource", new()
{
Code = "string",
CodeDescription = "string",
DeployEnv = "string",
Description = "string",
Name = "string",
});
example, err := esa.NewRoutine(ctx, "routineResource", &esa.RoutineArgs{
Code: pulumi.String("string"),
CodeDescription: pulumi.String("string"),
DeployEnv: pulumi.String("string"),
Description: pulumi.String("string"),
Name: pulumi.String("string"),
})
resource "alicloud_esa_routine" "routineResource" {
lifecycle {
create_before_destroy = true
}
code = "string"
code_description = "string"
deploy_env = "string"
description = "string"
name = "string"
}
var routineResource = new Routine("routineResource", RoutineArgs.builder()
.code("string")
.codeDescription("string")
.deployEnv("string")
.description("string")
.name("string")
.build());
routine_resource = alicloud.esa.Routine("routineResource",
code="string",
code_description="string",
deploy_env="string",
description="string",
name="string")
const routineResource = new alicloud.esa.Routine("routineResource", {
code: "string",
codeDescription: "string",
deployEnv: "string",
description: "string",
name: "string",
});
type: alicloud:esa:Routine
properties:
code: string
codeDescription: string
deployEnv: string
description: string
name: string
Routine Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Routine resource accepts the following input properties:
- Code string
- The JavaScript source code of the routine. When set or changed, the code is uploaded as a new staging version and then committed into a formal code version. To manage the code from a local file, use the Terraform built-in
file()function, e.g.code = file("index.js"). - Code
Description string - The description attached to the committed code version.
- Deploy
Env string - The environment whose environment variables are bundled when committing the code version. Valid values:
staging,production. If not set, no environment variables are bundled. - Description string
- The description of the routine.
- Name string
- Routine Name, which must be unique in the same account.
- Code string
- The JavaScript source code of the routine. When set or changed, the code is uploaded as a new staging version and then committed into a formal code version. To manage the code from a local file, use the Terraform built-in
file()function, e.g.code = file("index.js"). - Code
Description string - The description attached to the committed code version.
- Deploy
Env string - The environment whose environment variables are bundled when committing the code version. Valid values:
staging,production. If not set, no environment variables are bundled. - Description string
- The description of the routine.
- Name string
- Routine Name, which must be unique in the same account.
- code string
- The JavaScript source code of the routine. When set or changed, the code is uploaded as a new staging version and then committed into a formal code version. To manage the code from a local file, use the Terraform built-in
file()function, e.g.code = file("index.js"). - code_
description string - The description attached to the committed code version.
- deploy_
env string - The environment whose environment variables are bundled when committing the code version. Valid values:
staging,production. If not set, no environment variables are bundled. - description string
- The description of the routine.
- name string
- Routine Name, which must be unique in the same account.
- code String
- The JavaScript source code of the routine. When set or changed, the code is uploaded as a new staging version and then committed into a formal code version. To manage the code from a local file, use the Terraform built-in
file()function, e.g.code = file("index.js"). - code
Description String - The description attached to the committed code version.
- deploy
Env String - The environment whose environment variables are bundled when committing the code version. Valid values:
staging,production. If not set, no environment variables are bundled. - description String
- The description of the routine.
- name String
- Routine Name, which must be unique in the same account.
- code string
- The JavaScript source code of the routine. When set or changed, the code is uploaded as a new staging version and then committed into a formal code version. To manage the code from a local file, use the Terraform built-in
file()function, e.g.code = file("index.js"). - code
Description string - The description attached to the committed code version.
- deploy
Env string - The environment whose environment variables are bundled when committing the code version. Valid values:
staging,production. If not set, no environment variables are bundled. - description string
- The description of the routine.
- name string
- Routine Name, which must be unique in the same account.
- code str
- The JavaScript source code of the routine. When set or changed, the code is uploaded as a new staging version and then committed into a formal code version. To manage the code from a local file, use the Terraform built-in
file()function, e.g.code = file("index.js"). - code_
description str - The description attached to the committed code version.
- deploy_
env str - The environment whose environment variables are bundled when committing the code version. Valid values:
staging,production. If not set, no environment variables are bundled. - description str
- The description of the routine.
- name str
- Routine Name, which must be unique in the same account.
- code String
- The JavaScript source code of the routine. When set or changed, the code is uploaded as a new staging version and then committed into a formal code version. To manage the code from a local file, use the Terraform built-in
file()function, e.g.code = file("index.js"). - code
Description String - The description attached to the committed code version.
- deploy
Env String - The environment whose environment variables are bundled when committing the code version. Valid values:
staging,production. If not set, no environment variables are bundled. - description String
- The description of the routine.
- name String
- Routine Name, which must be unique in the same account.
Outputs
All input properties are implicitly available as output properties. Additionally, the Routine resource produces the following output properties:
- Create
Time string - The time when the routine was created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Latest
Code stringVersion - The most recent committed code version of the routine.
- Create
Time string - The time when the routine was created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Latest
Code stringVersion - The most recent committed code version of the routine.
- create_
time string - The time when the routine was created.
- id string
- The provider-assigned unique ID for this managed resource.
- latest_
code_ stringversion - The most recent committed code version of the routine.
- create
Time String - The time when the routine was created.
- id String
- The provider-assigned unique ID for this managed resource.
- latest
Code StringVersion - The most recent committed code version of the routine.
- create
Time string - The time when the routine was created.
- id string
- The provider-assigned unique ID for this managed resource.
- latest
Code stringVersion - The most recent committed code version of the routine.
- create_
time str - The time when the routine was created.
- id str
- The provider-assigned unique ID for this managed resource.
- latest_
code_ strversion - The most recent committed code version of the routine.
- create
Time String - The time when the routine was created.
- id String
- The provider-assigned unique ID for this managed resource.
- latest
Code StringVersion - The most recent committed code version of the routine.
Look up Existing Routine Resource
Get an existing Routine 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?: RoutineState, opts?: CustomResourceOptions): Routine@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
code: Optional[str] = None,
code_description: Optional[str] = None,
create_time: Optional[str] = None,
deploy_env: Optional[str] = None,
description: Optional[str] = None,
latest_code_version: Optional[str] = None,
name: Optional[str] = None) -> Routinefunc GetRoutine(ctx *Context, name string, id IDInput, state *RoutineState, opts ...ResourceOption) (*Routine, error)public static Routine Get(string name, Input<string> id, RoutineState? state, CustomResourceOptions? opts = null)public static Routine get(String name, Output<String> id, RoutineState state, CustomResourceOptions options)resources: _: type: alicloud:esa:Routine get: id: ${id}import {
to = alicloud_esa_routine.example
id = "${id}"
}
- 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.
- Code string
- The JavaScript source code of the routine. When set or changed, the code is uploaded as a new staging version and then committed into a formal code version. To manage the code from a local file, use the Terraform built-in
file()function, e.g.code = file("index.js"). - Code
Description string - The description attached to the committed code version.
- Create
Time string - The time when the routine was created.
- Deploy
Env string - The environment whose environment variables are bundled when committing the code version. Valid values:
staging,production. If not set, no environment variables are bundled. - Description string
- The description of the routine.
- Latest
Code stringVersion - The most recent committed code version of the routine.
- Name string
- Routine Name, which must be unique in the same account.
- Code string
- The JavaScript source code of the routine. When set or changed, the code is uploaded as a new staging version and then committed into a formal code version. To manage the code from a local file, use the Terraform built-in
file()function, e.g.code = file("index.js"). - Code
Description string - The description attached to the committed code version.
- Create
Time string - The time when the routine was created.
- Deploy
Env string - The environment whose environment variables are bundled when committing the code version. Valid values:
staging,production. If not set, no environment variables are bundled. - Description string
- The description of the routine.
- Latest
Code stringVersion - The most recent committed code version of the routine.
- Name string
- Routine Name, which must be unique in the same account.
- code string
- The JavaScript source code of the routine. When set or changed, the code is uploaded as a new staging version and then committed into a formal code version. To manage the code from a local file, use the Terraform built-in
file()function, e.g.code = file("index.js"). - code_
description string - The description attached to the committed code version.
- create_
time string - The time when the routine was created.
- deploy_
env string - The environment whose environment variables are bundled when committing the code version. Valid values:
staging,production. If not set, no environment variables are bundled. - description string
- The description of the routine.
- latest_
code_ stringversion - The most recent committed code version of the routine.
- name string
- Routine Name, which must be unique in the same account.
- code String
- The JavaScript source code of the routine. When set or changed, the code is uploaded as a new staging version and then committed into a formal code version. To manage the code from a local file, use the Terraform built-in
file()function, e.g.code = file("index.js"). - code
Description String - The description attached to the committed code version.
- create
Time String - The time when the routine was created.
- deploy
Env String - The environment whose environment variables are bundled when committing the code version. Valid values:
staging,production. If not set, no environment variables are bundled. - description String
- The description of the routine.
- latest
Code StringVersion - The most recent committed code version of the routine.
- name String
- Routine Name, which must be unique in the same account.
- code string
- The JavaScript source code of the routine. When set or changed, the code is uploaded as a new staging version and then committed into a formal code version. To manage the code from a local file, use the Terraform built-in
file()function, e.g.code = file("index.js"). - code
Description string - The description attached to the committed code version.
- create
Time string - The time when the routine was created.
- deploy
Env string - The environment whose environment variables are bundled when committing the code version. Valid values:
staging,production. If not set, no environment variables are bundled. - description string
- The description of the routine.
- latest
Code stringVersion - The most recent committed code version of the routine.
- name string
- Routine Name, which must be unique in the same account.
- code str
- The JavaScript source code of the routine. When set or changed, the code is uploaded as a new staging version and then committed into a formal code version. To manage the code from a local file, use the Terraform built-in
file()function, e.g.code = file("index.js"). - code_
description str - The description attached to the committed code version.
- create_
time str - The time when the routine was created.
- deploy_
env str - The environment whose environment variables are bundled when committing the code version. Valid values:
staging,production. If not set, no environment variables are bundled. - description str
- The description of the routine.
- latest_
code_ strversion - The most recent committed code version of the routine.
- name str
- Routine Name, which must be unique in the same account.
- code String
- The JavaScript source code of the routine. When set or changed, the code is uploaded as a new staging version and then committed into a formal code version. To manage the code from a local file, use the Terraform built-in
file()function, e.g.code = file("index.js"). - code
Description String - The description attached to the committed code version.
- create
Time String - The time when the routine was created.
- deploy
Env String - The environment whose environment variables are bundled when committing the code version. Valid values:
staging,production. If not set, no environment variables are bundled. - description String
- The description of the routine.
- latest
Code StringVersion - The most recent committed code version of the routine.
- name String
- Routine Name, which must be unique in the same account.
Import
ESA Routine can be imported using the id, e.g.
$ pulumi import alicloud:esa/routine:Routine example <id>
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
alicloudTerraform Provider.
published on Thursday, Sep 17, 2026 by Pulumi