StateMachine |
Provides a Step Function State Machine resource
## Example Usage
### Basic (Standard Workflow)
```java
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.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 sfnStateMachine = new StateMachine("sfnStateMachine", StateMachineArgs.builder()
.roleArn(aws_iam_role.iam_for_sfn().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
}
}
}
", aws_lambda_function.lambda().arn()))
.build());
}
}
```
### Basic (Express Workflow)
```java
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.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 sfnStateMachine = new StateMachine("sfnStateMachine", StateMachineArgs.builder()
.roleArn(aws_iam_role.iam_for_sfn().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
}
}
}
", aws_lambda_function.lambda().arn()))
.build());
}
}
```
### Publish (Publish SFN version)
```java
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.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 sfnStateMachine = new StateMachine("sfnStateMachine", StateMachineArgs.builder()
.roleArn(aws_iam_role.iam_for_sfn().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
}
}
}
", aws_lambda_function.lambda().arn()))
.build());
}
}
```
### Logging
> *NOTE:* See the [AWS Step Functions Developer Guide](https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html) for more information about enabling Step Function logging.
|