@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
252 lines • 9.07 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.StateMachine = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a Step Function State Machine resource
*
* ## Example Usage
*
* ### Basic (Standard Workflow)
*
* ```typescript
* 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
* }
* }
* }
* `,
* });
* ```
*
* ### Basic (Express Workflow)
*
* ```typescript
* 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
* }
* }
* }
* `,
* });
* ```
*
* ### Publish (Publish SFN version)
*
* ```typescript
* 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
* }
* }
* }
* `,
* });
* ```
*
* ### 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.
*
* ```typescript
* 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
* }
* }
* }
* `,
* loggingConfiguration: {
* logDestination: `${logGroupForSfn.arn}:*`,
* includeExecutionData: true,
* level: "ERROR",
* },
* });
* ```
*
* ### Encryption
*
* > *NOTE:* See the section [Data at rest encyption](https://docs.aws.amazon.com/step-functions/latest/dg/encryption-at-rest.html) in the [AWS Step Functions Developer Guide](https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html) for more information about enabling encryption of data using a customer-managed key for Step Functions State Machines data.
*
* ```typescript
* 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
* }
* }
* }
* `,
* encryptionConfiguration: {
* kmsKeyId: kmsKeyForSfn.arn,
* type: "CUSTOMER_MANAGED_KMS_KEY",
* kmsDataKeyReusePeriodSeconds: 900,
* },
* });
* ```
*
* ## Import
*
* ### Identity Schema
*
* #### Required
*
* - `arn` (String) ARN of the state machine.
*
* Using `pulumi import`, import State Machines using the `arn`. For example:
*
* console
*
* % pulumi import aws_sfn_state_machine.foo arn:aws:states:eu-west-1:123456789098:stateMachine:bar
*/
class StateMachine extends pulumi.CustomResource {
/**
* Get an existing StateMachine resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new StateMachine(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of StateMachine. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === StateMachine.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["creationDate"] = state?.creationDate;
resourceInputs["definition"] = state?.definition;
resourceInputs["description"] = state?.description;
resourceInputs["encryptionConfiguration"] = state?.encryptionConfiguration;
resourceInputs["loggingConfiguration"] = state?.loggingConfiguration;
resourceInputs["name"] = state?.name;
resourceInputs["namePrefix"] = state?.namePrefix;
resourceInputs["publish"] = state?.publish;
resourceInputs["region"] = state?.region;
resourceInputs["revisionId"] = state?.revisionId;
resourceInputs["roleArn"] = state?.roleArn;
resourceInputs["stateMachineVersionArn"] = state?.stateMachineVersionArn;
resourceInputs["status"] = state?.status;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["tracingConfiguration"] = state?.tracingConfiguration;
resourceInputs["type"] = state?.type;
resourceInputs["versionDescription"] = state?.versionDescription;
}
else {
const args = argsOrState;
if (args?.definition === undefined && !opts.urn) {
throw new Error("Missing required property 'definition'");
}
if (args?.roleArn === undefined && !opts.urn) {
throw new Error("Missing required property 'roleArn'");
}
resourceInputs["definition"] = args?.definition;
resourceInputs["encryptionConfiguration"] = args?.encryptionConfiguration;
resourceInputs["loggingConfiguration"] = args?.loggingConfiguration;
resourceInputs["name"] = args?.name;
resourceInputs["namePrefix"] = args?.namePrefix;
resourceInputs["publish"] = args?.publish;
resourceInputs["region"] = args?.region;
resourceInputs["roleArn"] = args?.roleArn;
resourceInputs["tags"] = args?.tags;
resourceInputs["tracingConfiguration"] = args?.tracingConfiguration;
resourceInputs["type"] = args?.type;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["creationDate"] = undefined /*out*/;
resourceInputs["description"] = undefined /*out*/;
resourceInputs["revisionId"] = undefined /*out*/;
resourceInputs["stateMachineVersionArn"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
resourceInputs["versionDescription"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(StateMachine.__pulumiType, name, resourceInputs, opts);
}
}
exports.StateMachine = StateMachine;
/** @internal */
StateMachine.__pulumiType = 'aws:sfn/stateMachine:StateMachine';
//# sourceMappingURL=stateMachine.js.map