Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chaning definition of aws_sfn_state_machine doesn't update the state machine in AWS #12506

Closed
IevgenRagulin opened this issue Mar 23, 2020 · 5 comments · Fixed by #15434
Closed
Labels
service/sfn Issues and PRs that pertain to the sfn service.
Milestone

Comments

@IevgenRagulin
Copy link

IevgenRagulin commented Mar 23, 2020

Terraform Version

0.11

Affected Resource(s)

aws_sfn_state_machine

Expected Behavior

Modifying the "Definition" of aws_sfn_state_machine should also update the aws_sfn_state_machine in AWS.

Actual Behavior

Modifying the "Definition" of aws_sfn_state_machine hasn't change the definition of aws_sfn_state_machine in AWS.

Steps to Reproduce

  1. Add a terraform resource like this:
resource "aws_sfn_state_machine" "rebuilder_v2" {
    name = "life-aggregates-service-rebuilder"
    role_arn = "${aws_iam_role.rebuilder_state_machine.arn}"

  tags {
    Environment = "${var.target_name}"
    Project = "${var.lifeomic_project}"
  }

  definition = <<EOF
{
  "Comment": "Rebuilder",
  "StartAt": "Rebuild",
  "States": {
    "Rebuild": {
      "Type": "Pass",
      "Result": [
          {"segment": 0, "totalSegments": 2, "rebuildType": "total"},
          {"segment": 1, "totalSegments": 2, "rebuildType": "total"},
      ],
      "Next": "Fanout"
    },
    "Fanout": {
      "Type": "Map",
      "Iterator": {
        "StartAt": "Scan",
        "States": {
          "Scan": {
            "Type": "Task",
            "Resource": "${ module.life_aggregates_service_rebuilder.deployment_alias_arn }",
            "InputPath": "$",
            "ResultPath": "$",
            "Retry": [
              {
                "ErrorEquals": [ "States.TaskFailed" ],
                "IntervalSeconds": 2,
                "MaxAttempts": 6,
                "BackoffRate": 4.0
              }
            ],
            "Next": "IsDone"
          },
          "IsDone": {
            "Type": "Choice",
            "Choices": [
              {
                "Variable": "$.nextToken",
                "StringEquals": "",
                "Next": "Done"
              }
            ],
            "Default": "Scan"
          },
          "Done": {
            "Type": "Pass",
            "End": true
          }
        }
      },
      "End": true
    }
  }
}
EOF
}
  1. terraform apply

  2. Modify aws_sfn_state_machine Definition. Specifically, I changed these lines:

"Result": [
          {"segment": 0, "totalSegments": 2, "rebuildType": "total"},
          {"segment": 1, "totalSegments": 2, "rebuildType": "total"}
      ],

To these:

          {"segment": 0, "totalSegments": 3, "rebuildType": "total"},
          {"segment": 1, "totalSegments": 3, "rebuildType": "total"},
          {"segment": 2, "totalSegments": 3, "rebuildType": "total"}
      ],

When I ran the state machine (right after I was expecting it to update), individual lambdas received totalSegments of 2

@ghost ghost added the service/sfn Issues and PRs that pertain to the sfn service. label Mar 23, 2020
bflad pushed a commit that referenced this issue Jul 1, 2020
…on creation + wait for delete + add `arn` attribute (#12005)

Output from acceptance testing (unrelated consistent test failure due to #12506):

```
--- PASS: TestAccAWSSfnStateMachine_tags (55.38s)
--- FAIL: TestAccAWSSfnStateMachine_createUpdate (61.93s)
--- PASS: TestAccAWSSfnStateMachine_disappears (67.31s)
```
@bafish
Copy link

bafish commented Feb 25, 2021

Has this been fixed? I still have the same situation.

Terraform Version
v0.14.5

Affected Resource(s)
aws_sfn_state_machine

@IevgenRagulin
Copy link
Author

I don't think it has been fixed. Whenever I change state machine definition, I also change the terraform resource name to force terraform to recreate the machine (which isn't ideal obviously)

@ewbankkit
Copy link
Contributor

From the AWS API Reference:

Screen Shot 2021-05-05 at 12 45 06 PM

so the read after update will not necessarily reflect changes immediately.

@ghost
Copy link

ghost commented May 7, 2021

This has been released in version 3.39.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@github-actions
Copy link

github-actions bot commented Jun 6, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/sfn Issues and PRs that pertain to the sfn service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants