Skip to content

Commit

Permalink
refactor(pulumi/pulumi): use storage & group args
Browse files Browse the repository at this point in the history
  • Loading branch information
franklinkim committed Nov 12, 2024
1 parent 0f420e5 commit 9b9a9c6
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions pulumi/pulumi/azure/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,36 @@ func NewCommand(l log.Logger, az *az.AZ, op *onepassword.OnePassword, cache cach
fs.Default().String("debug", "", "Show full logs")
fs.Default().String("tags", "", "Quoted string with space-separated tags")
fs.Default().String("vebose", "", "Increase logging verbosity")
fs.Internal().String("group-args", "", "Additional group create args")
fs.Internal().String("storage-args", "", "Additional storaage create args")
return nil
},
Execute: func(ctx context.Context, r *readline.Readline) error {
be, err := inst.cfg.Backend(r.Args().At(0))
if err != nil {
return err
}
fsi := r.FlagSets().Internal()

groupArgs, err := fsi.GetString("group-args")
if err != nil {
return err
}
groupArgs = strings.Trim(strings.Trim(groupArgs, "\""), "'")

storageArgs, err := fsi.GetString("storage-args")
if err != nil {
return err
}
storageArgs = strings.Trim(strings.Trim(storageArgs, "\""), "'")

// Create a new resource group
inst.l.Info("creating resource group:", be.ResourceGroup)
if err := shell.New(ctx, inst.l, "az", "group", "create").
Args("--resource-group", be.ResourceGroup).
Args("--subscription", be.Subscription).
Args("--location", be.Location).
Args(strings.Split(groupArgs, " ")...).
Args(r.Flags()...).
Run(); err != nil {
return err
Expand All @@ -125,10 +141,7 @@ func NewCommand(l log.Logger, az *az.AZ, op *onepassword.OnePassword, cache cach
Args("--resource-group", be.ResourceGroup).
Args("--subscription", be.Subscription).
Args("--location", be.Location).
Args("--sku", "Standard_LRS").
Args("--allow-blob-public-access", "false").
Args("--min-tls-version", "TLS1_2").
Args("--public-network-access", "Disabled").
Args(strings.Split(storageArgs, " ")...).
Args(r.Flags()...).
Run(); err != nil {
return err
Expand Down

0 comments on commit 9b9a9c6

Please sign in to comment.