Skip to content

Commit 019067d

Browse files
committed
add import documentation, regenerate test config
1 parent 80fe617 commit 019067d

File tree

4 files changed

+110
-89
lines changed

4 files changed

+110
-89
lines changed

internal/service/sfn/testdata/StateMachine/basic/main_gen.tf

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,35 @@
11
# Copyright (c) HashiCorp, Inc.
22
# SPDX-License-Identifier: MPL-2.0
33

4+
resource "aws_sfn_state_machine" "test" {
5+
name = var.rName
6+
role_arn = aws_iam_role.for_sfn.arn
7+
8+
definition = <<EOF
9+
{
10+
"Comment": "A Hello World example of the Amazon States Language using an AWS Lambda Function",
11+
"StartAt": "HelloWorld",
12+
"States": {
13+
"HelloWorld": {
14+
"Type": "Task",
15+
"Resource": "${aws_lambda_function.test.arn}",
16+
"Retry": [
17+
{
18+
"ErrorEquals": [
19+
"States.ALL"
20+
],
21+
"IntervalSeconds": 5,
22+
"MaxAttempts": 5,
23+
"BackoffRate": 8
24+
}
25+
],
26+
"End": true
27+
}
28+
}
29+
}
30+
EOF
31+
}
32+
433
resource "aws_iam_role_policy" "for_lambda" {
534
name = "${var.rName}-lambda"
635
role = aws_iam_role.for_lambda.id
@@ -98,35 +127,6 @@ resource "aws_iam_role" "for_sfn" {
98127
}
99128
EOF
100129
}
101-
102-
resource "aws_sfn_state_machine" "test" {
103-
name = var.rName
104-
role_arn = aws_iam_role.for_sfn.arn
105-
106-
definition = <<EOF
107-
{
108-
"Comment": "A Hello World example of the Amazon States Language using an AWS Lambda Function",
109-
"StartAt": "HelloWorld",
110-
"States": {
111-
"HelloWorld": {
112-
"Type": "Task",
113-
"Resource": "${aws_lambda_function.test.arn}",
114-
"Retry": [
115-
{
116-
"ErrorEquals": [
117-
"States.ALL"
118-
],
119-
"IntervalSeconds": 5,
120-
"MaxAttempts": 5,
121-
"BackoffRate": 8
122-
}
123-
],
124-
"End": true
125-
}
126-
}
127-
}
128-
EOF
129-
}
130130
variable "rName" {
131131
description = "Name for resource"
132132
type = string

internal/service/sfn/testdata/StateMachine/basic_v6.13.0/main_gen.tf

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,35 @@
11
# Copyright (c) HashiCorp, Inc.
22
# SPDX-License-Identifier: MPL-2.0
33

4+
resource "aws_sfn_state_machine" "test" {
5+
name = var.rName
6+
role_arn = aws_iam_role.for_sfn.arn
7+
8+
definition = <<EOF
9+
{
10+
"Comment": "A Hello World example of the Amazon States Language using an AWS Lambda Function",
11+
"StartAt": "HelloWorld",
12+
"States": {
13+
"HelloWorld": {
14+
"Type": "Task",
15+
"Resource": "${aws_lambda_function.test.arn}",
16+
"Retry": [
17+
{
18+
"ErrorEquals": [
19+
"States.ALL"
20+
],
21+
"IntervalSeconds": 5,
22+
"MaxAttempts": 5,
23+
"BackoffRate": 8
24+
}
25+
],
26+
"End": true
27+
}
28+
}
29+
}
30+
EOF
31+
}
32+
433
resource "aws_iam_role_policy" "for_lambda" {
534
name = "${var.rName}-lambda"
635
role = aws_iam_role.for_lambda.id
@@ -98,35 +127,6 @@ resource "aws_iam_role" "for_sfn" {
98127
}
99128
EOF
100129
}
101-
102-
resource "aws_sfn_state_machine" "test" {
103-
name = var.rName
104-
role_arn = aws_iam_role.for_sfn.arn
105-
106-
definition = <<EOF
107-
{
108-
"Comment": "A Hello World example of the Amazon States Language using an AWS Lambda Function",
109-
"StartAt": "HelloWorld",
110-
"States": {
111-
"HelloWorld": {
112-
"Type": "Task",
113-
"Resource": "${aws_lambda_function.test.arn}",
114-
"Retry": [
115-
{
116-
"ErrorEquals": [
117-
"States.ALL"
118-
],
119-
"IntervalSeconds": 5,
120-
"MaxAttempts": 5,
121-
"BackoffRate": 8
122-
}
123-
],
124-
"End": true
125-
}
126-
}
127-
}
128-
EOF
129-
}
130130
variable "rName" {
131131
description = "Name for resource"
132132
type = string

internal/service/sfn/testdata/StateMachine/region_override/main_gen.tf

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
11
# Copyright (c) HashiCorp, Inc.
22
# SPDX-License-Identifier: MPL-2.0
33

4+
resource "aws_sfn_state_machine" "test" {
5+
region = var.region
6+
7+
name = var.rName
8+
role_arn = aws_iam_role.for_sfn.arn
9+
10+
definition = <<EOF
11+
{
12+
"Comment": "A Hello World example of the Amazon States Language using an AWS Lambda Function",
13+
"StartAt": "HelloWorld",
14+
"States": {
15+
"HelloWorld": {
16+
"Type": "Task",
17+
"Resource": "${aws_lambda_function.test.arn}",
18+
"Retry": [
19+
{
20+
"ErrorEquals": [
21+
"States.ALL"
22+
],
23+
"IntervalSeconds": 5,
24+
"MaxAttempts": 5,
25+
"BackoffRate": 8
26+
}
27+
],
28+
"End": true
29+
}
30+
}
31+
}
32+
EOF
33+
}
34+
435
resource "aws_iam_role_policy" "for_lambda" {
536
name = "${var.rName}-lambda"
637
role = aws_iam_role.for_lambda.id
@@ -102,37 +133,6 @@ resource "aws_iam_role" "for_sfn" {
102133
}
103134
EOF
104135
}
105-
106-
resource "aws_sfn_state_machine" "test" {
107-
region = var.region
108-
109-
name = var.rName
110-
role_arn = aws_iam_role.for_sfn.arn
111-
112-
definition = <<EOF
113-
{
114-
"Comment": "A Hello World example of the Amazon States Language using an AWS Lambda Function",
115-
"StartAt": "HelloWorld",
116-
"States": {
117-
"HelloWorld": {
118-
"Type": "Task",
119-
"Resource": "${aws_lambda_function.test.arn}",
120-
"Retry": [
121-
{
122-
"ErrorEquals": [
123-
"States.ALL"
124-
],
125-
"IntervalSeconds": 5,
126-
"MaxAttempts": 5,
127-
"BackoffRate": 8
128-
}
129-
],
130-
"End": true
131-
}
132-
}
133-
}
134-
EOF
135-
}
136136
variable "rName" {
137137
description = "Name for resource"
138138
type = string

website/docs/r/sfn_state_machine.html.markdown

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,27 @@ This resource exports the following attributes in addition to the arguments abov
209209

210210
## Import
211211

212+
In Terraform v1.12.0 and later, the [`import` block](https://developer.hashicorp.com/terraform/language/import) can be used with the `identity` attribute. For example:
213+
214+
```terraform
215+
import {
216+
to = aws_sfn_state_machine.example
217+
identity = {
218+
"arn" = "arn:aws:states:us-east-1:123456789012:stateMachine:MyWorkflow-2024-09-17-a7b3c8f1"
219+
}
220+
}
221+
222+
resource "aws_sfn_state_machine" "example" {
223+
### Configuration omitted for brevity ###
224+
}
225+
```
226+
227+
### Identity Schema
228+
229+
#### Required
230+
231+
- `arn` (String) ARN of the certificate.
232+
212233
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import State Machines using the `arn`. For example:
213234

214235
```terraform

0 commit comments

Comments
 (0)