0
votes

I have Terraform module for Azure API management, in azurerm_api_management resource policy attribute is required.

Value for policy attribute must be received from file:

data "local_file" "apim_global" {
  filename = "${var.ados_release_dir}/${var.apim_policy_artifact}/api-management/global.xml"
}

module "pau-apim" {
  ...
  policy = {
    xml_content = "${data.local_file.apim_global.content}"
  }
  ...

In Terraform module policy variable is defined as type of any:

variable "policy" {
  type        = any
  description = "A mapping of policy to assign to the apim."
  default     = null
}

..but it doesn't work: enter image description here

Any ideas how to fix it?

1
Can you show the definition of the azurerm_api_management.api resource in the module as well? It looks like that's where the error is coming from rather than the module variable. - ydaetskcoR

1 Answers

0
votes

I was told to use xml_content as an input instead of policy = { xml_content = ..." }

..and it did the trick