

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# CloudFormation 指定 AWS::Serverless::StateMachine 時產生的資源
<a name="sam-specification-generated-resources-statemachine"></a>

指定 `AWS::Serverless::StateMachine` 時， AWS Serverless Application Model (AWS SAM) 會產生`AWS::StepFunctions::StateMachine`基本 CloudFormation 資源。

**`AWS::StepFunctions::StateMachine`**  
*`LogicalId`: *`<statemachine‑LogicalId>`  
*可參考屬性：*N/A （您必須使用 `LogicalId`來參考此 CloudFormation 資源）

除了此 CloudFormation 資源之外，`AWS::Serverless::StateMachine`指定 時， AWS SAM 也會為下列案例產生 CloudFormation 資源：

**Topics**
+ [未指定角色屬性](#sam-specification-generated-resources-statemachine-not-role)
+ [已指定 API 事件來源](#sam-specification-generated-resources-statemachine-api)
+ [已指定事件橋接 （或事件匯流排） 事件來源](#sam-specification-generated-resources-statemachine-eventbridge)

## 未指定角色屬性
<a name="sam-specification-generated-resources-statemachine-not-role"></a>

`AWS::Serverless::StateMachine` *未*指定 的 `Role` 屬性時， AWS SAM 會產生 `AWS::IAM::Role` CloudFormation 資源。

**`AWS::IAM::Role`**  
*`LogicalId`: *`<statemachine‑LogicalId>Role`  
*可參考屬性：*N/A （您必須使用 `LogicalId`來參考此 CloudFormation 資源）

## 已指定 API 事件來源
<a name="sam-specification-generated-resources-statemachine-api"></a>

當 的 `Event` 屬性`AWS::Serverless::StateMachine`設定為 `Api`，但未**指定 `RestApiId` 屬性時， AWS SAM 會產生 `AWS::ApiGateway::RestApi` CloudFormation 資源。

**`AWS::ApiGateway::RestApi`**  
*`LogicalId`: *`ServerlessRestApi`  
*可參考屬性：*N/A （您必須使用 `LogicalId`來參考此 CloudFormation 資源）

## 已指定事件橋接 （或事件匯流排） 事件來源
<a name="sam-specification-generated-resources-statemachine-eventbridge"></a>

當 的 `Event` 屬性`AWS::Serverless::StateMachine`設定為其中一個事件橋接 （或事件匯流排） 類型時， AWS SAM 會產生 `AWS::Events::Rule` CloudFormation 資源。這適用於下列類型：`EventBridgeRule`、 `Schedule`和 `CloudWatchEvents`。

**`AWS::Events::Rule`**  
*`LogicalId`: *`<statemachine‑LogicalId><event‑LogicalId>`  
*可參考屬性：*N/A （您必須使用 `LogicalId`來參考此 CloudFormation 資源）