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.6k stars 4.65k forks source link

Terraform CRASH on AzureRM! Help Needed #14894

Closed mark88d closed 2 years ago

mark88d commented 2 years ago

Community Note

Terraform (and AzureRM Provider) Version

**terraform -v Terraform v1.1.3 on windows_amd64

Affected Resource(s)

Terraform Configuration Files


resource "azurerm_spring_cloud_service" "eventscloud" {
  name                = "${var.resource_prefix}-spring-01"
  resource_group_name = azurerm_resource_group.rg.name
  location            = var.location
  sku_name            = "S0" # B0 for testing this will need changing later S0 will need network config

  config_server_git_setting {
    uri          = "https://dev.azure.com/#####/Integration/_git/##-config"
    label        = "develop"
    search_paths = ["dev"]
    http_basic_auth {
      username = "##.##@##.##"
      password = var.sensitive
    }
    #search_paths = ["dir1", "dir2"]
    repository {
      label   = "Test_Prep"
      name    = "Test_Prep"
      pattern = ["Test_Prep"]
      uri     = "https://dev.azure.com/#####/Integration/_git/##-config"

      http_basic_auth {
        username = "##.##@##.##"
        password = var.sensitive
      }
    }
  }

  network {
    app_subnet_id             = azurerm_subnet.snet2.id
    service_runtime_subnet_id = azurerm_subnet.snet1.id
    cidr_ranges               = ["172.31.0.0/16", "172.32.0.0/16", "172.33.0.1/16"]
  }

  trace {
    instrumentation_key = azurerm_application_insights.app_insights.instrumentation_key
  }

  tags = var.default_tags_dev
}

retrieve additional subnet details to allow elastic to access event hub


data "azurerm_subnet" "aks_subnet" {
  name                 = "abl-nonprod-AKS-pool1-sn"
  resource_group_name  = "abl-nonprod-AKS-rg"
  virtual_network_name = "abl-nonprod-AKS-vnet"
}

#create event hub for Elastic processing of events
resource "azurerm_eventhub_namespace" "main" {
  name                     = "${var.resource_prefix}-springcloud-main"
  resource_group_name      = azurerm_resource_group.rg.name
  location                 = var.location
  sku                      = "Standard"
  capacity                 = 1
  auto_inflate_enabled     = true
  maximum_throughput_units = 4
  zone_redundant           = true

network_rulesets = [{
    default_action                 = "Deny"
    trusted_service_access_enabled = true
    ip_rule = [{
      action  = "Allow"
      ip_mask = var.sq_fw_rules.Eldon1.StartIP
      }
  ]
virtual_network_rule = [{
      ignore_missing_virtual_network_service_endpoint = true
      subnet_id                                       = azurerm_subnet.snet1.id
      }
]

resource "azurerm_key_vault_access_policy" "terraform_cloud_policy" {
  key_vault_id = azurerm_key_vault.aks_kv.id
  tenant_id    = data.azurerm_client_config.current.tenant_id
  object_id    = data.azurerm_client_config.current.object_id

  key_permissions = [
    "backup", "create", "decrypt", "delete", "encrypt", "get", "import", "list", "purge", "recover", "restore", "sign", "unwrapKey", "update", "verify", "wrapKey"
  ]

  secret_permissions = [
    "backup", "delete", "get", "list", "purge", "recover", "restore", "set"
  ]

  certificate_permissions = [
    "backup", "create", "delete", "deleteissuers", "get", "getissuers", "import", "list", "listissuers", "managecontacts", "manageissuers", "purge", "recover", "restore", "setissuers", "update"
  ]
}

Debug Output

Panic Output

Expected Behaviour

a Successful plan or apply

Actual Behaviour

2022-01-11T08:58:30.560Z [DEBUG] plugin: plugin exited

Error: rpc error: code = Canceled desc = context canceled

Error: rpc error: code = Canceled desc = context canceled

Error: rpc error: code = Canceled desc = context canceled

Error: rpc error: code = Canceled desc = context canceled

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

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

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

Error: rpc error: code = Canceled desc = context canceled

Error: rpc error: code = Canceled desc = context canceled

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

Terraform crashed! This is always indicative of a bug within Terraform. A crash log has been placed at "crash.log" relative to your current working directory. It would be immensely helpful if you could please

When reporting bugs, please include your terraform version. That information is available on the first line of crash.log. You can also get it by running 'terraform --version' on the command line.

SECURITY WARNING: the "crash.log" file that was created may contain sensitive information that must be redacted before it is safe to share on the issue tracker.

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

Steps to Reproduce

  1. terraform plan local or remote on the terraform workspace

Important Factoids

References

crash_terraforml.zip

tombuildsstuff commented 2 years ago

Stack trace:

2022-01-10T16:13:02.042Z [DEBUG] provider.terraform-provider-azurerm_v2.90.0_x5.exe: panic: runtime error: index out of range [1] with length 1
2022-01-10T16:13:02.042Z [DEBUG] provider.terraform-provider-azurerm_v2.90.0_x5.exe: 
2022-01-10T16:13:02.042Z [DEBUG] provider.terraform-provider-azurerm_v2.90.0_x5.exe: goroutine 1359 [running]:
2022-01-10T16:13:02.042Z [DEBUG] provider.terraform-provider-azurerm_v2.90.0_x5.exe: github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud.flattenSpringCloudGitPatternRepository(0xc00188e348, 0xc0018ea960)
2022-01-10T16:13:02.042Z [DEBUG] provider.terraform-provider-azurerm_v2.90.0_x5.exe:    /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_service_resource.go:788 +0xed9
2022-01-10T16:13:02.042Z [DEBUG] provider.terraform-provider-azurerm_v2.90.0_x5.exe: github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud.flattenSpringCloudConfigServerGitProperty(0xc00171a700, 0x61b56e5)
2022-01-10T16:13:02.042Z [DEBUG] provider.terraform-provider-azurerm_v2.90.0_x5.exe:    /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_service_resource.go:766 +0xa8f
2022-01-10T16:13:02.042Z [DEBUG] provider.terraform-provider-azurerm_v2.90.0_x5.exe: github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud.resourceSpringCloudServiceRead(0xc00171a700, {0x58e46c0, 0xc001969c00})
2022-01-10T16:13:02.042Z [DEBUG] provider.terraform-provider-azurerm_v2.90.0_x5.exe:    /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_service_resource.go:454 +0x97a
2022-01-10T16:13:02.042Z [DEBUG] provider.terraform-provider-azurerm_v2.90.0_x5.exe: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x61b071a, {0x68b5c78, 0xc00111e240}, 0x24, {0x58e46c0, 0xc001969c00})
2022-01-10T16:13:02.042Z [DEBUG] provider.terraform-provider-azurerm_v2.90.0_x5.exe:    /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource.go:346 +0x178
2022-01-10T16:13:02.042Z [DEBUG] provider.terraform-provider-azurerm_v2.90.0_x5.exe: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc0000141c0, {0x68b5c78, 0xc00111e240}, 0xc001967380, {0x58e46c0, 0xc001969c00})
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.