hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.61k stars 4.65k forks source link

`azurerm_data_factory_dataset_delimited_text` Panic due to the lack of `azure_blob_storage_location.dynamic_container_enabled` #16525

Closed lonegunmanb closed 2 years ago

lonegunmanb commented 2 years ago

Is there an existing issue for this?

Community Note

Terraform Version

1.1.8

AzureRM Provider Version

3.3.0

Affected Resource(s)/Data Source(s)

azurerm_data_factory_dataset_delimited_text

Terraform Configuration Files

provider azurerm {
  features {}
}

resource azurerm_resource_group example {
  name     = "zjhef13545"
  location = "uksouth"
}

resource azurerm_storage_account example {
  name                      = "zjhef13545"
  resource_group_name       = azurerm_resource_group.example.name
  location                  = azurerm_resource_group.example.location
  account_kind              = "StorageV2"
  account_tier              = "Standard"
  account_replication_type  = "GRS"
  enable_https_traffic_only = true
}

resource azurerm_storage_container example {
  name                  = "zjhef13545"
  storage_account_name  = azurerm_storage_account.example.name
  container_access_type = "private"
}

resource azurerm_data_factory example {
  name                = "zjhef13545"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
}

data "azurerm_client_config" "current" {
}

resource "azurerm_key_vault" "example" {
  name                = "zjhef13545"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  tenant_id           = data.azurerm_client_config.current.tenant_id
  sku_name            = "standard"
}

resource "azurerm_data_factory_linked_service_key_vault" "example" {
  name            = "zjhef135452"
  data_factory_id = azurerm_data_factory.example.id
  key_vault_id    = azurerm_key_vault.example.id
}

resource "azurerm_data_factory_linked_service_azure_blob_storage" "example" {
  name            = "zjhef13545"
  data_factory_id = azurerm_data_factory.example.id

  service_endpoint     = "https://storageaccountname.blob.core.windows.net"
  service_principal_id = "00000000-0000-0000-0000-000000000000"
  tenant_id            = "00000000-0000-0000-0000-000000000000"
  service_principal_linked_key_vault_key {
    linked_service_name = azurerm_data_factory_linked_service_key_vault.example.name
    secret_name         = "secret"
  }
}

resource azurerm_data_factory_dataset_delimited_text example {
  name                = "zjhef13545"
  data_factory_id     = azurerm_data_factory.example.id
  linked_service_name = azurerm_data_factory_linked_service_azure_blob_storage.example.name
  parameters          = {
    "subfolder" = "" # Map value sets parameter default value
  }

  first_row_as_header = true

  schema_column {
    name = "example"
    type = "String"
  }

  azure_blob_storage_location {
    container            = azurerm_storage_container.example.name
    path                 = "@dataset().subfolder"
    dynamic_path_enabled = true
  }
}

Debug Output/Panic Output

Error: Plugin did not respond
│
│   with azurerm_data_factory_dataset_delimited_text.example,
│   on main.tf line 63, in resource "azurerm_data_factory_dataset_delimited_text" "example":
│   63: resource azurerm_data_factory_dataset_delimited_text example {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more       
│ details.
╵

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

panic: interface conversion: interface {} is nil, not bool

goroutine 484 [running]:
github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory.expandDataFactoryDatasetAzureBlobStorageLocation(0xc0010775e0?)
        github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory.go:408 +0x5b4
github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory.expandDataFactoryDatasetLocation(0x6b26980?)
        github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory.go:354 +0xc9
github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory.resourceDataFactoryDatasetDelimitedTextCreateUpdate(0xc001cd7480, {0x5afd1
e0?, 0xc00058e700})
        github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_dataset_delimited_text_resource.go:331 +0x4e5        
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc000ee4bd0?, {0x6b34228?, 0xc00209d840?}, 0x2?, {0x5afd1e0?, 0xc00058e70
0?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/resource.go:329 +0x178
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000884460, {0x6b34228, 0xc00209d840}, 0xc0020b3d40, 0xc001cd7300, {0x5af
d1e0, 0xc00058e700})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/resource.go:467 +0x6f1
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0000050f8, {0x6b34228, 0xc00209d840}, 0xc001eb78
10)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/grpc_provider.go:977 +0xd8a
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc0001b9300, {0x6b342d0?, 0xc001b347e0?}, 0xc0015b5810)     
        github.com/hashicorp/terraform-plugin-go@v0.5.0/tfprotov5/tf5server/server.go:603 +0x2ad
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x604e0c0?, 0xc0001b9300}, {0x6b342d0, 0xc0
01b347e0}, 0xc00062be00, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.5.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000216e00, {0x6b452e0, 0xc000438d80}, 0xc00136e000, 0xc001456db0, 0xa972400, 0x0)
        google.golang.org/grpc@v1.39.0/server.go:1292 +0xc6f
google.golang.org/grpc.(*Server).handleStream(0xc000216e00, {0x6b452e0, 0xc000438d80}, 0xc00136e000, 0x0)
        google.golang.org/grpc@v1.39.0/server.go:1617 +0xa1b
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/grpc@v1.39.0/server.go:940 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.39.0/server.go:938 +0x28a

Error: The terraform-provider-azurerm_v3.3.0_x5.exe 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

No response

Actual Behaviour

Plugin panic and crashed.

Steps to Reproduce

No response

Important Factoids

No response

References

In pr #15749 the dynamic_container_enabled has been added into the azure_blob_storage_location's process logic, but no schema definition. I'll submit a pr to fix this issue.

github-actions[bot] commented 2 years ago

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.