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

resource/aws_sfn_state_machine: Handle another NotFound exception type #1062

Merged
merged 1 commit into from
Jul 5, 2017

Conversation

stack72
Copy link
Contributor

@stack72 stack72 commented Jul 5, 2017

Fixes: #1058

Before this:

% terraform refresh
aws_iam_role.iam_for_lambda: Refreshing state... (ID: iam_for_lambda_stack72)
data.aws_region.current: Refreshing state...
aws_lambda_function.lambda_function_test: Refreshing state... (ID: sfn-stack72)
aws_iam_role_policy.iam_policy_for_lambda: Refreshing state... (ID: iam_for_lambda_stack72:iam_policy_for_lambda_stack72)
aws_iam_role.iam_for_sfn: Refreshing state... (ID: iam_for_sfn_stack72)
aws_iam_role_policy.iam_policy_for_sfn: Refreshing state... (ID: iam_for_sfn_stack72:iam_policy_for_sfn_stack72)
aws_sfn_state_machine.foo: Refreshing state... (ID: arn:aws:states:us-west-2:187416307283:stateMachine:test_sfn_stack72)
Error refreshing state: 1 error(s) occurred:

* aws_sfn_state_machine.foo: 1 error(s) occurred:

* aws_sfn_state_machine.foo: aws_sfn_state_machine.foo: StateMachineDoesNotExist: State Machine Does Not Exist: 'arn:aws:states:us-west-2:187416307283:stateMachine:test_sfn_stack72'
	status code: 400, request id: 6f749392-6178-11e7-80a1-1db62a3892e8

After this:

% terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

aws_iam_role.iam_for_lambda: Refreshing state... (ID: iam_for_lambda_stack72)
data.aws_region.current: Refreshing state...
aws_iam_role_policy.iam_policy_for_lambda: Refreshing state... (ID: iam_for_lambda_stack72:iam_policy_for_lambda_stack72)
aws_lambda_function.lambda_function_test: Refreshing state... (ID: sfn-stack72)
aws_iam_role.iam_for_sfn: Refreshing state... (ID: iam_for_sfn_stack72)
aws_iam_role_policy.iam_policy_for_sfn: Refreshing state... (ID: iam_for_sfn_stack72:iam_policy_for_sfn_stack72)
The Terraform execution plan has been generated and is shown below.
Resources are shown in alphabetical order for quick scanning. Green resources
will be created (or destroyed and then created if an existing resource
exists), yellow resources are being changed in-place, and red resources
will be destroyed. Cyan entries are data sources to be read.

Note: You didn't specify an "-out" parameter to save this plan, so when
"apply" is called, Terraform can't guarantee this is what will execute.

+ aws_sfn_state_machine.foo
    creation_date: "<computed>"
    definition:    "{\n  \"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",\n  \"StartAt\": \"HelloWorld\",\n  \"States\": {\n    \"HelloWorld\": {\n      \"Type\": \"Task\",\n      \"Resource\": \"arn:aws:lambda:us-west-2:187416307283:function:sfn-stack72\",\n      \"End\": true\n    }\n  }\n}\n"
    name:          "test_sfn_stack72"
    role_arn:      "arn:aws:iam::187416307283:role/iam_for_sfn_stack72"
    status:        "<computed>"

Fixes: #1058

Before this:

```
% terraform refresh
aws_iam_role.iam_for_lambda: Refreshing state... (ID: iam_for_lambda_stack72)
data.aws_region.current: Refreshing state...
aws_lambda_function.lambda_function_test: Refreshing state... (ID: sfn-stack72)
aws_iam_role_policy.iam_policy_for_lambda: Refreshing state... (ID: iam_for_lambda_stack72:iam_policy_for_lambda_stack72)
aws_iam_role.iam_for_sfn: Refreshing state... (ID: iam_for_sfn_stack72)
aws_iam_role_policy.iam_policy_for_sfn: Refreshing state... (ID: iam_for_sfn_stack72:iam_policy_for_sfn_stack72)
aws_sfn_state_machine.foo: Refreshing state... (ID: arn:aws:states:us-west-2:187416307283:stateMachine:test_sfn_stack72)
Error refreshing state: 1 error(s) occurred:

* aws_sfn_state_machine.foo: 1 error(s) occurred:

* aws_sfn_state_machine.foo: aws_sfn_state_machine.foo: StateMachineDoesNotExist: State Machine Does Not Exist: 'arn:aws:states:us-west-2:187416307283:stateMachine:test_sfn_stack72'
	status code: 400, request id: 6f749392-6178-11e7-80a1-1db62a3892e8
```

After this:

```
% terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

aws_iam_role.iam_for_lambda: Refreshing state... (ID: iam_for_lambda_stack72)
data.aws_region.current: Refreshing state...
aws_iam_role_policy.iam_policy_for_lambda: Refreshing state... (ID: iam_for_lambda_stack72:iam_policy_for_lambda_stack72)
aws_lambda_function.lambda_function_test: Refreshing state... (ID: sfn-stack72)
aws_iam_role.iam_for_sfn: Refreshing state... (ID: iam_for_sfn_stack72)
aws_iam_role_policy.iam_policy_for_sfn: Refreshing state... (ID: iam_for_sfn_stack72:iam_policy_for_sfn_stack72)
The Terraform execution plan has been generated and is shown below.
Resources are shown in alphabetical order for quick scanning. Green resources
will be created (or destroyed and then created if an existing resource
exists), yellow resources are being changed in-place, and red resources
will be destroyed. Cyan entries are data sources to be read.

Note: You didn't specify an "-out" parameter to save this plan, so when
"apply" is called, Terraform can't guarantee this is what will execute.

+ aws_sfn_state_machine.foo
    creation_date: "<computed>"
    definition:    "{\n  \"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Function\",\n  \"StartAt\": \"HelloWorld\",\n  \"States\": {\n    \"HelloWorld\": {\n      \"Type\": \"Task\",\n      \"Resource\": \"arn:aws:lambda:us-west-2:187416307283:function:sfn-stack72\",\n      \"End\": true\n    }\n  }\n}\n"
    name:          "test_sfn_stack72"
    role_arn:      "arn:aws:iam::187416307283:role/iam_for_sfn_stack72"
    status:        "<computed>"
```
@stack72 stack72 added the bug Addresses a defect in current functionality. label Jul 5, 2017
@stack72 stack72 requested a review from Ninir July 5, 2017 12:35
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, although I have a feeling the first error code was just a copy-paste error from an initial PR for the resource as it's not documented anywhere: http://docs.aws.amazon.com/step-functions/latest/apireference/API_DescribeStateMachine.html

cc @Ninir

@stack72
Copy link
Contributor Author

stack72 commented Jul 5, 2017

@radeksimko i will follow up with @Ninir for the new release :)

@stack72 stack72 merged commit fdae9ea into master Jul 5, 2017
@stack72 stack72 deleted the b-aws-sfn-statemachine-delete-1058 branch July 5, 2017 13:25
@ghost
Copy link

ghost commented Apr 11, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terraform not creating manually deleted state machine
2 participants