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

Crash issue #6271

Closed
ghost opened this issue Mar 26, 2020 · 3 comments
Closed

Crash issue #6271

ghost opened this issue Mar 26, 2020 · 3 comments

Comments

@ghost
Copy link

ghost commented Mar 26, 2020

This issue was originally opened by @svangeti as hashicorp/terraform#24456. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

Terraform v0.12.24
+ provider.azurerm v1.44.0

Terraform Configuration Files

main.tf


provider "azurerm"{

  version = "=1.44.0"
  features {}
 }

data "azurerm_client_config" "current" {}

resource "azurerm_resource_group" "resourceGroup" {
  name     =  "${var.environment}-${var.project}-rg"
  location = var.location
  tags  = {
          CreatedBy = "TF Deploy"
          Name = "${var.environment}-${var.project}-rg"
          Environment = var.environment
          Owner = var.owner
          Project = var.project
          Product = var.product
          ExpirationDate = timeadd(timestamp(),var.expDate)
        }
}


resource "azurerm_storage_account" "storageaccount" {
  for_each                          = var.storageaccounts

  name                              = "${var.environment}${var.project}${each.key}st"
  resource_group_name               = azurerm_resource_group.resourceGroup.name
  location                          = azurerm_resource_group.resourceGroup.location
  account_kind                      = "StorageV2"
  account_tier                      = each.value.account_tier
  account_replication_type          = each.value.replication
  access_tier                       = each.value.access_tier
  
  enable_blob_encryption    = true
  enable_file_encryption    = true
  enable_https_traffic_only = true

  dynamic "blob_properties" {
    for_each = each.value.enable_soft_delete ? [1] : []
    content {
    delete_retention_policy {
      days = each.value.soft_delete_retention
    }
    }
  }

  tags  = {
          CreatedBy = "TF Deploy"
          Name = "${var.environment}-${var.project}-${each.key}st"
          Environment = var.environment
          Owner = var.owner
          Project = var.project
          Product = var.product
          ExpirationDate = timeadd(timestamp(),var.expDate)
        }
}

resource "azurerm_advanced_threat_protection" "storageprotection" {
  for_each             =  var.storageaccounts

  target_resource_id = azurerm_storage_account.storageaccount[each.key].id
  enabled            = each.value.advanced_threat_protection
}

locals {
  storage_acct_containers = flatten([
	for sca in var.storageaccounts : [
	  for n in sca.containers : {
      "${sca.name}-${n.name}" = {
		name           = n.name
    access_type = n.access_type
		storage_acc_nm = sca.name
    queuename = sca.queuename
    #event_types = sca.event_types
    }
    }
	]
  ])
  containers = {
	for k in local.storage_acct_containers :  
    keys(k)[0] => values(k)[0]
  }
}

output "containers"{
  value =local.containers
}

resource "azurerm_storage_container" "containers" {
  for_each               = local.containers

  name                  = each.value.name
  storage_account_name  = azurerm_storage_account.storageaccount[each.value.storage_acc_nm].name
  container_access_type = each.value.access_type
}

resource "azurerm_storage_queue" "queue" {
  for_each                 = var.storageaccounts

  name                 = each.value.queuename
  storage_account_name = azurerm_storage_account.storageaccount[each.key].name
}

variables.tf

variable  "owner"  {
      type = string
      default = "azure.service.user"
    }
variable "tfversion" {
  type=string
  default  ="=1.44.0"
}
variable    "environment"  {
      type=string
      default="dev"#"__environment__"
    }
variable    "product"  {
      type=string
      default="product"#"__product__"
    }
variable    "clientName"  {
      type=string
      default="client"
    }
variable    "project"  {
      type=string
      default="client"
    }
variable    "location"  {
      type=string
      default="uksouth"
    }
variable    "expDate"  {
      type=string
      default="720h"
    }

    variable "storageaccounts" {
      type = map(object({name=string, account_tier = string, access_tier = string, replication = string,enable_soft_delete=bool,soft_delete_retention=number,advanced_threat_protection = bool,queuename=string,
      containers = list(object({name = string, access_type = string })),
      network_rules = object({ ip_rules = list(string), subnet_ids = list(string), bypass = list(string) }) }))
  default = {
    "storage1"={   
            name="storage1",
            account_tier="Standard",
            access_tier="Hot",
            replication ="GRS",
            enable_soft_delete = false,
            soft_delete_retention=31,
            advanced_threat_protection=true,
            queuename = "samplequeue",
            containers = [{name="eops",access_type = "private"},{name="bops",access_type = "private"},{name="knowledgebase",access_type = "private"},{name="hos",access_type = "private"}],
            event_types = [ "Microsoft.Storage.BlobCreated", "Microsoft.Storage.BlobDeleted" ]
            network_rules ={ip_rules=[],subnet_ids=[],bypass=[]}
        }
      "storage1" = {     
            name="storage1",
            account_tier="Standard",
            access_tier="Hot",
            replication ="GRS",
            enable_soft_delete = false,
            soft_delete_retention=31,
            advanced_threat_protection=true,
            queuename = "samplequeue",
            containers = [{name="evidential",access_type = "private"}],
            event_types = [ "Microsoft.Storage.BlobCreated", "Microsoft.Storage.BlobDeleted" ]
            network_rules ={ip_rules=[],subnet_ids=[],bypass=[]}
            }
    }
    }

Crash Output

Error: rpc error: code = Unavailable desc = transport is closing


panic: interface conversion: interface {} is nil, not map[string]interface {}
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: 
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: goroutine 25 [running]:
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/provider.expandFeatures(0xc00074d9f0, 0x1, 0x1, 0x44311a0)
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/provider/features.go:54 +0x2f4
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/provider.providerConfigure.func1(0xc0006424d0, 0x0, 0xc000a18200, 0xc0006424d0, 0x0)
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/provider/provider.go:253 +0x9ab
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Configure(0xc000967200, 0xc000adb2c0, 0x4543000, 0xc000adb110)
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/provider.go:275 +0xf6
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).Configure(0xc000160168, 0x52b83c0, 0xc000ada000, 0xc000ade040, 0xc000160168, 0xc000ada000, 0xc000bbfbd0)
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/grpc_provider.go:487 +0x2e6
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_Configure_Handler(0x48cdfa0, 0xc000160168, 0x52b83c0, 0xc000ada000, 0xc000c201e0, 0x0, 0x52b83c0, 0xc000ada000, 0xc0008ee000, 0x187)
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/tfplugin5.pb.go:3135 +0x23e
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: google.golang.org/grpc.(*Server).processUnaryRPC(0xc0002e0420, 0x530fb40, 0xc00054cc00, 0xc000168100, 0xc000a01200, 0x86a9838, 0x0, 0x0, 0x0)
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/google.golang.org/grpc/server.go:995 +0x466
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: google.golang.org/grpc.(*Server).handleStream(0xc0002e0420, 0x530fb40, 0xc00054cc00, 0xc000168100, 0x0)
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/google.golang.org/grpc/server.go:1275 +0xda6
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc0009dc000, 0xc0002e0420, 0x530fb40, 0xc00054cc00, 0xc000168100)
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/google.golang.org/grpc/server.go:710 +0x9f
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: created by google.golang.org/grpc.(*Server).serveStreams.func1
2020-03-25T12:04:27.838-0400 [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/google.golang.org/grpc/server.go:708 +0xa1
2020/03/25 12:04:27 [ERROR] <root>: eval: *terraform.EvalConfigProvider, err: rpc error: code = Unavailable desc = transport is closing
2020/03/25 12:04:27 [ERROR] <root>: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/03/25 12:04:27 [ERROR] <root>: eval: *terraform.EvalOpFilter, err: rpc error: code = Unavailable desc = transport is closing
2020/03/25 12:04:27 [ERROR] <root>: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/03/25 12:04:27 [TRACE] [walkRefresh] Exiting eval tree: provider.azurerm
2020/03/25 12:04:27 [TRACE] vertex "provider.azurerm": visit complete
2020-03-25T12:04:27.840-0400 [DEBUG] plugin: plugin process exited: path=/Users/Documents/code/infra/test/.terraform/plugins/darwin_amd64/terraform-provider-azurerm_v1.44.0_x4 pid=5566 error="exit status 2"
2020/03/25 12:04:27 [TRACE] dag/walk: upstream of "data.azurerm_client_config.current" errored, so skipping
2020/03/25 12:04:27 [TRACE] dag/walk: upstream of "provider.azurerm (close)" errored, so skipping
2020/03/25 12:04:27 [TRACE] dag/walk: upstream of "root" errored, so skipping
2020/03/25 12:04:27 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2020/03/25 12:04:27 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock
2020-03-25T12:04:27.841-0400 [DEBUG] plugin: plugin exited

Expected Behavior

The plan command should be successfull and give plan output

Actual Behavior

Crashing

Steps to Reproduce

  1. terraform init
  2. terraform plan
@tombuildsstuff
Copy link
Contributor

Duplicate of #5897

@tombuildsstuff tombuildsstuff marked this as a duplicate of #5897 Mar 26, 2020
@viresh-contino
Copy link

i have just experienced this! thanks for posting the issue!

@ghost
Copy link
Author

ghost commented Apr 26, 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. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants