Azure / terraform-azurerm-avm-res-cache-redis

To gain access, please finish setting up this repository now at:
https://repos.opensource.microsoft.com/Azure/wizard?existingreponame=terraform-azurerm-avm-res-cache-redis&existingrepoid=782691093
MIT License
0 stars 6 forks source link

[AVM Module Issue]: Fails when no terraform changes and no identity defined #54

Open christerengman opened 6 days ago

christerengman commented 6 days ago

Check for previous/existing GitHub issues

Issue Type?

Bug

(Optional) Module Version

0.1.5

(Optional) Correlation Id

No response

Description

Minimal terraform config (for me tag configuration was required to achieve desired state as we have implemented tag inheritance using policies, but I guess you could skip that if that's not the case):

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

provider "azurerm" {
  features {}
}

locals {
  location = "swedencentral"
}

data "azurerm_subscription" "current" {}

module "naming" {
  source  = "Azure/naming/azurerm"
  version = "~> 0.4"
}

resource "azurerm_resource_group" "main" {
  location = local.location
  name     = module.naming.resource_group.name_unique

  tags = data.azurerm_subscription.current.tags
}

module "redis" {
  source  = "Azure/avm-res-cache-redis/azurerm"
  version = "~> 0.1"

  location            = azurerm_resource_group.main.location
  name                = module.naming.redis_cache.name_unique
  resource_group_name = azurerm_resource_group.main.name

  capacity         = 0
  enable_telemetry = false
  sku_name         = "Basic"
  tags             = azurerm_resource_group.main.tags
  zones            = null
}

terraform apply, first run: Success

`terraform applyplResult, second run: ╷ │ Error: Unsupported attribute │ │ on .terraform\modules\redis\outputs.tf line 25, in output "system_assigned_mi_principal_id": │ 25: value = jsondecode(data.azapi_resource.this.output).identity.principalId │ ├──────────────── │ │ data.azapi_resource.this.output is "{\"id\":\"/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/rg-g6lz/providers/Microsoft.Cache/Redis/redis-xxxx\",\"location\":\"Sweden Central\",\"name\":\"redis-xxxx\",\"properties\":{\"accessKeys\":null,\"enableNonSslPort\":false,\"hostName\":\"redis-g6lz.redis.cache.windows.net\",\"instances\":[{\"isMaster\":true,\"isPrimary\":true,\"sslPort\":15000}],\"linkedServers\":[],\"minimumTlsVersion\":\"1.2\",\"port\":6379,\"provisioningState\":\"Succeeded\",\"publicNetworkAccess\":\"Enabled\",\"redisConfiguration\":{\"maxclients\":\"256\",\"maxfragmentationmemory-reserved\":\"30\",\"maxmemory-delta\":\"30\",\"maxmemory-policy\":\"volatile-lru\",\"maxmemory-reserved\":\"30\",\"preferred-data-persistence-auth-method\":\"SAS\"},\"redisVersion\":\"6.0\",\"sku\":{\"capacity\":0,\"family\":\"C\",\"name\":\"Basic\"},\"sslPort\":6380,\"updateChannel\":\"Stable\"},\"tags\":{\"myTag\":\"myValue\"},\"type\":\"Microsoft.Cache/Redis\"}" │ │ This object does not have an attribute named "identity". ╵

I guess output.tf should not expect identity to be configured as it's optional.

microsoft-github-policy-service[bot] commented 1 day ago

[!WARNING] Tagging the AVM Core Team (@Azure/avm-core-team-technical-terraform) due to a module owner or contributor having not responded to this issue within 3 business days. The AVM Core Team will attempt to contact the module owners/contributors directly.

[!TIP]

  • To prevent further actions to take effect, the "Status: Response Overdue 🚩" label must be removed, once this issue has been responded to.
  • To avoid this rule being (re)triggered, the ""Needs: Triage :mag:" label must be removed as part of the triage process (when the issue is first responded to)!