Repository: Azure/draft
Pull request #320 (2024-06-19 18:56:50)

Draft Config Refactor
# Description

At the core of this PR are the changes made to the DraftConfig{} struct. The BuilderVarDefault{} struct was absorbed into BuilderVar{}. This led to a restructuring of all draft.yaml templates as well as a refactoring of several functions to incorporate the new data structure.

Fixes # (issue)
Feature # (details)

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

# How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. Is it a  breaking change which will impact consuming tool(s).

- [ ] Test A
- [ ] Test B


# Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules



davidgamero: just some test issues with unsubstituted variable for `{{CHARTOVERRIDES}}`

Patch:
diff --git a/cmd/create.go b/cmd/create.go
index 5fa7545..b0bfd1d 100644
--- a/cmd/create.go
+++ b/cmd/create.go
@@ -265,20 +265,22 @@ func (cc *createCmd) generateDockerfile(langConfig *config.DraftConfig, lowerLan
 		return err
 	}
 
-	// Check for existing duplicate defualts
+	// Check for existing duplicate defaults
 	for k, v := range extractedValues {
 		variableExists := false
-		for i, varD := range langConfig.VariableDefaults {
-			if k == varD.Name {
+		for i, variable := range langConfig.Variables {
+			if k == variable.Name {
 				variableExists = true
-				langConfig.VariableDefaults[i].Value = v
+				langConfig.Variables[i].Default.Value = v
 				break
 			}
 		}
 		if !variableExists {
-			langConfig.VariableDefaults = append(langConfig.VariableDefaults, config.BuilderVarDefault{
-				Name:  k,
-				Value: v,
+			langConfig.Variables = append(langConfig.Variables, config.BuilderVar{
+				Name: k,
+				Default: config.BuilderVarDefault{
+					Value: v,
+				},
 			})
 		}
 	}
@@ -290,7 +292,7 @@ func (cc *createCmd) generateDockerfile(langConfig *config.DraftConfig, lowerLan
 			return err
 		}
 	} else {
-		inputs, err = validateConfigInputsToPrompts(langConfig.Variables, cc.createConfig.LanguageVariables, langConfig.VariableDefaults)
+		inputs, err = validateConfigInputsToPrompts(langConfig.Variables, cc.createConfig.LanguageVariables)
 		if err != nil {
 			return err
 		}
@@ -328,7 +330,7 @@ func (cc *createCmd) createDeployment() error {
 		if deployConfig == nil {
 			return errors.New("invalid deployment type")
 		}
-		customInputs, err = validateConfigInputsToPrompts(deployConfig.Variables, cc.createConfig.DeployVariables, deployConfig.VariableDefaults)
+		customInputs, err = validateConfigInputsToPrompts(deployConfig.Variables, cc.createConfig.DeployVariables)
 		if err != nil {
 			return err
 		}
@@ -462,7 +464,7 @@ func init() {
 	rootCmd.AddCommand(newCreateCmd())
 }
 
-func validateConfigInputsToPrompts(required []config.BuilderVar, provided []UserInputs, defaults []config.BuilderVarDefault) (map[string]string, error) {
+func validateConfigInputsToPrompts(required []config.BuilderVar, provided []UserInputs) (map[string]string, error) {
 	customInputs := make(map[string]string)
 
 	// set inputs to provided values
@@ -471,24 +473,27 @@ func validateConfigInputsToPrompts(required []config.BuilderVar, provided []User
 	}
 
 	// fill in missing vars using variable default references
-	for _, variableDefault := range defaults {
-		if customInputs[variableDefault.Name] == "" && variableDefault.ReferenceVar != "" {
-			log.Debugf("variable %s is empty, using default referenceVar value from %s", variableDefault.Name, variableDefault.ReferenceVar)
-			customInputs[variableDefault.Name] = customInputs[variableDefault.ReferenceVar]
+	for _, variable := range required {
+		if customInputs[variable.Name] == "" && variable.Default.ReferenceVar != "" {
+			log.Debugf("variable %s is empty, using default referenceVar value from %s", variable.Name, variable.Default.ReferenceVar)
+			customInputs[variable.Name] = customInputs[variable.Default.ReferenceVar]
 		}
 	}
 
 	// fill in missing vars using variable default values
-	for _, variableDefault := range defaults {
-		if customInputs[variableDefault.Name] == "" && variableDefault.Value != "" {
-			log.Debugf("setting default value for %s to %s", variableDefault.Name, variableDefault.Value)
-			customInputs[variableDefault.Name] = variableDefault.Value
+	for _, variable := range required {
+		if customInputs[variable.Name] == "" && variable.Default.Value != "" {
+			log.Debugf("variable %s is empty, using default value %s", variable.Name, variable.Default.Value)
+			customInputs[variable.Name] = variable.Default.Value
 		}
 	}
 
 	for _, variable := range required {
-		if _, ok := customInputs[variable.Name]; !ok {
+		value, ok := customInputs[variable.Name]
+		if !ok {
 			return nil, fmt.Errorf("config missing required variable: %s with description: %s", variable.Name, variable.Description)
+		} else if value == "" {
+			return nil, fmt.Errorf("value for variable %s is empty", variable.Name)
 		}
 	}
 
diff --git a/cmd/setup-gh.go b/cmd/setup-gh.go
index ae31625..d486217 100644
--- a/cmd/setup-gh.go
+++ b/cmd/setup-gh.go
@@ -87,7 +87,7 @@ func fillSetUpConfig(sc *providers.SetUpCmd) error {
 				return fmt.Errorf("getting subscription labels: %w", err)
 			}
 
-			sc.SubscriptionID, err = GetAzSubscriptionId(subLabels, currentSub)
+			sc.SubscriptionID, err = getAzSubscriptionId(subLabels, currentSub)
 			if err != nil {
 				return fmt.Errorf("getting subscription ID: %w", err)
 			}
@@ -223,7 +223,7 @@ func getCloudProvider() string {
 	return selectResponse
 }
 
-func GetAzSubscriptionId(subLabels []providers.SubLabel, currentSub providers.SubLabel) (string, error) {
+func getAzSubscriptionId(subLabels []providers.SubLabel, currentSub providers.SubLabel) (string, error) {
 	subLabel, err := prompts.Select("Please choose the subscription ID you would like to use", subLabels, &prompts.SelectOpt[providers.SubLabel]{
 		Field: func(subLabel providers.SubLabel) string {
 			return subLabel.Name + " (" + subLabel.ID + ")"
diff --git a/pkg/config/draftconfig.go b/pkg/config/draftconfig.go
index 05b5386..9950e6b 100644
--- a/pkg/config/draftconfig.go
+++ b/pkg/config/draftconfig.go
@@ -1,15 +1,16 @@
 package config
 
 import (
+	"errors"
+
 	log "github.com/sirupsen/logrus"
 )
 
 // TODO: remove Name Overrides since we don't need them anymore
 type DraftConfig struct {
-	DisplayName      string              `yaml:"displayName"`
-	NameOverrides    []FileNameOverride  `yaml:"nameOverrides"`
-	Variables        []BuilderVar        `yaml:"variables"`
-	VariableDefaults []BuilderVarDefault `yaml:"variableDefaults"`
+	DisplayName   string             `yaml:"displayName"`
+	NameOverrides []FileNameOverride `yaml:"nameOverrides"`
+	Variables     []BuilderVar       `yaml:"variables"`
 
 	nameOverrideMap map[string]string
 }
@@ -20,17 +21,17 @@ type FileNameOverride struct {
 }
 
 type BuilderVar struct {
-	Name             string   `yaml:"name"`
-	Description      string   `yaml:"description"`
-	VarType          string   `yaml:"type"`
-	ExampleValues    []string `yaml:"exampleValues"`
+	Name          string            `yaml:"name"`
+	Default       BuilderVarDefault `yaml:"default"`
+	Description   string            `yaml:"description"`
+	ExampleValues []string          `yaml:"exampleValues"`
+	Type          string            `yaml:"type"`
 }
 
 type BuilderVarDefault struct {
-	Name             string `yaml:"name"`
-	Value            string `yaml:"value"`
-	ReferenceVar     string `yaml:"referenceVar"`
 	IsPromptDisabled bool   `yaml:"disablePrompt"`
+	ReferenceVar     string `yaml:"referenceVar"`
+	Value            string `yaml:"value"`
 }
 
 func (d *DraftConfig) GetVariableExampleValues() map[string][]string {
@@ -40,6 +41,7 @@ func (d *DraftConfig) GetVariableExampleValues() map[string][]string {
 			variableExampleValues[variable.Name] = variable.ExampleValues
 		}
 	}
+
 	return variableExampleValues
 }
 
@@ -65,14 +67,29 @@ func (d *DraftConfig) GetNameOverride(path string) string {
 }
 
 // ApplyDefaultVariables will apply the defaults to variables that are not already set
-func (d *DraftConfig) ApplyDefaultVariables(customConfig map[string]string) {
-	for _, variable := range d.VariableDefaults {
+func (d *DraftConfig) ApplyDefaultVariables(customConfig map[string]string) error {
+	for _, variable := range d.Variables {
 		// handle where variable is not set or is set to an empty string from cli handling
-		if defaultVal, ok := customConfig[variable.Name]; !ok || defaultVal == "" {
-			log.Infof("Variable %s defaulting to value %s", variable.Name, variable.Value)
-			customConfig[variable.Name] = variable.Value
+		if val, ok := customConfig[variable.Name]; !ok || val == "" {
+			if variable.Default.Value == "" {
+				return errors.New("variable " + variable.Name + " has no default value")
+			}
+			log.Infof("Variable %s defaulting to value %s", variable.Name, variable.Default.Value)
+			customConfig[variable.Name] = variable.Default.Value
 		}
 	}
+
+	return nil
+}
+
+func VariableIdxMap(variables []BuilderVar) map[string]int {
+	varIdxMap := make(map[string]int)
+
+	for i, variable := range variables {
+		varIdxMap[variable.Name] = i
+	}
+
+	return varIdxMap
 }
 
 // TemplateVariableRecorder is an interface for recording variables that are used read using draft configs
diff --git a/pkg/prompts/prompts.go b/pkg/prompts/prompts.go
index ca0ef52..cc8bdf1 100644
--- a/pkg/prompts/prompts.go
+++ b/pkg/prompts/prompts.go
@@ -39,56 +39,49 @@ func RunPromptsFromConfigWithSkipsIO(config *config.DraftConfig, varsToSkip []st
 
 	inputs := make(map[string]string)
 
-	for _, customPrompt := range config.Variables {
-		promptVariableName := customPrompt.Name
-		if _, ok := skipMap[promptVariableName]; ok {
-			log.Debugf("Skipping prompt for %s", promptVariableName)
+	for _, variable := range config.Variables {
+		if val, ok := skipMap[variable.Name]; ok && val != "" {
+			log.Debugf("Skipping prompt for %s", variable.Name)
 			continue
 		}
-		if GetIsPromptDisabled(customPrompt.Name, config.VariableDefaults) {
-			log.Debugf("Skipping prompt for %s as it has IsPromptDisabled=true", promptVariableName)
-			noPromptDefaultValue := GetVariableDefaultValue(promptVariableName, config.VariableDefaults, inputs)
+
+		if variable.Default.IsPromptDisabled {
+			log.Debugf("Skipping prompt for %s as it has IsPromptDisabled=true", variable.Name)
+			noPromptDefaultValue := GetVariableDefaultValue(variable, inputs)
 			if noPromptDefaultValue == "" {
-				return nil, fmt.Errorf("IsPromptDisabled is true for %s but no default value was found", promptVariableName)
+				return nil, fmt.Errorf("IsPromptDisabled is true for %s but no default value was found", variable.Name)
 			}
-			log.Debugf("Using default value %s for %s", noPromptDefaultValue, promptVariableName)
-			inputs[promptVariableName] = noPromptDefaultValue
+			log.Debugf("Using default value %s for %s", noPromptDefaultValue, variable.Name)
+			inputs[variable.Name] = noPromptDefaultValue
 			continue
 		}
 
-		log.Debugf("constructing prompt for: %s", promptVariableName)
-		if customPrompt.VarType == "bool" {
-			input, err := RunBoolPrompt(customPrompt, Stdin, Stdout)
+		log.Debugf("constructing prompt for: %s", variable.Name)
+		if variable.Type == "bool" {
+			input, err := RunBoolPrompt(variable, Stdin, Stdout)
 			if err != nil {
 				return nil, err
 			}
-			inputs[promptVariableName] = input
+			inputs[variable.Name] = input
 		} else {
-			defaultValue := GetVariableDefaultValue(promptVariableName, config.VariableDefaults, inputs)
+			defaultValue := GetVariableDefaultValue(variable, inputs)
 
-			stringInput, err := RunDefaultableStringPrompt(customPrompt, defaultValue, nil, Stdin, Stdout)
+			stringInput, err := RunDefaultableStringPrompt(defaultValue, variable, nil, Stdin, Stdout)
 			if err != nil {
 				return nil, err
 			}
-			inputs[promptVariableName] = stringInput
-		}
-	}
-
-	// Substitute the default value for variables where the user didn't enter anything
-	for _, variableDefault := range config.VariableDefaults {
-		if inputs[variableDefault.Name] == "" {
-			inputs[variableDefault.Name] = variableDefault.Value
+			inputs[variable.Name] = stringInput
 		}
 	}
 
 	return inputs, nil
 }
 
-// GetVariableDefaultValue returns the default value for a variable, if one is set in variableDefaults from a ReferenceVar or literal VariableDefault.Value in that order.
-func GetVariableDefaultValue(variableName string, variableDefaults []config.BuilderVarDefault, inputs map[string]string) string {
+// GetVariableDefaultValue returns the default value for a variable, if one is set in variableDefaults from a ReferenceVar or literal Variable.DefaultValue in that order.
+func GetVariableDefaultValue(variable config.BuilderVar, inputs map[string]string) string {
 	defaultValue := ""
 
-	if variableName == "APPNAME" {
+	if variable.Name == "APPNAME" {
 		dirName, err := getCurrentDirNameFunc()
 		if err != nil {
 			log.Errorf("Error retrieving current directory name: %s", err)
@@ -98,26 +91,14 @@ func GetVariableDefaultValue(variableName string, variableDefaults []config.Buil
 		return defaultValue
 	}
 
-	for _, variableDefault := range variableDefaults {
-		if variableDefault.Name == variableName {
-			defaultValue = variableDefault.Value
-			log.Debugf("setting default value for %s to %s from variable default rule", variableName, defaultValue)
-			if variableDefault.ReferenceVar != "" && inputs[variableDefault.ReferenceVar] != "" {
-				defaultValue = inputs[variableDefault.ReferenceVar]
-				log.Debugf("setting default value for %s to %s from referenceVar %s", variableName, defaultValue, variableDefault.ReferenceVar)
-			}
-		}
+	defaultValue = variable.Default.Value
+	log.Debugf("setting default value for %s to %s from variable default rule", variable.Name, defaultValue)
+	if variable.Default.ReferenceVar != "" && inputs[variable.Default.ReferenceVar] != "" {
+		defaultValue = inputs[variable.Default.ReferenceVar]
+		log.Debugf("setting default value for %s to %s from referenceVar %s", variable.Name, defaultValue, variable.Default.ReferenceVar)
 	}
-	return defaultValue
-}
 
-func GetIsPromptDisabled(variableName string, variableDefaults []config.BuilderVarDefault) bool {
-	for _, variableDefault := range variableDefaults {
-		if variableDefault.Name == variableName {
-			return variableDefault.IsPromptDisabled
-		}
-	}
-	return false
+	return defaultValue
 }
 
 func RunBoolPrompt(customPrompt config.BuilderVar, Stdin io.ReadCloser, Stdout io.WriteCloser) (string, error) {
@@ -176,7 +157,7 @@ func appNameValidator(name string) error {
 }
 
 // RunDefaultableStringPrompt runs a prompt for a string variable, returning the user string input for the prompt
-func RunDefaultableStringPrompt(customPrompt config.BuilderVar, defaultValue string, validate func(string) error, Stdin io.ReadCloser, Stdout io.WriteCloser) (string, error) {
+func RunDefaultableStringPrompt(defaultValue string, customPrompt config.BuilderVar, validate func(string) error, Stdin io.ReadCloser, Stdout io.WriteCloser) (string, error) {
 	if validate == nil {
 		validate = NoBlankStringValidator
 	}
diff --git a/template/addons/azure/webapp_routing/draft.yaml b/template/addons/azure/webapp_routing/draft.yaml
index 3736157..0e5e9dc 100644
--- a/template/addons/azure/webapp_routing/draft.yaml
+++ b/template/addons/azure/webapp_routing/draft.yaml
@@ -7,11 +7,10 @@ variables:
   - name: "ingress-host"
     description: "specify the host of the ingress resource"
   - name: "GENERATORLABEL"
+    default: 
+      disablePrompt: true
+      value: "draft"
     description: "the label to identify who generated the resource"
-variableDefaults:
-  - name: "GENERATORLABEL"
-    value: "draft"
-    disablePrompt: true
 references:
   service:
     - name: "service-name"
diff --git a/template/deployments/helm/draft.yaml b/template/deployments/helm/draft.yaml
index fe569d5..7faf524 100644
--- a/template/deployments/helm/draft.yaml
+++ b/template/deployments/helm/draft.yaml
@@ -1,30 +1,29 @@
 variables:
   - name: "PORT"
+    default: 
+      value: 80
     description: "the port exposed in the application"
   - name: "APPNAME"
     description: "the name of the application"
   - name: "SERVICEPORT"
+    default:
+      referenceVar: "PORT"
     description: "the port the service uses to make the application accessible from outside the cluster"
   - name: "NAMESPACE"
+    default: 
+      value: default
     description: " the namespace to place new resources in"
   - name: "IMAGENAME"
+    default:
+      referenceVar: "APPNAME"
     description: "the name of the image to use in the deployment"
   - name: "IMAGETAG"
+    default: 
+      disablePrompt: true
+      value: "latest"
     description: "the tag of the image to use in the deployment"
   - name: "GENERATORLABEL"
-    description: "the label to identify who generated the resource"
-variableDefaults:
-  - name: "PORT"
-    value: 80
-  - name: "SERVICEPORT"
-    referenceVar: "PORT"
-  - name: "NAMESPACE"
-    value: default
-  - name: "IMAGENAME"
-    referenceVar: "APPNAME"
-  - name: "IMAGETAG"
-    value: "latest"
-    disablePrompt: true
-  - name: "GENERATORLABEL"
-    value: "draft"
-    disablePrompt: true
+    default: 
+      disablePrompt: true 
+      value: "draft"
+    description: "the label to identify who generated the resource"
\ No newline at end of file
diff --git a/template/deployments/kustomize/draft.yaml b/template/deployments/kustomize/draft.yaml
index 487550d..6b27b23 100644
--- a/template/deployments/kustomize/draft.yaml
+++ b/template/deployments/kustomize/draft.yaml
@@ -1,30 +1,29 @@
 variables:
   - name: "PORT"
+    default: 
+      value: 80
     description: "the port exposed in the application"
   - name: "APPNAME"
     description: "the name of the application"
   - name: "SERVICEPORT"
+    default:
+      referenceVar: "PORT"
     description: "the port the service uses to make the application accessible from outside the cluster"
   - name: "NAMESPACE"
+    default: 
+      value: default
     description: " the namespace to place new resources in"
   - name: "IMAGENAME"
+    default:
+      referenceVar: "APPNAME"
     description: "the name of the image to use in the deployment"
   - name: "IMAGETAG"
+    default:
+      disablePrompt: true 
+      value: "latest"
     description: "the tag of the image to use in the deployment"
   - name: "GENERATORLABEL"
-    description: "the label to identify who generated the resource"
-variableDefaults:
-  - name: "PORT"
-    value: 80
-  - name: "SERVICEPORT"
-    referenceVar: "PORT"
-  - name: "NAMESPACE"
-    value: default
-  - name: "IMAGENAME"
-    referenceVar: "APPNAME"
-  - name: "IMAGETAG"
-    value: "latest"
-    disablePrompt: true
-  - name: "GENERATORLABEL"
-    value: "draft"
-    disablePrompt: true
\ No newline at end of file
+    default: 
+      disablePrompt: true
+      value: "draft"
+    description: "the label to identify who generated the resource"
\ No newline at end of file
diff --git a/template/deployments/manifests/draft.yaml b/template/deployments/manifests/draft.yaml
index 487550d..d1843f4 100644
--- a/template/deployments/manifests/draft.yaml
+++ b/template/deployments/manifests/draft.yaml
@@ -1,30 +1,29 @@
 variables:
   - name: "PORT"
+    default: 
+      value: 80
     description: "the port exposed in the application"
   - name: "APPNAME"
     description: "the name of the application"
   - name: "SERVICEPORT"
+    default:
+      referenceVar: "PORT"
     description: "the port the service uses to make the application accessible from outside the cluster"
   - name: "NAMESPACE"
+    default: 
+      value: default
     description: " the namespace to place new resources in"
   - name: "IMAGENAME"
+    default:
+      referenceVar: "APPNAME"
     description: "the name of the image to use in the deployment"
   - name: "IMAGETAG"
+    default: 
+      disablePrompt: true
+      value: "latest"
     description: "the tag of the image to use in the deployment"
   - name: "GENERATORLABEL"
-    description: "the label to identify who generated the resource"
-variableDefaults:
-  - name: "PORT"
-    value: 80
-  - name: "SERVICEPORT"
-    referenceVar: "PORT"
-  - name: "NAMESPACE"
-    value: default
-  - name: "IMAGENAME"
-    referenceVar: "APPNAME"
-  - name: "IMAGETAG"
-    value: "latest"
-    disablePrompt: true
-  - name: "GENERATORLABEL"
-    value: "draft"
-    disablePrompt: true
\ No newline at end of file
+    default: 
+      disablePrompt: true
+      value: "draft"
+    description: "the label to identify who generated the resource"
\ No newline at end of file
diff --git a/template/dockerfiles/clojure/draft.yaml b/template/dockerfiles/clojure/draft.yaml
index d5a0b05..68972ec 100644
--- a/template/dockerfiles/clojure/draft.yaml
+++ b/template/dockerfiles/clojure/draft.yaml
@@ -2,13 +2,12 @@ language: clojure
 displayName: Clojure
 variables:
   - name: "PORT"
+    default: 
+      value: "80"
     description: "the port exposed in the application"
     type: int
   - name: "VERSION"
+    default: 
+      value: "8-jdk-alpine"
     description: "the version of openjdk that the application uses"
-    exampleValues: ["8-jdk-alpine","11-jdk-alpine","17-jdk-alpine","19-jdk-alpine"]
-variableDefaults:
-  - name: "VERSION"
-    value: "8-jdk-alpine"
-  - name: "PORT"
-    value: "80"
\ No newline at end of file
+    exampleValues: ["8-jdk-alpine","11-jdk-alpine","17-jdk-alpine","19-jdk-alpine"]
\ No newline at end of file
diff --git a/template/dockerfiles/csharp/draft.yaml b/template/dockerfiles/csharp/draft.yaml
index 4f0cccd..4b2e667 100644
--- a/template/dockerfiles/csharp/draft.yaml
+++ b/template/dockerfiles/csharp/draft.yaml
@@ -2,14 +2,13 @@ language: csharp
 displayName: C#
 variables:
   - name: "PORT"
+    default: 
+      value: "80"
     description: "the port exposed in the application"
     type: int
   - name: "VERSION"
+    default: 
+      value: "5.0"
     description: "the dotnet SDK version"
     type: float
-    exampleValues: ["3.1","4.0","5.0","6.0"]
-variableDefaults:
-  - name: "VERSION"
-    value: "5.0"
-  - name: "PORT"
-    value: "80"
\ No newline at end of file
+    exampleValues: ["3.1","4.0","5.0","6.0"]
\ No newline at end of file
diff --git a/template/dockerfiles/erlang/draft.yaml b/template/dockerfiles/erlang/draft.yaml
index d117a68..4263f4d 100644
--- a/template/dockerfiles/erlang/draft.yaml
+++ b/template/dockerfiles/erlang/draft.yaml
@@ -5,18 +5,18 @@ nameOverrides:
     prefix: "."
 variables:
   - name: "PORT"
+    default: 
+      value: "80"
     description: "the port exposed in the application"
     type: int
   - name: "BUILDERVERSION"
+    default: 
+      value: "24.2-alpine"
     description: "the version of erlang used during the builder stage to generate the executable"
     exampleValues: ["24.2-alpine"]
   - name: "VERSION"
+    default: 
+      value: "3.15"
     description: "the version of alpine used by the application"
     exampleValues: ["3.15"]
-variableDefaults:
-  - name: "BUILDERVERSION"
-    value: "24.2-alpine"
-  - name: "VERSION"
-    value: "3.15"
-  - name: "PORT"
-    value: "80"
\ No newline at end of file
+    
\ No newline at end of file
diff --git a/template/dockerfiles/go/draft.yaml b/template/dockerfiles/go/draft.yaml
index fc6948c..525320b 100644
--- a/template/dockerfiles/go/draft.yaml
+++ b/template/dockerfiles/go/draft.yaml
@@ -5,13 +5,12 @@ nameOverrides:
     prefix: "."
 variables:
   - name: "PORT"
+    default: 
+      value: "80"
     description: "the port exposed in the application"
     type: int
   - name: "VERSION"
+    default: 
+      value: "1.18"
     description: "the version of go used by the application"
-    exampleValues: ["1.16", "1.17", "1.18", "1.19"]
-variableDefaults:
-  - name: "VERSION"
-    value: "1.18"
-  - name: "PORT"
-    value: "80"
\ No newline at end of file
+    exampleValues: ["1.16", "1.17", "1.18", "1.19"]
\ No newline at end of file
diff --git a/template/dockerfiles/gomodule/draft.yaml b/template/dockerfiles/gomodule/draft.yaml
index 9477a52..5c8d129 100644
--- a/template/dockerfiles/gomodule/draft.yaml
+++ b/template/dockerfiles/gomodule/draft.yaml
@@ -5,13 +5,12 @@ nameOverrides:
     prefix: "."
 variables:
   - name: "PORT"
+    default: 
+      value: "80"
     description: "the port exposed in the application"
-    type: int
+    type: int  
   - name: "VERSION"
+    default: 
+      value: "1.18"
     description: "the version of go used by the application"
-    exampleValues: ["1.16", "1.17", "1.18", "1.19"]
-variableDefaults:
-  - name: "VERSION"
-    value: "1.18"
-  - name: "PORT"
-    value: "80"
\ No newline at end of file
+    exampleValues: ["1.16", "1.17", "1.18", "1.19"]
\ No newline at end of file
diff --git a/template/dockerfiles/gradle/draft.yaml b/template/dockerfiles/gradle/draft.yaml
index 166f1dc..c031c8d 100644
--- a/template/dockerfiles/gradle/draft.yaml
+++ b/template/dockerfiles/gradle/draft.yaml
@@ -5,18 +5,17 @@ nameOverrides:
     prefix: "."
 variables:
   - name: "PORT"
+    default: 
+      value: "80"
     description: "the port exposed in the application"
     type: int
   - name: "BUILDERVERSION"
+    default: 
+      value: "jdk21"
     description: "the version of gradle used during the builder stage to generate the executable"
     exampleValues: ["jdk8","jdk11","jdk17","jdk19","jdk21"]
   - name: "VERSION"
+    default: 
+      value: "21-jre"
     description: "the java version used by the application"
-    exampleValues: ["11-jre","17-jre","19-jre","21-jre"]
-variableDefaults:
-  - name: "BUILDERVERSION"
-    value: "jdk21"
-  - name: "VERSION"
-    value: "21-jre"
-  - name: "PORT"
-    value: "80"
\ No newline at end of file
+    exampleValues: ["11-jre","17-jre","19-jre","21-jre"]
\ No newline at end of file
diff --git a/template/dockerfiles/gradlew/draft.yaml b/template/dockerfiles/gradlew/draft.yaml
index 166f1dc..c031c8d 100644
--- a/template/dockerfiles/gradlew/draft.yaml
+++ b/template/dockerfiles/gradlew/draft.yaml
@@ -5,18 +5,17 @@ nameOverrides:
     prefix: "."
 variables:
   - name: "PORT"
+    default: 
+      value: "80"
     description: "the port exposed in the application"
     type: int
   - name: "BUILDERVERSION"
+    default: 
+      value: "jdk21"
     description: "the version of gradle used during the builder stage to generate the executable"
     exampleValues: ["jdk8","jdk11","jdk17","jdk19","jdk21"]
   - name: "VERSION"
+    default: 
+      value: "21-jre"
     description: "the java version used by the application"
-    exampleValues: ["11-jre","17-jre","19-jre","21-jre"]
-variableDefaults:
-  - name: "BUILDERVERSION"
-    value: "jdk21"
-  - name: "VERSION"
-    value: "21-jre"
-  - name: "PORT"
-    value: "80"
\ No newline at end of file
+    exampleValues: ["11-jre","17-jre","19-jre","21-jre"]
\ No newline at end of file
diff --git a/template/dockerfiles/java/draft.yaml b/template/dockerfiles/java/draft.yaml
index 0df09bc..e551285 100644
--- a/template/dockerfiles/java/draft.yaml
+++ b/template/dockerfiles/java/draft.yaml
@@ -5,18 +5,17 @@ nameOverrides:
     prefix: "."
 variables:
   - name: "PORT"
+    default: 
+      value: "80"
     description: "the port exposed in the application"
     type: int
   - name: "BUILDERVERSION"
+    default: 
+      value: "3"
     description: "the version of maven used during the builder stage to generate the executable"
     exampleValues: ["3-eclipse-temurin-11", "3-eclipse-temurin-17", "3-eclipse-temurin-21", "3 (jdk-21)"]
   - name: "VERSION"
+    default: 
+      value: "21-jre"
     description: "the java version used by the application"
-    exampleValues: ["11-jre","17-jre","19-jre","21-jre"]
-variableDefaults:
-  - name: "BUILDERVERSION"
-    value: "3"
-  - name: "VERSION"
-    value: "21-jre"
-  - name: "PORT"
-    value: "80"
\ No newline at end of file
+    exampleValues: ["11-jre","17-jre","19-jre","21-jre"]
\ No newline at end of file
diff --git a/template/dockerfiles/javascript/draft.yaml b/template/dockerfiles/javascript/draft.yaml
index fc9bd44..4daa6cc 100644
--- a/template/dockerfiles/javascript/draft.yaml
+++ b/template/dockerfiles/javascript/draft.yaml
@@ -5,13 +5,12 @@ nameOverrides:
     prefix: "."
 variables:
   - name: "PORT"
+    default: 
+      value: "80"
     description: "the port exposed in the application"
     type: int
   - name: "VERSION"
+    default: 
+      value: "14"
     description: "the version of node used in the application"
-    exampleValues: ["10.16.3", "12.16.3", "14.15.4"]
-variableDefaults:
-  - name: "VERSION"
-    value: "14"
-  - name: "PORT"
-    value: "80"
\ No newline at end of file
+    exampleValues: ["10.16.3", "12.16.3", "14.15.4"]
\ No newline at end of file
diff --git a/template/dockerfiles/php/draft.yaml b/template/dockerfiles/php/draft.yaml
index d72f2e0..6d8cd45 100644
--- a/template/dockerfiles/php/draft.yaml
+++ b/template/dockerfiles/php/draft.yaml
@@ -5,18 +5,17 @@ nameOverrides:
     prefix: "."
 variables:
   - name: "PORT"
+    default: 
+      value: "80"
     description: "the port exposed in the application"
     type: int
   - name: "BUILDERVERSION"
+    default: 
+      value: "1"
     description: "the version of composer installed during the build stage to be used by the application"
     exampleValues: ["1"]
   - name: "VERSION"
+    default: 
+      value: "7.1-apache"
     description: "the version of php used by the application"
-    exampleValues: ["7.1-apache"]
-variableDefaults:
-  - name: "BUILDERVERSION"
-    value: "1"
-  - name: "VERSION"
-    value: "7.1-apache"
-  - name: "PORT"
-    value: "80"
\ No newline at end of file
+    exampleValues: ["7.1-apache"]
\ No newline at end of file
diff --git a/template/dockerfiles/python/draft.yaml b/template/dockerfiles/python/draft.yaml
index 7d361ed..1eb8360 100644
--- a/template/dockerfiles/python/draft.yaml
+++ b/template/dockerfiles/python/draft.yaml
@@ -5,19 +5,18 @@ nameOverrides:
     prefix: "."
 variables:
   - name: "PORT"
+    default: 
+      value: "80"
     description: "the port exposed in the application"
     type: int
   - name: "VERSION"
+    default: 
+      value: "3"
     description: "the version of python used by the application"
     exampleValues: ["3.9", "3.8", "3.7", "3.6"]
   - name: "ENTRYPOINT"
+    default: 
+      value: "app.py"
     description: "the entrypoint file of the repository"
     type: string
-    exampleValues: ["app.py", "main.py"]
-variableDefaults:
-  - name: "VERSION"
-    value: "3"
-  - name: "PORT"
-    value: "80"
-  - name: "ENTRYPOINT"
-    value: "app.py"
+    exampleValues: ["app.py", "main.py"]
\ No newline at end of file
diff --git a/template/dockerfiles/ruby/draft.yaml b/template/dockerfiles/ruby/draft.yaml
index dd2ee4d..91bf2eb 100644
--- a/template/dockerfiles/ruby/draft.yaml
+++ b/template/dockerfiles/ruby/draft.yaml
@@ -5,13 +5,12 @@ nameOverrides:
     prefix: "."
 variables:
   - name: "PORT"
+    default: 
+      value: "80"
     description: "the port exposed in the application"
     type: int
   - name: "VERSION"
+    default: 
+      value: "3.1.2"
     description: "the version of ruby used by the application"
-    exampleValues: ["3.1.2", "2.6", "2.5", "2.4"]
-variableDefaults:
-  - name: "VERSION"
-    value: "3.1.2"
-  - name: "PORT"
-    value: "80"
\ No newline at end of file
+    exampleValues: ["3.1.2", "2.6", "2.5", "2.4"] 
\ No newline at end of file
diff --git a/template/dockerfiles/rust/draft.yaml b/template/dockerfiles/rust/draft.yaml
index 00848d0..bf526b4 100644
--- a/template/dockerfiles/rust/draft.yaml
+++ b/template/dockerfiles/rust/draft.yaml
@@ -5,13 +5,12 @@ nameOverrides:
     prefix: "."
 variables:
   - name: "PORT"
+    default: 
+      value: "80"
     description: "the port exposed in the application"
     type: int
   - name: "VERSION"
+    default: 
+      value: "1.70.0"
     description: "the version of rust used by the application"
-    exampleValues: ["1.70.0","1.65.0", "1.60", "1.54", "1.53"]
-variableDefaults:
-  - name: "VERSION"
-    value: "1.70.0"
-  - name: "PORT"
-    value: "80"
+    exampleValues: ["1.70.0","1.65.0", "1.60", "1.54", "1.53"]
\ No newline at end of file
diff --git a/template/dockerfiles/swift/draft.yaml b/template/dockerfiles/swift/draft.yaml
index 1780f68..bf0191b 100644
--- a/template/dockerfiles/swift/draft.yaml
+++ b/template/dockerfiles/swift/draft.yaml
@@ -5,13 +5,12 @@ nameOverrides:
     prefix: "."
 variables:
   - name: "PORT"
+    default: 
+      value: "80"
     description: "the port exposed in the application"
     type: int
   - name: "VERSION"
+    default: 
+      value: "5.5"
     description: "the version of swift used by the application"
-    exampleValues: ["5.2","5.5"]
-variableDefaults:
-  - name: "VERSION"
-    value: "5.5"
-  - name: "PORT"
-    value: "80"
\ No newline at end of file
+    exampleValues: ["5.2","5.5"]
\ No newline at end of file
diff --git a/template/workflows/helm/.github/workflows/azure-kubernetes-service-helm.yml b/template/workflows/helm/.github/workflows/azure-kubernetes-service-helm.yml
index 9361326..8b1cf1f 100644
--- a/template/workflows/helm/.github/workflows/azure-kubernetes-service-helm.yml
+++ b/template/workflows/helm/.github/workflows/azure-kubernetes-service-helm.yml
@@ -40,14 +40,14 @@ on:
   workflow_dispatch:
 
 env:
+  RESOURCE_GROUP: {{RESOURCEGROUP}}
   AZURE_CONTAINER_REGISTRY: {{AZURECONTAINERREGISTRY}}
   CONTAINER_NAME: {{CONTAINERNAME}}
-  RESOURCE_GROUP: {{RESOURCEGROUP}}
   CLUSTER_NAME: {{CLUSTERNAME}}
+  BUILD_CONTEXT_PATH: {{BUILDCONTEXTPATH}}
   CHART_PATH: {{CHARTPATH}}
   CHART_OVERRIDE_PATH: {{CHARTOVERRIDEPATH}}
-  BUILD_CONTEXT_PATH: {{BUILDCONTEXTPATH}}
-
+  
 jobs:
   buildImage:
     permissions:
@@ -123,4 +123,4 @@ jobs:
           action: deploy
           manifests: ${{ steps.bake.outputs.manifestsBundle }}
           images: |
-            ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }}
+            ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }}
\ No newline at end of file
diff --git a/template/workflows/helm/draft.yaml b/template/workflows/helm/draft.yaml
index 7bb3aec..259275f 100644
--- a/template/workflows/helm/draft.yaml
+++ b/template/workflows/helm/draft.yaml
@@ -1,22 +1,26 @@
 variables:
+  - name: "BRANCHNAME"
+    description: "the Github branch to automatically deploy from"
+  - name: "RESOURCEGROUP"
+    description: "the ACR resource group"
   - name: "AZURECONTAINERREGISTRY"
     description: "the Azure container registry name"
   - name: "CONTAINERNAME"
     description: "the container image name"
-  - name: "RESOURCEGROUP"
-    description: "the Azure resource group of your AKS cluster"
   - name: "CLUSTERNAME"
     description: "the AKS cluster name"
-  - name: "BRANCHNAME"
-    description: "the Github branch to automatically deploy from"
   - name: "BUILDCONTEXTPATH"
+    default:
+      value: "."
     description: "the path to the Docker build context"
-variableDefaults:
   - name: "CHARTPATH"
-    value: "./charts"
-    disablePrompt: true
+    default: 
+      disablePrompt: true
+      value: "./charts"
+    description: "the path to the Helm chart"
   - name: "CHARTOVERRIDEPATH"
-    value: "./charts/production.yaml"
-    disablePrompt: true
-  - name: "BUILDCONTEXTPATH"
-    value: "."
\ No newline at end of file
+    default: 
+      disablePrompt: true
+      value: "./charts/production.yaml"
+    description: "the path to the Helm chart override file"
+  
\ No newline at end of file
diff --git a/template/workflows/kustomize/.github/workflows/azure-kubernetes-service-kustomize.yml b/template/workflows/kustomize/.github/workflows/azure-kubernetes-service-kustomize.yml
index 839ad95..8b49876 100644
--- a/template/workflows/kustomize/.github/workflows/azure-kubernetes-service-kustomize.yml
+++ b/template/workflows/kustomize/.github/workflows/azure-kubernetes-service-kustomize.yml
@@ -39,9 +39,9 @@ on:
   workflow_dispatch:
 
 env:
+  RESOURCE_GROUP: {{RESOURCEGROUP}}
   AZURE_CONTAINER_REGISTRY: {{AZURECONTAINERREGISTRY}}
   CONTAINER_NAME: {{CONTAINERNAME}}
-  RESOURCE_GROUP: {{RESOURCEGROUP}}
   CLUSTER_NAME: {{CLUSTERNAME}}
   KUSTOMIZE_PATH: {{KUSTOMIZEPATH}}
   BUILD_CONTEXT_PATH: {{BUILDCONTEXTPATH}}
@@ -118,4 +118,4 @@ jobs:
           action: deploy
           manifests: ${{ steps.bake.outputs.manifestsBundle }}
           images: |
-            ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }}
+            ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }}
\ No newline at end of file
diff --git a/template/workflows/kustomize/draft.yaml b/template/workflows/kustomize/draft.yaml
index f763eff..01df153 100644
--- a/template/workflows/kustomize/draft.yaml
+++ b/template/workflows/kustomize/draft.yaml
@@ -1,19 +1,20 @@
 variables:
+  - name: "BRANCHNAME"
+    description: "the Github branch to automatically deploy from"
+  - name: "RESOURCEGROUP"
+    description: "the ACR resource group"
   - name: "AZURECONTAINERREGISTRY"
     description: "the Azure container registry name"
   - name: "CONTAINERNAME"
     description: "the container image name"
-  - name: "RESOURCEGROUP"
-    description: "the Azure resource group of your AKS cluster"
   - name: "CLUSTERNAME"
     description: "the AKS cluster name"
-  - name: "BRANCHNAME"
-    description: "the Github branch to automatically deploy from"
-  - name: "BUILDCONTEXTPATH"
-    description: "the path to the Docker build context"
-variableDefaults:
   - name: "KUSTOMIZEPATH"
-    value: "./overlays/production"
-    disablePrompt: true
+    default: 
+      disablePrompt: true
+      value: "./overlays/production"
+    description: "the path to the Kustomize directory"
   - name: "BUILDCONTEXTPATH"
-    value: "."
+    default: 
+      value: "."
+    description: "the path to the Docker build context"
\ No newline at end of file
diff --git a/template/workflows/manifests/.github/workflows/azure-kubernetes-service.yml b/template/workflows/manifests/.github/workflows/azure-kubernetes-service.yml
index 4528cfd..ca1b83c 100644
--- a/template/workflows/manifests/.github/workflows/azure-kubernetes-service.yml
+++ b/template/workflows/manifests/.github/workflows/azure-kubernetes-service.yml
@@ -35,9 +35,9 @@ on:
   workflow_dispatch:
 
 env:
+  RESOURCE_GROUP: {{RESOURCEGROUP}}
   AZURE_CONTAINER_REGISTRY: {{AZURECONTAINERREGISTRY}}
   CONTAINER_NAME: {{CONTAINERNAME}}
-  RESOURCE_GROUP: {{RESOURCEGROUP}}
   CLUSTER_NAME: {{CLUSTERNAME}}
   DEPLOYMENT_MANIFEST_PATH: {{DEPLOYMENTMANIFESTPATH}}
   BUILD_CONTEXT_PATH: {{BUILDCONTEXTPATH}}
@@ -106,3 +106,4 @@ jobs:
           manifests: ${{ env.DEPLOYMENT_MANIFEST_PATH }}
           images: |
             ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }}
+          
\ No newline at end of file
diff --git a/template/workflows/manifests/draft.yaml b/template/workflows/manifests/draft.yaml
index a51756a..beb109c 100644
--- a/template/workflows/manifests/draft.yaml
+++ b/template/workflows/manifests/draft.yaml
@@ -1,19 +1,20 @@
 variables:
+  - name: "BRANCHNAME"
+    description: "the Github branch to automatically deploy from"
+  - name: "RESOURCEGROUP"
+    description: "the ACR resource group"
   - name: "AZURECONTAINERREGISTRY"
     description: "the Azure container registry name"
   - name: "CONTAINERNAME"
     description: "the container image name"
-  - name: "RESOURCEGROUP"
-    description: "the Azure resource group of your AKS cluster"
   - name: "CLUSTERNAME"
     description: "the AKS cluster name"
-  - name: "BRANCHNAME"
-    description: "the Github branch to automatically deploy from"
-  - name: "BUILDCONTEXTPATH"
-    description: "the path to the Docker build context"
-variableDefaults:
   - name: "DEPLOYMENTMANIFESTPATH"
-    value: "./manifests"
-    disablePrompt: true
+    default: 
+      disablePrompt: true
+      value: "./manifests"
+    description: "the path to the Kubernetes deployment manifest"
   - name: "BUILDCONTEXTPATH"
-    value: "."
+    default: 
+      value: "."
+    description: "the path to the Docker build context"
\ No newline at end of file


Test patch:
diff --git a/cmd/create_test.go b/cmd/create_test.go
index 99c96f8..bfcff61 100644
--- a/cmd/create_test.go
+++ b/cmd/create_test.go
@@ -143,32 +143,39 @@ func TestInitConfig(t *testing.T) {
 
 func TestValidateConfigInputsToPromptsPass(t *testing.T) {
 	required := []config.BuilderVar{
-		{Name: "REQUIRED_PROVIDED"},
-		{Name: "REQUIRED_DEFAULTED"},
+		{
+			Name: "REQUIRED_PROVIDED",
+		},
+		{
+			Name: "REQUIRED_DEFAULTED",
+			Default: config.BuilderVarDefault{
+				Value: "DEFAULT_VALUE",
+			},
+		},
 	}
 	provided := []UserInputs{
 		{Name: "REQUIRED_PROVIDED", Value: "PROVIDED_VALUE"},
 	}
-	defaults := []config.BuilderVarDefault{
-		{Name: "REQUIRED_DEFAULTED", Value: "DEFAULT_VALUE"},
-	}
 
-	vars, err := validateConfigInputsToPrompts(required, provided, defaults)
+	vars, err := validateConfigInputsToPrompts(required, provided)
 	assert.True(t, err == nil)
 	assert.Equal(t, vars["REQUIRED_DEFAULTED"], "DEFAULT_VALUE")
 }
 
 func TestValidateConfigInputsToPromptsMissing(t *testing.T) {
 	required := []config.BuilderVar{
-		{Name: "REQUIRED_PROVIDED"},
-		{Name: "REQUIRED_MISSING"},
+		{
+			Name: "REQUIRED_PROVIDED",
+		},
+		{
+			Name: "REQUIRED_MISSING",
+		},
 	}
 	provided := []UserInputs{
 		{Name: "REQUIRED_PROVIDED"},
 	}
-	defaults := []config.BuilderVarDefault{}
 
-	_, err := validateConfigInputsToPrompts(required, provided, defaults)
+	_, err := validateConfigInputsToPrompts(required, provided)
 	assert.NotNil(t, err)
 }
 
diff --git a/pkg/prompts/prompts_test.go b/pkg/prompts/prompts_test.go
index fb89b29..ffc54d5 100644
--- a/pkg/prompts/prompts_test.go
+++ b/pkg/prompts/prompts_test.go
@@ -9,60 +9,71 @@ import (
 
 func TestGetVariableDefaultValue(t *testing.T) {
 	tests := []struct {
-		testName         string
-		variableName     string
-		variableDefaults []config.BuilderVarDefault
-		inputs           map[string]string
-		want             string
+		testName  string
+		variables []config.BuilderVar
+		inputs    map[string]string
+		want      string
 	}{
 		{
-			testName:     "basicLiteralExtractDefault",
-			variableName: "var1",
-			variableDefaults: []config.BuilderVarDefault{
+			testName: "basicLiteralExtractDefault",
+			variables: []config.BuilderVar{
 				{
-					Name:  "var1",
-					Value: "default-value-1",
+					Name: "var1",
+					Default: config.BuilderVarDefault{
+						Value: "default-value-1",
+					},
 				},
 				{
-					Name:  "var2",
-					Value: "default-value-2",
+					Name: "var2",
+					Default: config.BuilderVarDefault{
+						Value: "default-value-2",
+					},
 				},
 			},
 			inputs: map[string]string{},
 			want:   "default-value-1",
 		},
 		{
-			testName:         "noDefaultIsEmptyString",
-			variableName:     "var1",
-			variableDefaults: []config.BuilderVarDefault{},
-			inputs:           map[string]string{},
-			want:             "",
+			testName: "noDefaultIsEmptyString",
+			variables: []config.BuilderVar{
+				{
+					Name: "var1",
+				},
+			},
+			inputs: map[string]string{},
+			want:   "",
 		},
 		{
-			testName:     "referenceTakesPrecedenceOverLiteral",
-			variableName: "var1",
-			variableDefaults: []config.BuilderVarDefault{
+			testName: "referenceTakesPrecedenceOverLiteral",
+			variables: []config.BuilderVar{
 				{
-					Name:         "var1",
-					Value:        "not-this-value",
-					ReferenceVar: "var2",
+					Name: "var1",
+					Default: config.BuilderVarDefault{
+						ReferenceVar: "var2",
+						Value:        "not-this-value",
+					},
 				},
 			},
 			inputs: map[string]string{
 				"var2": "this-value",
 			},
 			want: "this-value",
-		}, {
-			testName:     "forwardReferencesAreIgnored",
-			variableName: "beforeVar",
-			variableDefaults: []config.BuilderVarDefault{
+		},
+		{
+			testName: "forwardReferencesAreIgnored",
+			variables: []config.BuilderVar{
 				{
-					Name:         "beforeVar",
-					Value:        "before-default-value",
-					ReferenceVar: "afterVar",
-				}, {
-					Name:  "afterVar",
-					Value: "not-this-value",
+					Name: "beforeVar",
+					Default: config.BuilderVarDefault{
+						ReferenceVar: "afterVar",
+						Value:        "before-default-value",
+					},
+				},
+				{
+					Name: "afterVar",
+					Default: config.BuilderVarDefault{
+						Value: "not-this-value",
+					},
 				},
 			},
 			inputs: map[string]string{},
@@ -71,7 +82,7 @@ func TestGetVariableDefaultValue(t *testing.T) {
 	}
 	for _, tt := range tests {
 		t.Run(tt.testName, func(t *testing.T) {
-			if got := GetVariableDefaultValue(tt.variableName, tt.variableDefaults, tt.inputs); got != tt.want {
+			if got := GetVariableDefaultValue(tt.variables[0], tt.inputs); got != tt.want {
 				t.Errorf("GetVariableDefaultValue() = %v, want %v", got, tt.want)
 			}
 		})
@@ -91,7 +102,6 @@ func TestRunStringPrompt(t *testing.T) {
 		{
 			testName: "basicPrompt",
 			prompt: config.BuilderVar{
-				Name:        "var1",
 				Description: "var1 description",
 			},
 			userInputs:       []string{"value-1\n"},
@@ -103,7 +113,6 @@ func TestRunStringPrompt(t *testing.T) {
 		{
 			testName: "promptWithDefault",
 			prompt: config.BuilderVar{
-				Name:        "var1",
 				Description: "var1 description",
 			},
 			userInputs:       []string{"\n"},
@@ -161,7 +170,7 @@ func TestRunStringPrompt(t *testing.T) {
 					t.Errorf("Error closing inWriter: %v", err)
 				}
 			}()
-			got, err := RunDefaultableStringPrompt(tt.prompt, tt.defaultValue, nil, inReader, nil)
+			got, err := RunDefaultableStringPrompt(tt.defaultValue, tt.prompt, nil, inReader, nil)
 
 			if (err != nil) != tt.wantErr {
 				t.Errorf("RunDefaultableStringPrompt() error = %v, wantErr %v", err, tt.wantErr)
@@ -188,17 +197,14 @@ func TestRunPromptsFromConfigWithSkipsIO(t *testing.T) {
 			config: config.DraftConfig{
 				Variables: []config.BuilderVar{
 					{
-						Name:        "var1",
+						Name: "var1",
+						Default: config.BuilderVarDefault{
+							IsPromptDisabled: true,
+							Value:            "defaultValue",
+						},
 						Description: "var1 description",
 					},
 				},
-				VariableDefaults: []config.BuilderVarDefault{
-					{
-						Name:             "var1",
-						Value:            "defaultValue",
-						IsPromptDisabled: true,
-					},
-				},
 			},
 			userInputs: []string{""},
 			want: map[string]string{
@@ -210,34 +216,34 @@ func TestRunPromptsFromConfigWithSkipsIO(t *testing.T) {
 			config: config.DraftConfig{
 				Variables: []config.BuilderVar{
 					{
-						Name:        "var1-no-prompt",
+						Name: "var1-no-prompt",
+						Default: config.BuilderVarDefault{
+							IsPromptDisabled: true,
+							Value:            "defaultValueNoPrompt1",
+						},
 						Description: "var1 has IsPromptDisabled and should skip prompt and use default value",
-					}, {
-						Name:        "var2-default",
+					},
+					{
+						Name: "var2-default",
+						Default: config.BuilderVarDefault{
+							Value: "defaultValue2",
+						},
 						Description: "var2 has a default value and will receive an empty value, so it should use the default value",
-					}, {
-						Name:        "var3-no-prompt",
+					},
+					{
+						Name: "var3-no-prompt",
+						Default: config.BuilderVarDefault{
+							IsPromptDisabled: true,
+							Value:            "defaultValueNoPrompt3",
+						},
 						Description: "var3 has IsPromptDisabled and should skip prompt and use default value",
-					}, {
-						Name:        "var4",
-						Description: "var4 has a default value, but has a value entered, so it should use the entered value",
 					},
-				},
-				VariableDefaults: []config.BuilderVarDefault{
 					{
-						Name:             "var1-no-prompt",
-						Value:            "defaultValueNoPrompt1",
-						IsPromptDisabled: true,
-					}, {
-						Name:  "var2-default",
-						Value: "defaultValue2",
-					}, {
-						Name:             "var3-no-prompt",
-						Value:            "defaultValueNoPrompt3",
-						IsPromptDisabled: true,
-					}, {
-						Name:  "var4",
-						Value: "defaultValue4",
+						Name: "var4",
+						Default: config.BuilderVarDefault{
+							Value: "defaultValue4",
+						},
+						Description: "var4 has a default value, but has a value entered, so it should use the entered value",
 					},
 				},
 			},