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

Fix Terminated Workspace Panic #16692

Merged
merged 4 commits into from
Dec 15, 2020
Merged

Conversation

Tensho
Copy link
Contributor

@Tensho Tensho commented Dec 10, 2020

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #16654

Relates to #15945

Follow up to #15705

Release note for CHANGELOG:

aws_workspaces_workspace: Fix panic when describe workspaces action returns empty output 

Acceptance Test

$ make testacc TEST=./aws TESTARGS='-run=TestAccAwsWorkspacesWorkspace_recreate'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAwsWorkspacesWorkspace_recreate -timeout 120m
=== RUN   TestAccAwsWorkspacesWorkspace_recreate
=== PAUSE TestAccAwsWorkspacesWorkspace_recreate
=== CONT  TestAccAwsWorkspacesWorkspace_recreate
--- PASS: TestAccAwsWorkspacesWorkspace_recreate (1142.43s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	1145.364s

Improvements

  • Add tags to all acc test workspace resources

@ghost ghost added size/M Managed by automation to categorize the size of a PR. service/workspaces Issues and PRs that pertain to the workspaces service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Dec 10, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Dec 10, 2020
@Tensho Tensho changed the title Fix workspace panic Fix Terminated Workspace Panic Dec 10, 2020
@Tensho Tensho marked this pull request as ready for review December 10, 2020 18:42
@Tensho Tensho requested a review from a team as a code owner December 10, 2020 18:42
@@ -34,7 +34,7 @@ func WorkspaceState(conn *workspaces.WorkSpaces, workspaceID string) resource.St
}

if len(output.Workspaces) == 0 {
return nil, "", nil
return output, workspaces.WorkspaceStateTerminated, nil
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We consider an empty list in output as a real workspace termination sign. The workspaces.WorkspaceStateTerminated state is checked right after the DescriobeWorkspaces call in Read func.

@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Dec 10, 2020
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM.

@bflad bflad self-assigned this Dec 11, 2020
@bflad bflad added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. labels Dec 11, 2020
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Looks great, thanks @Tensho 🚀

Output from acceptance testing:

--- PASS: TestFlattenWorkspaceProperties (0.00s)
--- PASS: TestExpandWorkspaceProperties (0.00s)
--- PASS: TestAccAwsWorkspacesWorkspace_validateRootVolumeSize (3.40s)
--- PASS: TestAccAwsWorkspacesWorkspace_validateUserVolumeSize (3.96s)
--- PASS: TestAccAwsWorkspacesWorkspace_workspaceProperties_runningModeAlwaysOn (1775.72s)
--- PASS: TestAccAwsWorkspacesWorkspace_recreate (1836.44s)
--- PASS: TestAccAwsWorkspacesWorkspace_timeout (1848.37s)
--- PASS: TestAccAwsWorkspacesWorkspace_basic (1852.09s)
--- PASS: TestAccAwsWorkspacesWorkspace_tags (1876.63s)
--- PASS: TestAccAwsWorkspacesWorkspace_workspaceProperties (1899.23s)

@bflad bflad added this to the v3.22.0 milestone Dec 15, 2020
@bflad bflad merged commit 402132b into hashicorp:master Dec 15, 2020
bflad added a commit that referenced this pull request Dec 15, 2020
@Tensho Tensho deleted the fix-workspace-panic branch December 15, 2020 08:47
@ghost
Copy link

ghost commented Dec 18, 2020

This has been released in version 3.22.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!

@ghost
Copy link

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

@ghost ghost locked as resolved and limited conversation to collaborators Jan 14, 2021
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. crash Results from or addresses a Terraform crash or kernel panic. service/workspaces Issues and PRs that pertain to the workspaces service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crashing with: Error: rpc error: code = Unavailable desc = transport is closing
3 participants