Skip to content

azurermApplicationInsightsStandardWebTest

Manages a Application Insights Standard WebTest.

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.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "rg-example",
  }
);
const azurermApplicationInsightsExample =
  new azurerm.applicationInsights.ApplicationInsights(this, "example_1", {
    application_type: "web",
    location: azurermResourceGroupExample.location,
    name: "example",
    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 azurermApplicationInsightsStandardWebTestExample =
  new azurerm.applicationInsightsStandardWebTest.ApplicationInsightsStandardWebTest(
    this,
    "example_2",
    {
      application_insights_id: azurermApplicationInsightsExample.id,
      geo_locations: ["example"],
      location: "West Europe",
      name: "example-test",
      request: [
        {
          url: "http://www.example.com",
        },
      ],
      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.*/
azurermApplicationInsightsStandardWebTestExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • name - (Required) The name which should be used for this Application Insights Standard WebTest. Changing this forces a new Application Insights Standard WebTest to be created.

  • resourceGroupName - (Required) The name of the Resource Group where the Application Insights Standard WebTest should exist. Changing this forces a new Application Insights Standard WebTest to be created.

  • location - (Required) The Azure Region where the Application Insights Standard WebTest should exist. Changing this forces a new Application Insights Standard WebTest to be created. It needs to correlate with location of the parent resource (azurerm_application_insights)

  • applicationInsightsId - (Required) The ID of the Application Insights instance on which the WebTest operates. Changing this forces a new Application Insights Standard WebTest to be created.

  • geoLocations - (Required) Specifies a list of where to physically run the tests from to give global coverage for accessibility of your application.

\~> Note: Valid options for geo locations are described here

  • request - (Required) A request block as defined below.

  • description - (Optional) Purpose/user defined descriptive test for this WebTest.

  • enabled - (Optional) Should the WebTest be enabled?

  • frequency - (Optional) Interval in seconds between test runs for this WebTest. Valid options are 300, 600 and 900. Defaults to 300.

  • retryEnabled - (Optional) Should the retry on WebTest failure be enabled?

  • tags - (Optional) A mapping of tags which should be assigned to the Application Insights Standard WebTest.

  • timeout - (Optional) Seconds until this WebTest will timeout and fail. Default is 30.

  • validationRules - (Optional) A validationRules block as defined below.


A content block supports the following:

  • contentMatch - (Required) A string value containing the content to match on.

  • ignoreCase - (Optional) Ignore the casing in the contentMatch value.

  • passIfTextFound - (Optional) If the content of contentMatch is found, pass the test. If set to false, the WebTest is failing if the content of contentMatch is found.


A header block supports the following:

  • name - (Required) The name which should be used for a header in the request.

  • value - (Required) The value which should be used for a header in the request.


A request block supports the following:

  • url - (Required) The WebTest request URL.

  • body - (Optional) The WebTest request body.

  • followRedirectsEnabled - (Optional) Should the following of redirects be enabled? Defaults to true.

  • header - (Optional) One or more header blocks as defined above.

  • httpVerb - (Optional) Which HTTP verb to use for the call. Options are 'GET', 'POST', 'PUT', 'PATCH', and 'DELETE'.

  • parseDependentRequestsEnabled - (Optional) Should the parsing of dependend requests be enabled? Defaults to true.


A validationRules block supports the following:

  • content - (Optional) A content block as defined above.

  • expectedStatusCode - (Optional) The expected status code of the response. Default is '200', '0' means 'response code < 400'

  • sslCertRemainingLifetime - (Optional) The number of days of SSL certificate validity remaining for the checked endpoint. If the certificate has a shorter remaining lifetime left, the test will fail. This number should be between 1 and 365.

  • sslCheckEnabled - (Optional) Should the SSL check be enabled?

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Application Insights Standard WebTest.

  • syntheticMonitorId - Unique ID of this WebTest. This is typically the same value as the Name field.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Application Insights Standard WebTest.
  • read - (Defaults to 5 minutes) Used when retrieving the Application Insights Standard WebTest.
  • update - (Defaults to 30 minutes) Used when updating the Application Insights Standard WebTest.
  • delete - (Defaults to 30 minutes) Used when deleting the Application Insights Standard WebTest.

Import

Application Insights Standard WebTests can be imported using the resourceId, e.g.

terraform import azurerm_application_insights_standard_web_test.example /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Insights/webTests/appinsightswebtest