arm

package
v0.19.1221 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReservedParamNames = []string{"nuonInstallID", "nuonOrgID", "nuonAppID", "location", "deployTimestamp", runnerVmSizeParamName}

ReservedParamNames are always provided by Nuon, never exposed to the customer.

Functions

This section is empty.

Types

type ARMOutput

type ARMOutput struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

type ARMParameter

type ARMParameter struct {
	Type          string                `json:"type"`
	DefaultValue  any                   `json:"defaultValue,omitempty"`
	AllowedValues []any                 `json:"allowedValues,omitempty"`
	Metadata      *ARMParameterMetadata `json:"metadata,omitempty"`
}

type ARMParameterMetadata

type ARMParameterMetadata struct {
	Description string `json:"description,omitempty"`
}

type ARMTemplate

type ARMTemplate struct {
	Schema         string                  `json:"$schema"`
	ContentVersion string                  `json:"contentVersion"`
	Parameters     map[string]ARMParameter `json:"parameters,omitempty"`
	Variables      map[string]any          `json:"variables,omitempty"`
	Resources      []any                   `json:"resources"`
	Outputs        map[string]ARMOutput    `json:"outputs,omitempty"`
}

ARMTemplate represents an Azure Resource Manager deployment template.

type Params

type Params struct {
	fx.In

	Cfg *internal.Config
}

type Templates

type Templates struct {
	// contains filtered or unexported fields
}

func NewTemplates

func NewTemplates(params Params) *Templates

func (*Templates) CustomStacksTemplate added in v0.19.1164

func (t *Templates) CustomStacksTemplate(inp *stacks.TemplateInput) ([]byte, string, map[string]map[string]string, map[string]map[string]string, error)

func (*Templates) QuickLinkUIDefinition added in v0.19.1137

func (t *Templates) QuickLinkUIDefinition(inp *stacks.TemplateInput) ([]byte, string, error)

QuickLinkUIDefinition renders the createUiDefinition that accompanies the quick link's wrapper template.

Without it the portal renders its stock Basics step, where subscription, resource group, and location are free choices that carry nothing over between visits. That is fine for a first deploy and wrong for every one after it: the wrapper always names the stack <install-id>-stack, but a stack is identified by scope *and* name, so a customer who picks a different resource group on a reprovision creates a second, independent stack rather than updating the install's. Nothing errors — the install simply stops converging, and the duplicate keeps its own deny assignments.

The UI definition closes that by constraining the step to the values the install already committed to:

  • resourceGroup rejects any name but the install's, with allowExisting because by definition it already holds resources on every deploy after the first.
  • location is pinned to the install's region. Deploying elsewhere would strand resources in a region the platform does not track.
  • subscription requires deploymentStacks/write, so a missing permission shows up in the form rather than as a mid-deploy authorization failure.

Parameters carrying defaults are left out of outputs, so the wrapper's defaults apply. Parameters without one — customer secrets, which render as securestring — get a field on the Basics step, since there is nowhere else for their value to come from.

func (t *Templates) QuickLinkWrapper(inp *stacks.TemplateInput, templateURL string) ([]byte, string, error)

QuickLinkWrapper renders the template behind an Azure portal quick link: https://portal.azure.com/#create/Microsoft.Template/uri/<encoded wrapper URL>

The portal's Custom Deployment blade only ever creates a plain Microsoft.Resources/deployments — it has no deployment-stack mode, and Azure exposes stacks only via CLI/PowerShell/REST. This wrapper closes that gap: it is a deployment whose single resource is a Microsoft.Resources/deploymentStacks pointing at the real template. Deploying it therefore produces the same protected, self-cleaning stack as `az stack group create`, keeping both denySettings (customers cannot delete managed resources) and actionOnUnmanage (resources dropped from the template are deleted on the next reprovision rather than orphaned).

The stack template is referenced by URL rather than embedded. Inlining it under properties.template does not work: ARM evaluates an inline nested template's expressions in the *outer* template's context, so the cross- deployment references this template is built from — reference('vnetDeployment') and friends — fail to resolve with "could not find template resource or resource copy with this name". The usual remedy, expressionEvaluationOptions: {scope: inner}, is rejected outright: "not supported in 'Microsoft.Resources/deploymentStacks' type of resource". A linked template gets its own evaluation context and sidesteps both.

The wrapper re-declares the stack template's parameters and passes them through. The portal builds its form from the template it was handed, so without this the customer would see no fields at all and any parameter lacking a default (customer-supplied secrets, which render as securestring) would have nowhere to come from.

func (*Templates) Template

func (t *Templates) Template(inp *stacks.TemplateInput) ([]byte, string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL