I have an APIM named value that points to a secret in Key Vault.
I'm seeking a solution to utilize this 'named value' as a header value when defining the APIM backend.
Here is a snippet of the code in CDK for Terraform:
apim_backend = api_management_backend.ApiManagementBackend(self, "openai_apim_backend",
name="cdktf-openai-backend",
resource_group_name=openai_resource_group_name,
api_management_name=apim_name,
protocol="http",
url="https://example.privatelink.openai.azure.com",
credentials={
"header": {
"api-key": <<here should be named value>>,
"Content-Type": "application/json"
}
}
)
Is it possible?
I guess its possible. To reference an (APIM) in your CDK for Terraform code when defining the backend.
Assuming you have already created a Named Value in your APIM instance that references a Key Vault secret, you would need to retrieve the secret value using the APIM REST API and then use that value in your CDK code.