From acf12fba79272e5336e136840c2ff6da5a8ac601 Mon Sep 17 00:00:00 2001 From: domenicsim1 Date: Thu, 5 Dec 2024 09:32:45 +1100 Subject: [PATCH] fix: Same variable with a different scope now gets an ID --- octopusdeploy_framework/resource_variable.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/octopusdeploy_framework/resource_variable.go b/octopusdeploy_framework/resource_variable.go index d2876380..9010ced7 100644 --- a/octopusdeploy_framework/resource_variable.go +++ b/octopusdeploy_framework/resource_variable.go @@ -267,13 +267,14 @@ func validateVariable(variableSet *variables.VariableSet, newVariable *variables for _, v := range variableSet.Variables { if v.Name == newVariable.Name && v.Type == newVariable.Type && (v.IsSensitive || v.Value == newVariable.Value) && v.Description == newVariable.Description && v.IsSensitive == newVariable.IsSensitive { scopeMatches, _, err := variables.MatchesScope(v.Scope, &newVariable.Scope) - if err != nil || !scopeMatches { + if err != nil { return err } - if scopeMatches { - newVariable.ID = v.GetID() - return nil + if !scopeMatches { + continue } + newVariable.ID = v.GetID() + return nil } }