Skip to content

Instantly share code, notes, and snippets.

terraform {
required_version = "~> 1.6"
required_providers {
azapi = {
source = "azure/azapi"
version = "~> 2.0"
}
}
}
@matt-FFFFFF
matt-FFFFFF / lightpilot-bigger-cities.xml
Last active July 22, 2024 15:33
XCTrack Lightpilot road map theme with larger city name labels, based on the Hyperpilot example: https://www.fly-air3.com/en/ufaqs/how-to-display-cities-in-larger-font-on-the-map/
<?xml version="1.0" encoding="UTF-8"?>
<rendertheme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" map-background="#fffcfa"
version="1" xmlns="http://opensciencemap.org/rendertheme"
xsi:schemaLocation="http://opensciencemap.org/rendertheme https://raw.githubusercontent.com/mapsforge/vtm/master/resources/rendertheme.xsd">
<!--######
TRANSFORM tags ######-->
<tag-transform k="roof:colour" k-lib="roof:colour" v="blue" v-lib="#4e7ee0" />
<tag-transform k="roof:colour" k-lib="roof:colour" v="green" v-lib="#3ed889" />
<tag-transform k="roof:colour" k-lib="roof:colour" v="red" v-lib="#ad4340" />
@matt-FFFFFF
matt-FFFFFF / locals.tf
Created January 29, 2024 13:46
Terraform data types
locals {
my_string = "Hello World!"
my_empty_string = ""
my_number_as_string = "1234"
my_bool = true
my_number = 1234
my_number_2 = 12.34
my_list = ["Hello", "World", "!"]
my_set_of_strings = toset(["Hello", "World", "!"])
my_nested_list = [
@matt-FFFFFF
matt-FFFFFF / sample.tf
Created October 20, 2023 08:23
Scenario selection with tf
variable "scenario" {
type = string
description = "Scenario to deploy. Must be one of 'simple', or 'complex'."
default = "simple"
validation {
condition = contains(["simple", "complex"], var.scenario)
error_message = "Scenario must be one of 'simple', or 'complex'."
}
}
{
"properties": {
"description": "Deploys NSG flow logs and traffic analytics to a storageaccountid with a specified retention period. This must be assigned once for each in-scope region because the storage account and NSG must be in the same region.",
"displayName": "Deploys NSG flow logs and traffic analytics",
"mode": "all",
"parameters": {
"effect": {
"allowedValues": [
"DeployIfNotExists",
"Disabled"
@matt-FFFFFF
matt-FFFFFF / deny-loganalytics-solution.json
Created February 25, 2021 15:31
Azure policy to disallow specific LA solutions
{
"properties": {
"displayName": "Disallowed Log Analytics solutions",
"policyType": "Custom",
"mode": "All",
"description": "This policy enables you to specify the resource types that your organization cannot deploy.",
"metadata": {
"category": "General",
},
"parameters": {
@matt-FFFFFF
matt-FFFFFF / apim-appinsights
Created August 18, 2020 21:21
azure-apim-appinsights.json
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"type": "String"
},
"location": {
"type": "String"
},
@matt-FFFFFF
matt-FFFFFF / .localrc
Created August 14, 2020 14:22
.localrc
export KEYVAULT=<<<CHANGEME>>>
# Configure ssh forwarding
export SSH_AUTH_SOCK=$HOME/.ssh/agent.sock
# need `ps -ww` to get non-truncated command for matching
# use square brackets to generate a regex match for the process we want but that doesn't match the grep command running it!
ALREADY_RUNNING=$(ps -auxww | grep -q "[n]piperelay.exe -ei -s //./pipe/openssh-ssh-agent"; echo $?)
if [[ $ALREADY_RUNNING != "0" ]]; then
if [[ -S $SSH_AUTH_SOCK ]]; then
# not expecting the socket to exist as the forwarding command isn't running (http://www.tldp.org/LDP/abs/html/fto.html)
@matt-FFFFFF
matt-FFFFFF / deploy-azure-backup.json
Created July 27, 2020 22:12
Azure Backup Policy Sample
{
"mode": "All",
"policyRule": {
"if": {
"allOf": [
{
"equals": "Microsoft.Compute/virtualMachines",
"field": "type"
},
{
@matt-FFFFFF
matt-FFFFFF / NSG-Flow-Log-Analytics-policydef.json
Last active July 21, 2020 10:56
NSG flow logs and traffic analytics policy def
{
"mode": "All",
"policyRule": {
"if": {
"equals": "Microsoft.Network/networkSecurityGroups",
"field": "type"
},
"then": {
"details": {
"deployment": {