Skip to content

Commit

Permalink
feat(azure): add availability test for apim
Browse files Browse the repository at this point in the history
  • Loading branch information
arealmaas committed Oct 21, 2024
1 parent 71698bf commit ca2b1a0
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .azure/infrastructure/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ param sourceKeyVaultSshJumperSshPublicKey string
@description('The object ID of the group to assign the Admin Login role for SSH Jumper')
param sshJumperAdminLoginGroupObjectId string

@description('The URL of the APIM instance')
param apimUrl string

import { Sku as KeyVaultSku } from '../modules/keyvault/create.bicep'
param keyVaultSku KeyVaultSku

Expand Down Expand Up @@ -117,6 +120,18 @@ module appInsights '../modules/applicationInsights/create.bicep' = {
}
}

module apimAvailabilityTest '../modules/applicationInsights/availabilityTest.bicep' = {
scope: resourceGroup
name: 'apimAvailabilityTest'
params: {
name: '${namePrefix}-dialogporten-health-test'
location: location
tags: tags
appInsightsId: appInsights.outputs.appInsightsId
url: '${apimUrl}/health/deep'
}
}

module serviceBus '../modules/serviceBus/main.bicep' = {
scope: resourceGroup
name: 'serviceBus'
Expand Down
2 changes: 2 additions & 0 deletions .azure/infrastructure/prod.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ param serviceBusSku = {

// Altinn Product Dialogporten: Developers Prod
param sshJumperAdminLoginGroupObjectId = 'a94de4bf-0a83-4d30-baba-0c6a7365571c'

param apimUrl = 'https://platform.altinn.no/dialogporten'
2 changes: 2 additions & 0 deletions .azure/infrastructure/staging.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ param serviceBusSku = {
}
// Altinn Product Dialogporten: Developers Prod
param sshJumperAdminLoginGroupObjectId = 'a94de4bf-0a83-4d30-baba-0c6a7365571c'

param apimUrl = 'https://platform.tt02.altinn.no/dialogporten'
2 changes: 2 additions & 0 deletions .azure/infrastructure/test.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ param serviceBusSku = {

// Altinn Product Dialogporten: Developers Dev
param sshJumperAdminLoginGroupObjectId = 'c12e51e3-5cbd-4229-8a31-5394c423fb5f'

param apimUrl = 'https://altinn-dev-api.azure-api.net/dialogporten'
2 changes: 2 additions & 0 deletions .azure/infrastructure/yt01.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ param serviceBusSku = {
}
// Altinn Product Dialogporten: Developers Dev
param sshJumperAdminLoginGroupObjectId = 'c12e51e3-5cbd-4229-8a31-5394c423fb5f'

param apimUrl = 'https://platform.yt01.altinn.cloud/dialogporten'
49 changes: 49 additions & 0 deletions .azure/modules/applicationInsights/availabilityTest.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@description('The name of the availability test')
param name string

@description('The location where the resources will be deployed')
param location string

@description('Tags to apply to resources')
param tags object

@description('The ID of the Application Insights resource')
param appInsightsId string


@description('The URL of the availability test')
param url string

resource availabilityTest 'Microsoft.Insights/webtests@2022-06-15' = {
name: name
location: location
tags: union(tags, {
'hidden-link:${appInsightsId}': 'Resource'
})
kind: 'standard'
properties: {
Enabled: true
SyntheticMonitorId: name
Name: name
Description: 'Availability test for ${name}'
Frequency: 120 // Run test every 2 minutes
Timeout: 60 // 1 minute timeout
Kind: 'standard'
RetryEnabled: true
Locations: [
{ Id: 'emea-nl-ams-azr' } // Amsterdam
{ Id: 'emea-se-sto-edge' } // Stockholm
{ Id: 'emea-gb-db3-azr' } // Dublin
]
Request: {
RequestUrl: url
HttpVerb: 'GET'
ParseDependentRequests: false
}
ValidationRules: {
ExpectedHttpStatusCode: 200
SSLCheck: true
SSLCertRemainingLifetimeCheck: 7
}
}
}
1 change: 1 addition & 0 deletions .azure/modules/applicationInsights/create.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ resource appInsights 'Microsoft.Insights/components@2020-02-02' = {
output connectionString string = appInsights.properties.ConnectionString
output appInsightsWorkspaceName string = appInsightsWorkspace.name
output appInsightsName string = appInsights.name
output appInsightsId string = appInsights.id

0 comments on commit ca2b1a0

Please sign in to comment.