AWS v6.71.0 published on Friday, Mar 7, 2025 by Pulumi
aws.sfn.getStateMachine
Explore with Pulumi AI
Use this data source to get the ARN of a State Machine in AWS Step Function (SFN). By using this data source, you can reference a state machine without having to hard code the ARNs as input.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.sfn.getStateMachine({
    name: "an_example_sfn_name",
});
import pulumi
import pulumi_aws as aws
example = aws.sfn.get_state_machine(name="an_example_sfn_name")
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sfn"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sfn.LookupStateMachine(ctx, &sfn.LookupStateMachineArgs{
			Name: "an_example_sfn_name",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var example = Aws.Sfn.GetStateMachine.Invoke(new()
    {
        Name = "an_example_sfn_name",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sfn.SfnFunctions;
import com.pulumi.aws.sfn.inputs.GetStateMachineArgs;
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 example = SfnFunctions.getStateMachine(GetStateMachineArgs.builder()
            .name("an_example_sfn_name")
            .build());
    }
}
variables:
  example:
    fn::invoke:
      function: aws:sfn:getStateMachine
      arguments:
        name: an_example_sfn_name
Using getStateMachine
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getStateMachine(args: GetStateMachineArgs, opts?: InvokeOptions): Promise<GetStateMachineResult>
function getStateMachineOutput(args: GetStateMachineOutputArgs, opts?: InvokeOptions): Output<GetStateMachineResult>def get_state_machine(name: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetStateMachineResult
def get_state_machine_output(name: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetStateMachineResult]func LookupStateMachine(ctx *Context, args *LookupStateMachineArgs, opts ...InvokeOption) (*LookupStateMachineResult, error)
func LookupStateMachineOutput(ctx *Context, args *LookupStateMachineOutputArgs, opts ...InvokeOption) LookupStateMachineResultOutput> Note: This function is named LookupStateMachine in the Go SDK.
public static class GetStateMachine 
{
    public static Task<GetStateMachineResult> InvokeAsync(GetStateMachineArgs args, InvokeOptions? opts = null)
    public static Output<GetStateMachineResult> Invoke(GetStateMachineInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetStateMachineResult> getStateMachine(GetStateMachineArgs args, InvokeOptions options)
public static Output<GetStateMachineResult> getStateMachine(GetStateMachineArgs args, InvokeOptions options)
fn::invoke:
  function: aws:sfn/getStateMachine:getStateMachine
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Name string
- Friendly name of the state machine to match.
- Name string
- Friendly name of the state machine to match.
- name String
- Friendly name of the state machine to match.
- name string
- Friendly name of the state machine to match.
- name str
- Friendly name of the state machine to match.
- name String
- Friendly name of the state machine to match.
getStateMachine Result
The following output properties are available:
- Arn string
- Set to the arn of the state function.
- CreationDate string
- Date the state machine was created.
- Definition string
- Set to the state machine definition.
- Description string
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- RevisionId string
- The revision identifier for the state machine.
- RoleArn string
- Set to the role_arn used by the state function.
- Status string
- Set to the current status of the state machine.
- Arn string
- Set to the arn of the state function.
- CreationDate string
- Date the state machine was created.
- Definition string
- Set to the state machine definition.
- Description string
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- RevisionId string
- The revision identifier for the state machine.
- RoleArn string
- Set to the role_arn used by the state function.
- Status string
- Set to the current status of the state machine.
- arn String
- Set to the arn of the state function.
- creationDate String
- Date the state machine was created.
- definition String
- Set to the state machine definition.
- description String
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- revisionId String
- The revision identifier for the state machine.
- roleArn String
- Set to the role_arn used by the state function.
- status String
- Set to the current status of the state machine.
- arn string
- Set to the arn of the state function.
- creationDate string
- Date the state machine was created.
- definition string
- Set to the state machine definition.
- description string
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- revisionId string
- The revision identifier for the state machine.
- roleArn string
- Set to the role_arn used by the state function.
- status string
- Set to the current status of the state machine.
- arn str
- Set to the arn of the state function.
- creation_date str
- Date the state machine was created.
- definition str
- Set to the state machine definition.
- description str
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- revision_id str
- The revision identifier for the state machine.
- role_arn str
- Set to the role_arn used by the state function.
- status str
- Set to the current status of the state machine.
- arn String
- Set to the arn of the state function.
- creationDate String
- Date the state machine was created.
- definition String
- Set to the state machine definition.
- description String
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- revisionId String
- The revision identifier for the state machine.
- roleArn String
- Set to the role_arn used by the state function.
- status String
- Set to the current status of the state machine.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the awsTerraform Provider.