Adding support for azure and create a resource group

Signed-off-by: Sujay Pillai <sujayopillai@gmail.com>
This commit is contained in:
Sujay Pillai
2021-08-11 01:20:16 +08:00
parent eadd075254
commit 5908aa628e
10 changed files with 208 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
package resourcegroup
import (
"alpha.dagger.io/os"
"alpha.dagger.io/azure"
)
// Create a resource group
#ResourceGroup: {
// Azure Config
config: azure.#Config
// ResourceGroup name
rgName: string @dagger(input)
// ResourceGroup location
rgLocation: string @dagger(input)
// Container image
ctr: os.#Container & {
image: azure.#CLI & {
"config": config
}
// Path of the shell to execute
shell: path: "/bin/bash"
always: true
command: """
az group create -l "\(rgLocation)" -n "\(rgName)"
az group show -n "\(rgName)" --query "id" -o json | jq -r . | tr -d "\n" > /resourceGroupId
"""
}
// Resource Id
id: {
os.#File & {
from: ctr
path: "/resourceGroupId"
}
}.contents @dagger(output)
}

View File

@@ -0,0 +1,17 @@
package resourcegroup
import (
"alpha.dagger.io/azure"
"alpha.dagger.io/azure/resourcegroup"
"alpha.dagger.io/random"
)
suffix: random.#String & {
seed: "azrg"
}
rg: resourcegroup.#ResourceGroup & {
config: azure.#Config
rgName: "rg-test-\(suffix.out)"
rgLocation: "eastus2"
}