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

Terraform crashed #32872

Open
1 task done
kural82 opened this issue Mar 9, 2023 · 2 comments · May be fixed by #32821
Open
1 task done

Terraform crashed #32872

kural82 opened this issue Mar 9, 2023 · 2 comments · May be fixed by #32821

Comments

@kural82
Copy link

kural82 commented Mar 9, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v1.3.9

AzureRM Provider Version

v3.46.0

Affected Resource(s)/Data Source(s)

azurerm storage account

Terraform Configuration Files

resource "azurerm_storage_container" "example" {
  name                  = "content"
  storage_account_name  = "storageaccountnametest19"
  container_access_type = "private"
}

terraform {
  backend "azurerm" {
    resource_group_name  = "example<>resources"
    storage_account_name = "storageaccountnametest19"
    container_name       = "content"
    key                  = "terraform.tfstate"
  }
}

Debug Output/Panic Output

Error releasing the state lock
│ 
│ Error message: failed to retrieve lock info: blobs.Client#GetProperties: Failure sending request: StatusCode=0 -- Original Error: Head
│ "https://storageaccountnametest19.blob.core.windows.net/content/terraform.tfstate": dial tcp: lookup storageaccountnametest19.blob.core.windows.net: no such host
│ 
│ Terraform acquires a lock when accessing your state to prevent others
│ running Terraform to potentially modify the state at the same time. An
│ error occurred while releasing this lock. This could mean that the lock
│ did or did not release properly. If the lock didn't release properly,
│ Terraform may not be able to run future commands since it'll appear as if
│ the lock is held.
│ 
│ In this scenario, please call the "force-unlock" command to unlock the
│ state manually. This is a very dangerous operation since if it is done
│ erroneously it could result in two people modifying state at the same time.
│ Only call this command if you're certain that the unlock above failed and
│ that no one else is holding a lock.


!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform.
Please report the crash with Terraform[1] so that we can fix this.

When reporting bugs, please include your terraform version, the stack trace
shown below, and any additional information which may help replicate the issue.

[1]: https://github.com/hashicorp/terraform/issues

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

runtime error: invalid memory address or nil pointer dereference
goroutine 14 [running]:
runtime/debug.Stack()
        /usr/local/go/src/runtime/debug/stack.go:24 +0x65
runtime/debug.PrintStack()
        /usr/local/go/src/runtime/debug/stack.go:16 +0x19
github.com/hashicorp/terraform/internal/logging.PanicHandler()
        /Users/distiller/project/project/internal/logging/panic.go:55 +0x153
panic({0x2e445e0, 0x4a4c010})
        /usr/local/go/src/runtime/panic.go:884 +0x212
github.com/hashicorp/terraform/internal/backend/remote-state/azure.(*RemoteClient).Put(0xc0002242d0, {0xc00064f980, 0x1859, 0x1980})
        /Users/distiller/project/project/internal/backend/remote-state/azure/client.go:88 +0x583
github.com/hashicorp/terraform/internal/states/remote.(*State).PersistState(0xc000a09260, 0x3072d00?)
        /Users/distiller/project/project/internal/states/remote/state.go:202 +0x5c5
github.com/hashicorp/terraform/internal/states/statemgr.WriteAndPersist({0x2dd6d4c0, 0xc000a09260}, 0x2?, 0xc00034de90?)
        /Users/distiller/project/project/internal/states/statemgr/helper.go:53 +0x53
github.com/hashicorp/terraform/internal/backend/local.(*Local).opApply(0x0?, {0x3777278, 0xc000725940}, {0x3777278, 0xc000725980}, 0xc000217e60, 0xc000725900)
        /Users/distiller/project/project/internal/backend/local/backend_apply.go:201 +0x1075
github.com/hashicorp/terraform/internal/backend/local.(*Local).Operation.func1()
        /Users/distiller/project/project/internal/backend/local/backend.go:323 +0xc3
created by github.com/hashicorp/terraform/internal/backend/local.(*Local).Operation
        /Users/distiller/project/project/internal/backend/local/backend.go:316 +0x44a

Expected Behaviour

Just deleting the resources after running terraform destroy

Actual Behaviour

terraform crashed

Steps to Reproduce

No response

Important Factoids

No response

References

No response

@kural82 kural82 added the bug label Mar 9, 2023
@github-actions github-actions bot removed the bug label Mar 9, 2023
@sebader
Copy link

sebader commented Mar 9, 2023

The storage account that you want to use for your backend needs to exist before you run terraform. TF itself cannot create that storage account

storageaccountnametest19.blob.core.windows.net: no such host

@lonegunmanb
Copy link

lonegunmanb commented Mar 10, 2023

Hi @kural82, thanks for reporting this crash, according to the dump stack:

github.com/hashicorp/terraform/internal/backend/remote-state/azure.(*RemoteClient).Put(0xc0002242d0, {0xc00064f980, 0x1859, 0x1980})
/Users/distiller/project/project/internal/backend/remote-state/azure/client.go:88 +0x583

The code that crashed Terraform is in Terraform core

I'd like to submit a pr to fix this issue, would you please copy this issue to Terraform repo and close this one so I can reference your pr at Terraform repo? Thanks!


I've opened a pr to fix this issue, please ping me there once you've opened a new issue there, thanks @kural82!

@lonegunmanb lonegunmanb linked a pull request Mar 10, 2023 that will close this issue
@manicminer manicminer transferred this issue from hashicorp/terraform-provider-azurerm Mar 16, 2023
@manicminer manicminer linked a pull request Mar 16, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants