bicep

package
v1.24.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 46 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEnsureEnvPreReqBicepCompileFailed = errors.New("")

Functions

func NewBicepProvider

func NewBicepProvider(
	azapi *azapi.AzureClient,
	bicepCli *bicep.Cli,
	resourceService *azapi.ResourceService,
	resourceManager infra.ResourceManager,
	deploymentManager *infra.DeploymentManager,
	envManager environment.Manager,
	env *environment.Environment,
	console input.Console,
	prompters prompt.Prompter,
	curPrincipal provisioning.CurrentPrincipalIdProvider,
	keyvaultService keyvault.KeyVaultService,
	cloud *cloud.Cloud,
	subscriptionManager *account.SubscriptionsManager,
	aiModelService *ai.AiModelService,
	serviceLocator ioc.ServiceLocator,
) provisioning.Provider

NewBicepProvider creates a new instance of a Bicep Infra provider

Types

type BicepProvider

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

BicepProvider exposes infrastructure provisioning using Azure Bicep templates

func (*BicepProvider) Deploy

Provisioning the infrastructure within the specified template

func (*BicepProvider) Destroy

Destroys the specified deployment by deleting all azure resources, resource groups & deployments that are referenced.

func (*BicepProvider) EnsureEnv

func (p *BicepProvider) EnsureEnv(ctx context.Context) error

EnsureEnv ensures that the environment is in a provision-ready state with required values set, prompting the user if values are unset. This also requires that the Bicep module can be compiled.

func (*BicepProvider) Initialize

func (p *BicepProvider) Initialize(ctx context.Context, projectPath string, opt provisioning.Options) error

Initialize initializes provider state from the options. It also calls EnsureEnv, which ensures the client-side state is ready for provisioning.

func (*BicepProvider) LastDeployment

func (p *BicepProvider) LastDeployment(ctx context.Context) (*azapi.ResourceDeployment, error)

func (*BicepProvider) Name

func (p *BicepProvider) Name() string

Name gets the name of the infra provider

func (*BicepProvider) Parameters

func (p *BicepProvider) Parameters(ctx context.Context) ([]provisioning.Parameter, error)

func (*BicepProvider) PlannedOutputs added in v1.23.14

func (p *BicepProvider) PlannedOutputs(ctx context.Context) ([]provisioning.PlannedOutput, error)

func (*BicepProvider) Preview

Preview runs deploy using the what-if argument

func (*BicepProvider) State

type InputConstraints

type InputConstraints struct {
	MinLength *int `json:"minLength,omitempty"`
	MaxLength *int `json:"maxLength,omitempty"`
	MinValue  *int `json:"minValue,omitempty"`
	MaxValue  *int `json:"maxValue,omitempty"`
}

InputConstraints captures the numeric/length constraints from an ARM parameter definition.

type MissingInput

type MissingInput struct {
	Name          string            `json:"name"`
	Type          string            `json:"type"`
	Secure        bool              `json:"secure"`
	Description   string            `json:"description,omitempty"`
	EnvVarNames   []string          `json:"envVarNames,omitempty"`
	ConfigKey     string            `json:"configKey,omitempty"`
	AllowedValues []string          `json:"allowedValues,omitempty"`
	Constraints   *InputConstraints `json:"constraints,omitempty"`
}

MissingInput represents a missing required input for infrastructure provisioning.

type MissingInputsError

type MissingInputsError struct {
	Inputs []MissingInput
}

MissingInputsError is an error that contains information about all missing required inputs.

func (*MissingInputsError) Error

func (e *MissingInputsError) Error() string

Error implements the error interface for MissingInputsError.

func (*MissingInputsError) MarshalJSON

func (e *MissingInputsError) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for MissingInputsError.

func (*MissingInputsError) ToString

func (e *MissingInputsError) ToString(currentIndentation string) string

ToString returns a formatted message with the missing inputs and resolution guidance.

type PreflightCheck added in v1.23.14

type PreflightCheck struct {
	// RuleID is a unique, stable identifier for the rule (e.g. "role_assignment_permissions").
	RuleID string
	// Fn is the check function that performs the validation.
	Fn PreflightCheckFn
}

PreflightCheck pairs a unique rule identifier with its check function. The RuleID is a stable, unique string used in telemetry to identify which rule produced a result (e.g. for crash tracking). Each rule may emit results with different DiagnosticIDs to distinguish specific finding types.

type PreflightCheckFn

type PreflightCheckFn func(
	ctx context.Context,
	valCtx *validationContext,
) ([]PreflightCheckResult, error)

PreflightCheckFn is a function that performs a single preflight validation check. It receives the execution context and a validationContext containing the console, analyzed resource properties, and the deployment snapshot. It returns zero or more results describing findings (or nil/empty if there is nothing to report) and an error if the check itself failed to execute.

type PreflightCheckResult

type PreflightCheckResult struct {
	// Severity indicates whether this result is a warning or a blocking error.
	Severity PreflightCheckSeverity
	// DiagnosticID is a unique, stable identifier for this specific finding type
	// (e.g. "role_assignment_missing"). Used in telemetry to correlate actioned
	// warnings with deployment outcomes and to track error frequency over time.
	DiagnosticID string
	// Message is a human-readable description of the finding.
	Message string
}

PreflightCheckResult holds the outcome of a single preflight check function.

type PreflightCheckSeverity

type PreflightCheckSeverity int

PreflightCheckSeverity indicates the severity level of a preflight check result.

const (
	// PreflightCheckWarning indicates a non-blocking issue that should be reported to the user.
	PreflightCheckWarning PreflightCheckSeverity = iota
	// PreflightCheckError indicates a blocking issue that should prevent deployment.
	PreflightCheckError
)

Jump to

Keyboard shortcuts

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