This set of guided exercises shows the different steps required to design new ARM resources that can be consumed in Farmer. This tutorial will show you the steps to take to create a resource that can hook into the Farmer pipeline, by adding support to Farmer for the ContainerRegistry
Azure resource. This will involve:
IArmResource
that maps directly to the ARM template output.IBuilder
and an associated computation expression that will be easier for users to consume than an F# record.This will end up allowing us to define a resource that looks like this:
let myRegistry = containerRegistry {
name "devonRegistry"
sku ContainerRegistrySku.Basic
enable_admin_user
}
let deployment = arm {
location Location.WestCentralUS
add_resource myRegistry
}
which generates JSON looking something like this:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"resources": [
{
"apiVersion": "2019-05-01",
"location": "westcentralus",
"name": "my-registry",
"properties": {
"adminUserEnabled": true
},
"sku": {
"name": "Basic"
},
"type": "Microsoft.ContainerRegistry/registries"
}
]
}
IArmResource
interface.IBuilder
provides the capability of creating a smart type that helps model a resource or a collection of resources into associated IArmResource
objects required for constructing the ARM template. For example, Farmer’s WebApp builder provides a logical abstraction on top of several ARM resources: Web App, Server Farm and Application Insights.