Azure / terraform-azurerm-avm-res-search-searchservice

MIT License
1 stars 2 forks source link

[AVM Module Issue]: Optional manged_identities property is required #33

Closed eamreyes closed 3 weeks ago

eamreyes commented 3 weeks ago

Check for previous/existing GitHub issues

Issue Type?

Bug

(Optional) Module Version

0.1.1

(Optional) Correlation Id

No response

Description

I'm consuming the search service module and I'm getting an error when managed_identities is not assigned a value.

module "avm-res-search-searchservice" {
  source                        = "Azure/avm-res-search-searchservice/azurerm"
  version                       = "0.1.1"
  name                          = module.naming_ds.search_service.name_unique
  resource_group_name           = azurerm_resource_group.ds.name
  location                      = azurerm_resource_group.ds.location
  public_network_access_enabled = true
  sku                           = "basic"
  semantic_search_sku           = null
  replica_count                 = 1
  partition_count               = 1
  hosting_mode                  = "default"

  private_endpoints = {
    private_link = {
      name                          = module.naming_ds.private_endpoint.name_unique
      subnet_resource_id            = local.ai_func_subnet_id
      private_dns_zone_resource_ids = [local.cognitive_private_dns_zone_id]
      tags                          = local.tags
    }
  }
  tags = local.tags
}

The error happens when:

Plan: 2 to add, 0 to change, 1 to destroy.
╷
│ Error: Missing required argument
│
│   with module.avm-res-search-searchservice.azurerm_search_service.this,
│   on C:\Source\Neudesic\grc-demo\.azure\poc\infra\.terraform\modules\avm-res-search-searchservice\main.tf line 29, in resource "azurerm_search_service" "this":
│   29: resource "azurerm_search_service" "this" {
│
│ The argument "identity.0.type" is required, but no definition was found.
╵

ERROR: deployment failed: error deploying infrastructure: terraform plan failed: err failed running terraform plan:  (exit code: 1)
TraceID: de3beccc6c49d336131983e394bbb462

Both examples include this snippet

managed_identities = {
    system_assigned = true
  }

I'd need to refresh my memory on dynamic blocks. I'm not sure why its creating an identity block when managed_identities is empty {}

https://github.com/Azure/terraform-azurerm-avm-res-search-searchservice/blob/main/main.tf#L49

seekerofsai commented 3 weeks ago

thanks for checking. applied fix in pr https://github.com/Azure/terraform-azurerm-avm-res-search-searchservice/pull/34