Skip to content

Instantly share code, notes, and snippets.

@heoelri
heoelri / Get-HealthModelMonthlyCost.ps1
Last active August 27, 2026 11:48
Get-HealthModelMonthlyCost.ps1
<#
.SYNOPSIS
Estimates the monthly signal cost for one or more Microsoft.CloudHealth health models.
.DESCRIPTION
Uses Azure CLI ARM requests to retrieve the health model, its entities, and its
signal definitions. Signal instance overrides and referenced signal definition
defaults are resolved before applying the following monthly list-price estimates:
- Metric signal: $0.30
@heoelri
heoelri / prometheus.tf
Created December 22, 2022 14:24
AzAPI resource definition to deploy the azure monitor workspace
resource "azapi_resource" "prometheus" {
type = "microsoft.monitor/accounts@2021-06-03-preview"
name = "prometheus-workspace"
parent_id = "/resource/group/resource/id" # replace with ResourceId
location = "uksouth"
response_export_values = ["*"]
}
@heoelri
heoelri / aro.tf
Created February 28, 2022 14:13
Deploy Azure Red Hat OpenShift via Terraform azurerm
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "2.98.0"
}
azuread = {
source = "hashicorp/azuread"
version = "~> 2.18.0"
@heoelri
heoelri / updateDependabot.yml
Created January 7, 2022 10:18
updateDependabot.yml GitHub Actions workflow executing update-dependabot.ps1
name: Update Dependabot config
on: push
jobs:
UpdateDependabot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@heoelri
heoelri / update-dependabot.ps1
Created January 7, 2022 10:08
This PowerShell file scans a repository for components that can be monitored by dependabot and auto-generates a dependabot.yml file for your GitHub repository.
[CmdletBinding()] # indicate that this is advanced function (with additional params automatically added)
param (
[string] $outputFile,
[string] $targetBranch = "main" # default = main
)
$files = Get-Childitem -Recurse
function packageEcosystem() {
@heoelri
heoelri / loadtest-baseline.json
Created January 5, 2022 10:25
Example baseline for Compare-LocustStats.ps1
[
{
"name": "POST new game result",
"operator": "le",
"values": {
"Failure Count":"3",
"Average Response Time": "175",
"Median Response Time": "175"
}
},
@heoelri
heoelri / Compare-LocustStats.ps1
Created January 5, 2022 10:24
This PowerShell core script compares a given locust stats csv against a baseline json
function Compare-LocustStats {
[CmdletBinding()] # indicate that this is advanced function (with additional params automatically added)
param (
$statsFile,
$baselineFile
)
if (Test-Path -Path "$baselineFile") {
@heoelri
heoelri / parse_loadtest_results.yaml
Created January 5, 2022 10:21
This YAML pipeline template calls a powershell script to analyze our locust results
parameters:
- name: customPrefix
type: string
default: ""
- name: statsPath # this directory path contains the locust *_stats.csv
type: string
steps:
- task: PowerShell@2
displayName: "Analyze Results from the load and chaos tests"
@heoelri
heoelri / deploy-locust.yaml
Created January 4, 2022 14:44
stage template for Azure DevOps used to deploy Locust
parameters:
- name: terraformWorkingDirectory
type: string
default: ''
- name: customPrefix
type: string
- name: locustTargetUrl
type: string
default: ''
- name: numberOfWorkerNodes
@heoelri
heoelri / locust_main.tf
Created January 4, 2022 12:05
Locust main TF file specifying the master nodes
resource "azurerm_container_group" "master" {
count = var.locust_workers >= 1 ? 1 : 0
name = "${local.prefix}-loadtest-master-ci"
location = azurerm_resource_group.deployment.location
resource_group_name = azurerm_resource_group.deployment.name
ip_address_type = "Public"
dns_name_label = "${local.prefix}-loadtest-master"
os_type = "Linux"
restart_policy = "Never" # Locust stops the master once the test is done. A restart_policy other than 'Never' and ACI will restart the container - and the test would run again from start.