Skip to content

Instantly share code, notes, and snippets.

@sebader
Created November 8, 2021 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebader/d2de7069053627ccc2df8964d035f7e5 to your computer and use it in GitHub Desktop.
Save sebader/d2de7069053627ccc2df8964d035f7e5 to your computer and use it in GitHub Desktop.
Terraform example Application Insights ping test
resource "azurerm_application_insights_web_test" "cluster_ping" {
name = "${local.prefix}-appinsights-webtest-cluster-${local.location_short}"
location = azurerm_resource_group.stamp.location
resource_group_name = var.monitoring_resource_group_name
application_insights_id = data.azurerm_application_insights.stamp.id
kind = "ping"
frequency = 300
timeout = 30
enabled = true
geo_locations = ["us-tx-sn1-azr", "us-il-ch1-azr", "emea-fr-pra-edge", "emea-se-sto-edge", "apac-hk-hkn-azr"]
# The GUIDs are ignored by Application Insights so we can set them all to zero
configuration = <<XML
<WebTest Name="${local.prefix}-appinsights-webtest-cluster-${local.location_short}" Id="00000000-0000-0000-0000-000000000000" Enabled="True" CssProjectStructure="" CssIteration="" Timeout="30" WorkItemIds="" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" Description="" CredentialUserName="" CredentialPassword="" PreAuthenticate="True" Proxy="default" StopOnError="False" RecordedResultFile="" ResultsLocale="">
<Items>
<Request Method="GET" Guid="00000000-0000-0000-0000-000000000000" Version="1.1" Url="https://${azurerm_public_ip.aks_ingress.fqdn}/health/stamp" ThinkTime="0" Timeout="30" ParseDependentRequests="False" FollowRedirects="False" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="200" ExpectedResponseUrl="" ReportingName="" IgnoreHttpStatusCode="False">
<Headers>
<Header Name="X-Azure-FDID" Value="${var.frontdoor_id_header}" />
</Headers>
</Request>
</Items>
</WebTest>
XML
lifecycle {
ignore_changes = [
# Ignore changes to tags because there is a hidden-link tag that gets created by ARM
tags
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment