Adding support for azure and create a resource group
Signed-off-by: Sujay Pillai <sujayopillai@gmail.com>
This commit is contained in:
42
stdlib/azure/resourcegroup/rg.cue
Normal file
42
stdlib/azure/resourcegroup/rg.cue
Normal 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)
|
||||
}
|
17
stdlib/azure/resourcegroup/tests/rg.cue
Normal file
17
stdlib/azure/resourcegroup/tests/rg.cue
Normal 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"
|
||||
}
|
Reference in New Issue
Block a user