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

SIGSEGV with azurerm_storage_account creation when empty share_properties block is provided. #19220

Closed
1 task done
awangptc opened this issue Nov 9, 2022 · 3 comments · Fixed by #19298
Closed
1 task done

Comments

@awangptc
Copy link

awangptc commented Nov 9, 2022

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

1.3.4

AzureRM Provider Version

3.30.0

Affected Resource(s)/Data Source(s)

azurerm_storage_account

Terraform Configuration Files

terraform {
  required_version = ">= 1.3.0"

  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "~> 3.0"
    }
  }
}

provider "azurerm" {
  features {}
}

resource "azurerm_storage_account" "myaccount" {
  resource_group_name      = var.rgName
  name                     = var.name
  location                 = "westus2"
  account_tier             = "Standard"
  account_replication_type = "LRS"
  account_kind             = "StorageV2"

  share_properties {
  }
}

variable "rgName" {
  default = "awang"
} 

variable "name" {
  default = "awangtestshare"
}

Debug Output/Panic Output

azurerm_storage_account.myaccount: Creating...
azurerm_storage_account.myaccount: Still creating... [10s elapsed]
azurerm_storage_account.myaccount: Still creating... [20s elapsed]
azurerm_storage_account.myaccount: Still creating... [30s elapsed]
╷
│ Error: Request cancelled
│ 
│   with azurerm_storage_account.myaccount,
│   on main.tf line 16, in resource "azurerm_storage_account" "myaccount":
│   16: resource "azurerm_storage_account" "myaccount" {
│ 
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

Stack trace from the terraform-provider-azurerm_v3.30.0_x5 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x106b7428c]

goroutine 136 [running]:
github.com/hashicorp/terraform-provider-azurerm/internal/services/storage.resourceStorageAccountCreate(0x140015b8f78?, {0x107944ca0?, 0x14000754800})
	github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_account_resource.go:1317 +0x306c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x108381240?, {0x108381240?, 0x14000be1b90?}, 0xd?, {0x107944ca0?, 0x14000754800?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:695 +0x138
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x14001679960, {0x108381240, 0x14000be1b90}, 0x1400194b790, 0x14000ebdd00, {0x107944ca0, 0x14000754800})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:837 +0x874
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x14000788900, {0x108381240?, 0x14000be1ad0?}, 0x1400224b2c0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1021 +0xb94
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x14000ab7860, {0x108381240?, 0x14000be1380?}, 0x14001948150)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:813 +0x370
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x107f8ef20?, 0x14000ab7860}, {0x108381240, 0x14000be1380}, 0x140015ae960, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x174
google.golang.org/grpc.(*Server).processUnaryRPC(0x14000138a80, {0x1083934d8, 0x14000bd4680}, 0x140019386c0, 0x140017d8120, 0x10c4e7400, 0x0)
	google.golang.org/[email protected]/server.go:1283 +0xb64
google.golang.org/grpc.(*Server).handleStream(0x14000138a80, {0x1083934d8, 0x14000bd4680}, 0x140019386c0, 0x0)
	google.golang.org/[email protected]/server.go:1620 +0x840
google.golang.org/grpc.(*Server).serveStreams.func1.2()
	google.golang.org/[email protected]/server.go:922 +0x88
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/[email protected]/server.go:920 +0x298

Error: The terraform-provider-azurerm_v3.30.0_x5 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Expected Behaviour

shoudl work or error out gracefully

Actual Behaviour

SIGSEGV

Steps to Reproduce

use terraform apply against the provided main.tf.

The culprit is this block

  share_properties {
  }

If i remove it it's fine. That's a reasonable solution but I wanted to report this bug as a SIGSEGV crash is not ideal error handling.

Important Factoids

No response

References

No response

@WodansSon
Copy link
Collaborator

WodansSon commented Nov 9, 2022

@awangptc, thank your for opening this issue. The bug is with the expandShareProperties function, if you pass an empty share_properties code block the expand returns an uninitialized storage.FileServiceProperties object and since it is uninitialized when the code attempts to access the expected values within that object it throws a nil pointer dereference error.

@github-actions
Copy link

This functionality has been released in v3.33.0 of the Terraform 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. Thank you!

@github-actions
Copy link

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 Dec 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants