Skip to content

Commit

Permalink
cli: make location field optional
Browse files Browse the repository at this point in the history
  • Loading branch information
msanft committed Dec 14, 2023
1 parent 240b9f6 commit 8e54791
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cli/internal/cloudcmd/tfvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TerraformIAMUpgradeVars(conf *config.Config, fileHandler file.Handler) (ter
return nil, fmt.Errorf("parsing existing IAM workspace: %w", err)
}

// Migration from the "region" to the "location" field name.
// Migration from the "region" to the "location" field na.
// TODO(msanft): Remove after v2.14.0 is released.
if oldVars.Region != nil && *oldVars.Region != "" && oldVars.Location == "" {
oldVars.Location = *oldVars.Region
Expand Down
9 changes: 5 additions & 4 deletions cli/internal/terraform/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ func VariablesFromBytes[T any](b []byte, vars *T) error {
return fmt.Errorf("parsing variables: %w", err)
}

if err := gohcl.DecodeBody(file.Body, nil, vars); err != nil {
return fmt.Errorf("decoding variables: %w", err)
diags := gohcl.DecodeBody(file.Body, nil, vars)
if diags.HasErrors() {
return fmt.Errorf("decoding variables: %w", diags)
}
return nil
}
Expand Down Expand Up @@ -246,9 +247,9 @@ type AzureNodeGroup struct {
type AzureIAMVariables struct {
// Region is the Azure location to use. (e.g. westus).
// THIS FIELD IS DEPRECATED AND ONLY KEPT FOR MIGRATION PURPOSES. DO NOT USE.
Region *string `hcl:"region" cty:"region"`
Region *string `hcl:"region" cty:"region"` // TODO(msanft): Remove this field once v2.14.0 is released.
// Location is the Azure location to use. (e.g. westus)
Location string `hcl:"location" cty:"location"`
Location string `hcl:"location,optional" cty:"location"` // TODO(msanft): Make this required once v2.14.0 is released.
// ServicePrincipal is the name of the service principal to use.
ServicePrincipal string `hcl:"service_principal_name" cty:"service_principal_name"`
// ResourceGroup is the name of the resource group to use.
Expand Down

0 comments on commit 8e54791

Please sign in to comment.