azurermApiManagementDiagnostic
Manages an API Management Service Diagnostic.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
new azurerm.provider.AzurermProvider(this, "azurerm", {
features: [{}],
});
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "West Europe",
name: "example-resources",
}
);
const azurermApiManagementExample = new azurerm.apiManagement.ApiManagement(
this,
"example_2",
{
location: azurermResourceGroupExample.location,
name: "example-apim",
publisher_email: "company@terraform.io",
publisher_name: "My Company",
resource_group_name: azurermResourceGroupExample.name,
sku_name: "Developer_1",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermApiManagementExample.overrideLogicalId("example");
const azurermApplicationInsightsExample =
new azurerm.applicationInsights.ApplicationInsights(this, "example_3", {
application_type: "web",
location: azurermResourceGroupExample.location,
name: "example-appinsights",
resource_group_name: azurermResourceGroupExample.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermApplicationInsightsExample.overrideLogicalId("example");
const azurermApiManagementLoggerExample =
new azurerm.apiManagementLogger.ApiManagementLogger(this, "example_4", {
api_management_name: azurermApiManagementExample.name,
application_insights: [
{
instrumentation_key:
azurermApplicationInsightsExample.instrumentationKey,
},
],
name: "example-apimlogger",
resource_group_name: azurermResourceGroupExample.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermApiManagementLoggerExample.overrideLogicalId("example");
const azurermApiManagementDiagnosticExample =
new azurerm.apiManagementDiagnostic.ApiManagementDiagnostic(
this,
"example_5",
{
always_log_errors: true,
api_management_logger_id: azurermApiManagementLoggerExample.id,
api_management_name: azurermApiManagementExample.name,
backend_request: [
{
body_bytes: 32,
headers_to_log: ["content-type", "accept", "origin"],
},
],
backend_response: [
{
body_bytes: 32,
headers_to_log: ["content-type", "content-length", "origin"],
},
],
frontend_request: [
{
body_bytes: 32,
headers_to_log: ["content-type", "accept", "origin"],
},
],
frontend_response: [
{
body_bytes: 32,
headers_to_log: ["content-type", "content-length", "origin"],
},
],
http_correlation_protocol: "W3C",
identifier: "applicationinsights",
log_client_ip: true,
resource_group_name: azurermResourceGroupExample.name,
sampling_percentage: 5,
verbosity: "verbose",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermApiManagementDiagnosticExample.overrideLogicalId("example");
Argument Reference
The following arguments are supported:
-
identifier
- (Required) The diagnostic identifier for the API Management Service. At this time the supported values areapplicationinsights
andazuremonitor
. Changing this forces a new resource to be created. -
apiManagementName
- (Required) The Name of the API Management Service where this Diagnostic should be created. Changing this forces a new resource to be created. -
resourceGroupName
- (Required) The Name of the Resource Group where the API Management Service exists. Changing this forces a new resource to be created. -
apiManagementLoggerId
- (Required) The id of the target API Management Logger where the API Management Diagnostic should be saved.
-
alwaysLogErrors
- (Optional) Always log errors. Send telemetry if there is an erroneous condition, regardless of sampling settings. -
backendRequest
- (Optional) AbackendRequest
block as defined below. -
backendResponse
- (Optional) AbackendResponse
block as defined below. -
frontendRequest
- (Optional) AfrontendRequest
block as defined below. -
frontendResponse
- (Optional) AfrontendResponse
block as defined below. -
httpCorrelationProtocol
- (Optional) The HTTP Correlation Protocol to use. Possible values arenone
,legacy
orw3C
. -
logClientIp
- (Optional) Log client IP address. -
samplingPercentage
- (Optional) Sampling (%). For high traffic APIs, please read this documentation to understand performance implications and log sampling. Valid values are between00
and1000
. -
verbosity
- (Optional) Logging verbosity. Possible values areverbose
,information
orerror
. -
operationNameFormat
- (Optional) The format of the Operation Name for Application Insights telemetries. Possible values arename
, andurl
. Defaults toname
.
A backendRequest
, backendResponse
, frontendRequest
or frontendResponse
block supports the following:
-
bodyBytes
- (Optional) Number of payload bytes to log (up to 8192). -
headersToLog
- (Optional) Specifies a list of headers to log. -
dataMasking
- (Optional) AdataMasking
block as defined below.
A dataMasking
block supports the following:
-
queryParams
- (Optional) AqueryParams
block as defined below. -
headers
- (Optional) Aheaders
block as defined below.
The queryParams
and headers
blocks support the following:
-
mode
- (Required) The data masking mode. Possible values aremask
andhide
forqueryParams
. The only possible value ismask
forheaders
. -
value
- (Required) The name of the header or the query parameter to mask.
Attributes Reference
In addition to all arguments above, the following attributes are exported:
id
- The ID of the API Management Diagnostic.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the API Management Diagnostic.update
- (Defaults to 30 minutes) Used when updating the API Management Diagnostic.read
- (Defaults to 5 minutes) Used when retrieving the API Management Diagnostic.delete
- (Defaults to 30 minutes) Used when deleting the API Management Diagnostic.
Import
API Management Diagnostics can be imported using the resourceId
, e.g.