StateMachine class
Provides a Step Function State Machine resource
Example Usage
Basic (Standard Workflow)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
// ...
const sfnStateMachine = new aws.sfn.StateMachine("sfn_state_machine", {
name: "my-state-machine",
roleArn: iamForSfn.arn,
definition: `{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"${lambda.arn}\",
\"End\": true
}
}
}
`,
});
import pulumi
import pulumi_aws as aws
# ...
sfn_state_machine = aws.sfn.StateMachine("sfn_state_machine",
name="my-state-machine",
role_arn=iam_for_sfn["arn"],
definition=f"""{{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {{
\"HelloWorld\": {{
\"Type\": \"Task\",
\"Resource\": \"{lambda_["arn"]}\",
\"End\": true
}}
}}
}}
""")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
// ...
var sfnStateMachine = new Aws.Sfn.StateMachine("sfn_state_machine", new()
{
Name = "my-state-machine",
RoleArn = iamForSfn.Arn,
Definition = @$"{{
\""Comment\"": \""A Hello World example of the Amazon States Language using an AWS Lambda Function\"",
\""StartAt\"": \""HelloWorld\"",
\""States\"": {{
\""HelloWorld\"": {{
\""Type\"": \""Task\"",
\""Resource\"": \""{lambda.Arn}\"",
\""End\"": true
}}
}}
}}
",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sfn"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// ...
_, err := sfn.NewStateMachine(ctx, "sfn_state_machine", &sfn.StateMachineArgs{
Name: pulumi.String("my-state-machine"),
RoleArn: pulumi.Any(iamForSfn.Arn),
Definition: pulumi.Sprintf(`{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"%v\",
\"End\": true
}
}
}
`, lambda.Arn),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
# ...
resource "aws_sfn_statemachine" "sfn_state_machine" {
name = "my-state-machine"
role_arn = iamForSfn.arn
definition ="{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"${lambda.arn}\",
\"End\": true
}
}
}
"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sfn.StateMachine;
import com.pulumi.aws.sfn.StateMachineArgs;
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) {
// ...
var sfnStateMachine = new StateMachine("sfnStateMachine", StateMachineArgs.builder()
.name("my-state-machine")
.roleArn(iamForSfn.arn())
.definition("""
{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"%s\",
\"End\": true
}
}
}
", lambda.arn()))
.build());
}
}
resources:
# ...
sfnStateMachine:
type: aws:sfn:StateMachine
name: sfn_state_machine
properties:
name: my-state-machine
roleArn: ${iamForSfn.arn}
definition: |
{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"${lambda.arn}\",
\"End\": true
}
}
}
Basic (Express Workflow)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
// ...
const sfnStateMachine = new aws.sfn.StateMachine("sfn_state_machine", {
name: "my-state-machine",
roleArn: iamForSfn.arn,
type: "EXPRESS",
definition: `{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"${lambda.arn}\",
\"End\": true
}
}
}
`,
});
import pulumi
import pulumi_aws as aws
# ...
sfn_state_machine = aws.sfn.StateMachine("sfn_state_machine",
name="my-state-machine",
role_arn=iam_for_sfn["arn"],
type="EXPRESS",
definition=f"""{{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {{
\"HelloWorld\": {{
\"Type\": \"Task\",
\"Resource\": \"{lambda_["arn"]}\",
\"End\": true
}}
}}
}}
""")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
// ...
var sfnStateMachine = new Aws.Sfn.StateMachine("sfn_state_machine", new()
{
Name = "my-state-machine",
RoleArn = iamForSfn.Arn,
Type = "EXPRESS",
Definition = @$"{{
\""Comment\"": \""A Hello World example of the Amazon States Language using an AWS Lambda Function\"",
\""StartAt\"": \""HelloWorld\"",
\""States\"": {{
\""HelloWorld\"": {{
\""Type\"": \""Task\"",
\""Resource\"": \""{lambda.Arn}\"",
\""End\"": true
}}
}}
}}
",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sfn"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// ...
_, err := sfn.NewStateMachine(ctx, "sfn_state_machine", &sfn.StateMachineArgs{
Name: pulumi.String("my-state-machine"),
RoleArn: pulumi.Any(iamForSfn.Arn),
Type: pulumi.String("EXPRESS"),
Definition: pulumi.Sprintf(`{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"%v\",
\"End\": true
}
}
}
`, lambda.Arn),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
# ...
resource "aws_sfn_statemachine" "sfn_state_machine" {
name = "my-state-machine"
role_arn = iamForSfn.arn
type = "EXPRESS"
definition ="{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"${lambda.arn}\",
\"End\": true
}
}
}
"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sfn.StateMachine;
import com.pulumi.aws.sfn.StateMachineArgs;
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) {
// ...
var sfnStateMachine = new StateMachine("sfnStateMachine", StateMachineArgs.builder()
.name("my-state-machine")
.roleArn(iamForSfn.arn())
.type("EXPRESS")
.definition("""
{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"%s\",
\"End\": true
}
}
}
", lambda.arn()))
.build());
}
}
resources:
# ...
sfnStateMachine:
type: aws:sfn:StateMachine
name: sfn_state_machine
properties:
name: my-state-machine
roleArn: ${iamForSfn.arn}
type: EXPRESS
definition: |
{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"${lambda.arn}\",
\"End\": true
}
}
}
Publish (Publish SFN version)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
// ...
const sfnStateMachine = new aws.sfn.StateMachine("sfn_state_machine", {
name: "my-state-machine",
roleArn: iamForSfn.arn,
publish: true,
type: "EXPRESS",
definition: `{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"${lambda.arn}\",
\"End\": true
}
}
}
`,
});
import pulumi
import pulumi_aws as aws
# ...
sfn_state_machine = aws.sfn.StateMachine("sfn_state_machine",
name="my-state-machine",
role_arn=iam_for_sfn["arn"],
publish=True,
type="EXPRESS",
definition=f"""{{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {{
\"HelloWorld\": {{
\"Type\": \"Task\",
\"Resource\": \"{lambda_["arn"]}\",
\"End\": true
}}
}}
}}
""")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
// ...
var sfnStateMachine = new Aws.Sfn.StateMachine("sfn_state_machine", new()
{
Name = "my-state-machine",
RoleArn = iamForSfn.Arn,
Publish = true,
Type = "EXPRESS",
Definition = @$"{{
\""Comment\"": \""A Hello World example of the Amazon States Language using an AWS Lambda Function\"",
\""StartAt\"": \""HelloWorld\"",
\""States\"": {{
\""HelloWorld\"": {{
\""Type\"": \""Task\"",
\""Resource\"": \""{lambda.Arn}\"",
\""End\"": true
}}
}}
}}
",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sfn"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// ...
_, err := sfn.NewStateMachine(ctx, "sfn_state_machine", &sfn.StateMachineArgs{
Name: pulumi.String("my-state-machine"),
RoleArn: pulumi.Any(iamForSfn.Arn),
Publish: pulumi.Bool(true),
Type: pulumi.String("EXPRESS"),
Definition: pulumi.Sprintf(`{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"%v\",
\"End\": true
}
}
}
`, lambda.Arn),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
# ...
resource "aws_sfn_statemachine" "sfn_state_machine" {
name = "my-state-machine"
role_arn = iamForSfn.arn
publish = true
type = "EXPRESS"
definition ="{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"${lambda.arn}\",
\"End\": true
}
}
}
"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sfn.StateMachine;
import com.pulumi.aws.sfn.StateMachineArgs;
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) {
// ...
var sfnStateMachine = new StateMachine("sfnStateMachine", StateMachineArgs.builder()
.name("my-state-machine")
.roleArn(iamForSfn.arn())
.publish(true)
.type("EXPRESS")
.definition("""
{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"%s\",
\"End\": true
}
}
}
", lambda.arn()))
.build());
}
}
resources:
# ...
sfnStateMachine:
type: aws:sfn:StateMachine
name: sfn_state_machine
properties:
name: my-state-machine
roleArn: ${iamForSfn.arn}
publish: true
type: EXPRESS
definition: |
{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"${lambda.arn}\",
\"End\": true
}
}
}
Logging
> NOTE: See the AWS Step Functions Developer Guide for more information about enabling Step Function logging.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
// ...
const sfnStateMachine = new aws.sfn.StateMachine("sfn_state_machine", {
loggingConfiguration: {
logDestination: `${logGroupForSfn.arn}:*`,
includeExecutionData: true,
level: "ERROR",
},
name: "my-state-machine",
roleArn: iamForSfn.arn,
definition: `{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"${lambda.arn}\",
\"End\": true
}
}
}
`,
});
import pulumi
import pulumi_aws as aws
# ...
sfn_state_machine = aws.sfn.StateMachine("sfn_state_machine",
logging_configuration={
"log_destination": f"{log_group_for_sfn['arn']}:*",
"include_execution_data": True,
"level": "ERROR",
},
name="my-state-machine",
role_arn=iam_for_sfn["arn"],
definition=f"""{{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {{
\"HelloWorld\": {{
\"Type\": \"Task\",
\"Resource\": \"{lambda_["arn"]}\",
\"End\": true
}}
}}
}}
""")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
// ...
var sfnStateMachine = new Aws.Sfn.StateMachine("sfn_state_machine", new()
{
LoggingConfiguration = new Aws.Sfn.Inputs.StateMachineLoggingConfigurationArgs
{
LogDestination = $"{logGroupForSfn.Arn}:*",
IncludeExecutionData = true,
Level = "ERROR",
},
Name = "my-state-machine",
RoleArn = iamForSfn.Arn,
Definition = @$"{{
\""Comment\"": \""A Hello World example of the Amazon States Language using an AWS Lambda Function\"",
\""StartAt\"": \""HelloWorld\"",
\""States\"": {{
\""HelloWorld\"": {{
\""Type\"": \""Task\"",
\""Resource\"": \""{lambda.Arn}\"",
\""End\"": true
}}
}}
}}
",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sfn"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// ...
_, err := sfn.NewStateMachine(ctx, "sfn_state_machine", &sfn.StateMachineArgs{
LoggingConfiguration: &sfn.StateMachineLoggingConfigurationArgs{
LogDestination: pulumi.Sprintf("%v:*", logGroupForSfn.Arn),
IncludeExecutionData: pulumi.Bool(true),
Level: pulumi.String("ERROR"),
},
Name: pulumi.String("my-state-machine"),
RoleArn: pulumi.Any(iamForSfn.Arn),
Definition: pulumi.Sprintf(`{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"%v\",
\"End\": true
}
}
}
`, lambda.Arn),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
# ...
resource "aws_sfn_statemachine" "sfn_state_machine" {
logging_configuration = {
log_destination ="${logGroupForSfn.arn}:*"
include_execution_data = true
level = "ERROR"
}
name = "my-state-machine"
role_arn = iamForSfn.arn
definition ="{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"${lambda.arn}\",
\"End\": true
}
}
}
"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sfn.StateMachine;
import com.pulumi.aws.sfn.StateMachineArgs;
import com.pulumi.aws.sfn.inputs.StateMachineLoggingConfigurationArgs;
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) {
// ...
var sfnStateMachine = new StateMachine("sfnStateMachine", StateMachineArgs.builder()
.loggingConfiguration(StateMachineLoggingConfigurationArgs.builder()
.logDestination(String.format("%s:*", logGroupForSfn.arn()))
.includeExecutionData(true)
.level("ERROR")
.build())
.name("my-state-machine")
.roleArn(iamForSfn.arn())
.definition("""
{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"%s\",
\"End\": true
}
}
}
", lambda.arn()))
.build());
}
}
resources:
# ...
sfnStateMachine:
type: aws:sfn:StateMachine
name: sfn_state_machine
properties:
loggingConfiguration:
logDestination: ${logGroupForSfn.arn}:*
includeExecutionData: true
level: ERROR
name: my-state-machine
roleArn: ${iamForSfn.arn}
definition: |
{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"${lambda.arn}\",
\"End\": true
}
}
}
Encryption
> NOTE: See the section Data at rest encyption in the AWS Step Functions Developer Guide for more information about enabling encryption of data using a customer-managed key for Step Functions State Machines data.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
// ...
const sfnStateMachine = new aws.sfn.StateMachine("sfn_state_machine", {
encryptionConfiguration: {
kmsKeyId: kmsKeyForSfn.arn,
type: "CUSTOMER_MANAGED_KMS_KEY",
kmsDataKeyReusePeriodSeconds: 900,
},
name: "my-state-machine",
roleArn: iamForSfn.arn,
definition: `{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"${lambda.arn}\",
\"End\": true
}
}
}
`,
});
import pulumi
import pulumi_aws as aws
# ...
sfn_state_machine = aws.sfn.StateMachine("sfn_state_machine",
encryption_configuration={
"kms_key_id": kms_key_for_sfn["arn"],
"type": "CUSTOMER_MANAGED_KMS_KEY",
"kms_data_key_reuse_period_seconds": 900,
},
name="my-state-machine",
role_arn=iam_for_sfn["arn"],
definition=f"""{{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {{
\"HelloWorld\": {{
\"Type\": \"Task\",
\"Resource\": \"{lambda_["arn"]}\",
\"End\": true
}}
}}
}}
""")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
// ...
var sfnStateMachine = new Aws.Sfn.StateMachine("sfn_state_machine", new()
{
EncryptionConfiguration = new Aws.Sfn.Inputs.StateMachineEncryptionConfigurationArgs
{
KmsKeyId = kmsKeyForSfn.Arn,
Type = "CUSTOMER_MANAGED_KMS_KEY",
KmsDataKeyReusePeriodSeconds = 900,
},
Name = "my-state-machine",
RoleArn = iamForSfn.Arn,
Definition = @$"{{
\""Comment\"": \""A Hello World example of the Amazon States Language using an AWS Lambda Function\"",
\""StartAt\"": \""HelloWorld\"",
\""States\"": {{
\""HelloWorld\"": {{
\""Type\"": \""Task\"",
\""Resource\"": \""{lambda.Arn}\"",
\""End\"": true
}}
}}
}}
",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sfn"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// ...
_, err := sfn.NewStateMachine(ctx, "sfn_state_machine", &sfn.StateMachineArgs{
EncryptionConfiguration: &sfn.StateMachineEncryptionConfigurationArgs{
KmsKeyId: pulumi.Any(kmsKeyForSfn.Arn),
Type: pulumi.String("CUSTOMER_MANAGED_KMS_KEY"),
KmsDataKeyReusePeriodSeconds: pulumi.Int(900),
},
Name: pulumi.String("my-state-machine"),
RoleArn: pulumi.Any(iamForSfn.Arn),
Definition: pulumi.Sprintf(`{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"%v\",
\"End\": true
}
}
}
`, lambda.Arn),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
# ...
resource "aws_sfn_statemachine" "sfn_state_machine" {
encryption_configuration = {
kms_key_id = kmsKeyForSfn.arn
type = "CUSTOMER_MANAGED_KMS_KEY"
kms_data_key_reuse_period_seconds = 900
}
name = "my-state-machine"
role_arn = iamForSfn.arn
definition ="{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"${lambda.arn}\",
\"End\": true
}
}
}
"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sfn.StateMachine;
import com.pulumi.aws.sfn.StateMachineArgs;
import com.pulumi.aws.sfn.inputs.StateMachineEncryptionConfigurationArgs;
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) {
// ...
var sfnStateMachine = new StateMachine("sfnStateMachine", StateMachineArgs.builder()
.encryptionConfiguration(StateMachineEncryptionConfigurationArgs.builder()
.kmsKeyId(kmsKeyForSfn.arn())
.type("CUSTOMER_MANAGED_KMS_KEY")
.kmsDataKeyReusePeriodSeconds(900)
.build())
.name("my-state-machine")
.roleArn(iamForSfn.arn())
.definition("""
{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"%s\",
\"End\": true
}
}
}
", lambda.arn()))
.build());
}
}
resources:
# ...
sfnStateMachine:
type: aws:sfn:StateMachine
name: sfn_state_machine
properties:
encryptionConfiguration:
kmsKeyId: ${kmsKeyForSfn.arn}
type: CUSTOMER_MANAGED_KMS_KEY
kmsDataKeyReusePeriodSeconds: 900
name: my-state-machine
roleArn: ${iamForSfn.arn}
definition: |
{
\"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",
\"StartAt\": \"HelloWorld\",
\"States\": {
\"HelloWorld\": {
\"Type\": \"Task\",
\"Resource\": \"${lambda.arn}\",
\"End\": true
}
}
}
Import
Identity Schema
Required
arn(String) ARN of the state machine.
Using pulumi import, import State Machines using the arn. For example:
$ pulumi import aws:sfn/stateMachine:StateMachine foo arn:aws:states:eu-west-1:123456789098:stateMachine:bar
Constructors
- StateMachine(String name, {StateMachineArgs? args, CustomResourceOptions? options})
-
Creates a new StateMachine.
nameThe Pulumi resource name.argsArguments used to configure this StateMachine. The set of arguments for StateMachine.optionsResource options controlling this resource's behavior. - StateMachine.reference(String urn)
- Creates a typed reference to an existing StateMachine resource.
Properties
-
arn
↔ Output<
String> -
The ARN of the state machine.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
creationDate
↔ Output<
String> -
The date the state machine was created.
latefinal
-
definition
↔ Output<
String> -
The Amazon States Language definition of the state machine.
latefinal
-
description
↔ Output<
String> -
latefinal
-
encryptionConfiguration
↔ Output<
StateMachineEncryptionConfiguration> -
Defines what encryption configuration is used to encrypt data in the State Machine. For more information see
TBDin the AWS Step Functions User Guide.latefinal - hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
loggingConfiguration
↔ Output<
StateMachineLoggingConfiguration> -
Defines what execution history events are logged and where they are logged. The
loggingConfigurationparameter is valid whentypeis set toSTANDARDorEXPRESS. Defaults toOFF. For more information see Logging Express Workflows, Log Levels and Logging Configuration in the AWS Step Functions User Guide.latefinal -
name
↔ Output<
String> -
The name of the state machine. The name should only contain
0-9,A-Z,a-z,-and_. If omitted, the provider will assign a random, unique name.latefinal -
namePrefix
↔ Output<
String> -
Creates a unique name beginning with the specified prefix. Conflicts with
name.latefinal -
publish
↔ Output<
bool?> -
Set to true to publish a version of the state machine during creation. Default: false.
latefinal
-
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
-
revisionId
↔ Output<
String> -
latefinal
-
roleArn
↔ Output<
String> -
ARN of the IAM role to use for this state machine.
latefinal
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stateMachineVersionArn
↔ Output<
String> -
The ARN of the state machine version.
latefinal
-
status
↔ Output<
String> -
The current status of the state machine. Either
ACTIVEorDELETING.latefinal -
Key-value map of resource tags. .If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
A map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
tracingConfiguration
↔ Output<
StateMachineTracingConfiguration> -
Selects whether AWS X-Ray tracing is enabled.
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
type
↔ Output<
String?> -
Determines whether a Standard or Express state machine is created. The default is
STANDARD. You cannot update the type of a state machine once it has been created. Valid values:STANDARD,EXPRESS.latefinal -
urn
↔ Output<
String> -
latefinalinherited
-
versionDescription
↔ Output<
String> -
latefinal
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {StateMachineState? state, CustomResourceOptions? options}) → StateMachine -
Gets an existing StateMachine resource's state with the given
nameandid.