Amending changes from @TomChv
Signed-off-by: Sujay Pillai <sujayopillai@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package resourcegroup
|
||||
import (
|
||||
"alpha.dagger.io/azure"
|
||||
"alpha.dagger.io/os"
|
||||
"alpha.dagger.io/dagger"
|
||||
)
|
||||
|
||||
// Create a resource group
|
||||
@@ -11,10 +12,13 @@ import (
|
||||
config: azure.#Config
|
||||
|
||||
// ResourceGroup name
|
||||
rgName: string @dagger(input)
|
||||
rgName: string & dagger.#Input
|
||||
|
||||
// ResourceGroup location
|
||||
rgLocation: string @dagger(input)
|
||||
rgLocation: string & dagger.#Input
|
||||
|
||||
// ResourceGroup Id
|
||||
id: string & dagger.#Output
|
||||
|
||||
// Container image
|
||||
ctr: os.#Container & {
|
||||
@@ -24,16 +28,21 @@ import (
|
||||
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
|
||||
az group create -l "$AZURE_DEFAULTS_LOCATION" -n "$AZURE_DEFAULTS_GROUP"
|
||||
az group show -n "$AZURE_DEFAULTS_GROUP" --query "id" -o json | jq -r . | tr -d "\n" > /resourceGroupId
|
||||
"""
|
||||
|
||||
env: {
|
||||
AZURE_DEFAULTS_GROUP: rgName
|
||||
AZURE_DEFAULTS_LOCATION: rgLocation
|
||||
}
|
||||
}
|
||||
|
||||
// Resource Id
|
||||
id: {
|
||||
id: ({
|
||||
os.#File & {
|
||||
from: ctr
|
||||
path: "/resourceGroupId"
|
||||
}
|
||||
}.contents @dagger(output)
|
||||
}).contents
|
||||
}
|
||||
|
@@ -6,12 +6,12 @@ import (
|
||||
"alpha.dagger.io/random"
|
||||
)
|
||||
|
||||
suffix: random.#String & {
|
||||
TestSuffix: random.#String & {
|
||||
seed: "azrg"
|
||||
}
|
||||
|
||||
rg: resourcegroup.#ResourceGroup & {
|
||||
TestRG: resourcegroup.#ResourceGroup & {
|
||||
config: azure.#Config
|
||||
rgName: "rg-test-\(suffix.out)"
|
||||
rgName: "rg-test-\(TestSuffix.out)"
|
||||
rgLocation: "eastus2"
|
||||
}
|
||||
|
Reference in New Issue
Block a user