Azure API Management Named Value
This page shows how to write Terraform and Azure Resource Manager for API Management Named Value and write them securely.
azurerm_api_management_named_value (Terraform)
The Named Value in API Management can be configured in Terraform with the resource name azurerm_api_management_named_value
. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_api_management_named_value" "keyvault_baseurl" {
name = "keyvault-baseurl"
resource_group_name = var.resource_group_name
api_management_name = module.apim.name
display_name = "keyvault-baseurl"
value = module.key_vault.private_uri
resource "azurerm_api_management_named_value" "basic-auth-password" {
name = "basic-auth-password"
resource_group_name = local.shared-rg
api_management_name = local.apim_name
display_name = "basic-auth-password"
value = var.basic_auth_password
resource "azurerm_api_management_named_value" "dadjoke_pagelimit" {
name = "DadJokePageLimit"
resource_group_name = local.resource_group_name
api_management_name = data.azurerm_api_management.apim.name
display_name = "DadJokePageLimit"
value = "10"
resource "azurerm_api_management_named_value" "environment" {
name = "environment"
resource_group_name = var.vnet_rg
api_management_name = module.api-mgmt.name
display_name = "environment"
value = var.env
resource "azurerm_api_management_named_value" "named_values" {
for_each = { for named_value in var.named_values : named_value["name"] => named_value }
api_management_name = azurerm_api_management.apim.name
display_name = lookup(each.value, "display_name", lookup(each.value, "name"))
name = lookup(each.value, "name")
resource_group_name = var.resource_group_name
resource "azurerm_api_management_named_value" "apim-nv" {
count = length(var.res_apim_nv_info)
name = var.res_apim_nv_info[count.index].name
display_name = var.res_apim_nv_info[count.index].display_name
value = var.res_apim_nv_info[count.index].value
resource_group_name = var.res_rg_name
resource "azurerm_api_management_named_value" "environment" {
name = "environment"
resource_group_name = local.vnet_rg
api_management_name = module.api-mgmt.name
display_name = "environment"
value = var.env
resource "azurerm_api_management_named_value" "api_mngmt_named_value" {
name = "value0"
resource_group_name = azurerm_resource_group.group.name
api_management_name = azurerm_api_management.api_mngmt.name
display_name = "name"
value = "value"
resource "azurerm_api_management_named_value" "this" {
api_management_name = var.api_management_name
display_name = var.display_name
name = var.name
resource_group_name = var.resource_group_name
secret = var.secret
resource "azurerm_api_management_named_value" "api_mngmt_named_value" {
name = "value0"
resource_group_name = azurerm_resource_group.group.name
api_management_name = azurerm_api_management.api_mngmt.name
display_name = "name"
value = "value"
Parameters
-
api_management_name
required - string -
display_name
required - string -
id
optional computed - string -
name
required - string -
resource_group_name
required - string -
secret
optional - bool -
tags
optional - list of string -
value
required - string -
timeouts
single block
Explanation in Terraform Registry
Manages an API Management Named Value.
Microsoft.ApiManagement/service/namedValues (Azure Resource Manager)
The service/namedValues in Microsoft.ApiManagement can be configured in Azure Resource Manager with the resource name Microsoft.ApiManagement/service/namedValues
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
apiVersion
required - stringname
required - stringIdentifier of the NamedValue.
properties
requireddisplayName
required - stringUnique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters.
keyVault
optionalidentityClientId
optional - stringSystemAssignedIdentity or UserAssignedIdentity Client Id which will be used to access key vault secret.
secretIdentifier
optional - stringKey vault secret identifier for fetching secret. Providing a versioned secret will prevent auto-refresh. This requires API Management service to be configured with aka.ms/apimmsi
secret
optional - booleanDetermines whether the value is a secret and should be encrypted or not. Default value is false.
tags
optional - arrayOptional tags that when provided can be used to filter the NamedValue list.
value
optional - stringValue of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value.
type
required - string
Frequently asked questions
What is Azure API Management Named Value?
Azure API Management Named Value is a resource for API Management of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure API Management Named Value?
For Terraform, the kjsenthil/kjsenthil, MohdmM01/terraform-azure-demo and fortunkam/apim-devops-demos source code examples are useful. See the Terraform Example section for further details.