diff --git a/api_management_api/README.md b/api_management_api/README.md index 1b4a64ac..1f0595ad 100644 --- a/api_management_api/README.md +++ b/api_management_api/README.md @@ -99,6 +99,7 @@ No modules. | [revision](#input\_revision) | n/a | `string` | `"1"` | no | | [revision\_description](#input\_revision\_description) | n/a | `string` | `null` | no | | [service\_url](#input\_service\_url) | n/a | `string` | n/a | yes | +| [subscription\_key\_names](#input\_subscription\_key\_names) | Override the default name of the header and query string containing the subscription key header |
object({| `null` | no | | [subscription\_required](#input\_subscription\_required) | Should this API require a subscription key? | `bool` | `false` | no | | [version\_set\_id](#input\_version\_set\_id) | The ID of the Version Set which this API is associated with. | `string` | `null` | no | | [xml\_content](#input\_xml\_content) | The XML Content for this Policy as a string | `string` | `null` | no | diff --git a/api_management_api/main.tf b/api_management_api/main.tf index 56c0f68f..ce4b66ac 100644 --- a/api_management_api/main.tf +++ b/api_management_api/main.tf @@ -27,6 +27,13 @@ resource "azurerm_api_management_api" "this" { content_value = var.content_value } + dynamic "subscription_key_parameter_names" { + for_each = var.subscription_key_names == null ? [] : ["dummy"] + content { + header = var.subscription_key_names.header + query = var.subscription_key_names.query + } + } } resource "azurerm_api_management_api_policy" "this" { diff --git a/api_management_api/variables.tf b/api_management_api/variables.tf index 5fcdf9c3..ae154a89 100644 --- a/api_management_api/variables.tf +++ b/api_management_api/variables.tf @@ -105,3 +105,12 @@ variable "version_set_id" { description = "The ID of the Version Set which this API is associated with." default = null } + +variable "subscription_key_names" { + type = object({ + header = string + query = string + }) + description = "Override the default name of the header and query string containing the subscription key header" + default = null +}
header = string
query = string
})