gettek / terraform-azurerm-policy-as-code

Terraform modules that simplify the workflow of custom and built-in Azure Policies

Home Page:https://learn.microsoft.com/en-us/azure/governance/policy/concepts/policy-as-code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example Built-In Policy Initiative Assignment fails

thecomalley opened this issue · comments

Issue Template

I'm getting the below issue when running the example: Built-In Policy Initiative Assignment

Prerequisites

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Context

  • Module Version: 2.6.1
  • Terraform Version: v1.2.9
  • AzureRM Provider Version: v3.21.1
data "azurerm_policy_set_definition" "cis_1_3_0" {
  display_name = "CIS Microsoft Azure Foundations Benchmark v1.3.0"
}

module org_mg_cis_1_3_0_benchmark {
  source           = "gettek/policy-as-code/azurerm//modules/set_assignment"
  initiative       = data.azurerm_policy_set_definition.cis_1_3_0
  assignment_scope = var.management_group_ids.core

  assignment_parameters = {
    "effect-b954148f-4c11-4c38-8221-be76711e194a-MicrosoftSql-servers-firewallRules-delete" = "Disabled"
  }
}

Expected Behavior

Successful terraform plan

Current Behavior

Possible Solution

Failure Information (for bugs)

│ Error: Error in function call

│   on .terraform/modules/org_mg_cis_1_3_0_benchmark/modules/set_assignment/variables.tf line 144, in locals:
│  144:   role_definition_ids = var.skip_role_assignment == false ? coalescelist(var.role_definition_ids, try(var.initiative.role_definition_ids, [])) : []
│     ├────────────────
│     │ var.initiative is object with 12 attributes
│     │ var.role_definition_ids is empty list of string

│ Call to function "coalescelist" failed: no non-null arguments.

Steps to Reproduce

Failure Logs