diff --git a/bundle/config/target.go b/bundle/config/target.go index a2ef4d7356..4b20fac15b 100644 --- a/bundle/config/target.go +++ b/bundle/config/target.go @@ -2,7 +2,6 @@ package config import ( "github.com/databricks/cli/bundle/config/resources" - "github.com/databricks/cli/bundle/config/variable" "github.com/databricks/databricks-sdk-go/service/jobs" ) @@ -38,7 +37,26 @@ type Target struct { // Override default values or lookup name for defined variables // Does not permit defining new variables or redefining existing ones // in the scope of an target - Variables map[string]*variable.Variable `json:"variables,omitempty"` + // + // There are two valid ways to define a variable override in a target: + // 1. Direct value override. We normalize this to the variable.Variable + // struct format when loading the configuration YAML: + // + // variables: + // foo: "value" + // + // 2. Override matching the variable.Variable struct. + // + // variables: + // foo: + // default: "value" + // + // OR + // + // variables: + // foo: + // lookup: "resource_name" + Variables map[string]any `json:"variables,omitempty"` Git Git `json:"git,omitempty"` diff --git a/bundle/generated/jsonschema.json b/bundle/generated/jsonschema.json index b9edc1e91f..2d6f04f3c9 100644 --- a/bundle/generated/jsonschema.json +++ b/bundle/generated/jsonschema.json @@ -987,7 +987,7 @@ "$ref": "#/$defs/github.com/databricks/cli/bundle/config.Sync" }, "variables": { - "$ref": "#/$defs/map/github.com/databricks/cli/bundle/config/variable.Variable" + "$ref": "#/$defs/map/interface" }, "workspace": { "$ref": "#/$defs/github.com/databricks/cli/bundle/config.Workspace" @@ -5031,6 +5031,20 @@ } } }, + "interface": { + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/interface" + } + }, + { + "type": "string", + "pattern": "\\$\\{(var(\\.[a-zA-Z]+([-_]?[a-zA-Z0-9]+)*(\\[[0-9]+\\])*)*(\\[[0-9]+\\])*)\\}" + } + ] + }, "string": { "anyOf": [ {