Skip to content

Commit 13ab872

Browse files
committed
overrideOptionsFromExtraEnv: skip unknown keys in extraEnv earlier
1 parent 06127ae commit 13ab872

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

internal/provider/helpers.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ func overrideOptionsFromExtraEnv(opts *eboptions.Options, extraEnv map[string]st
164164
optsMap[opt.Env] = opt.Value
165165
}
166166
for key, val := range extraEnv {
167+
opt, found := optsMap[key]
168+
if !found {
169+
// ignore unknown keys
170+
continue
171+
}
172+
167173
if _, found := nonOverrideOptions[key]; found {
168174
diags.AddAttributeWarning(path.Root("extra_env"),
169175
"Cannot override required environment variable",
@@ -186,12 +192,6 @@ func overrideOptionsFromExtraEnv(opts *eboptions.Options, extraEnv map[string]st
186192
_ = optsMap[key].Set("")
187193
}
188194

189-
opt, found := optsMap[key]
190-
if !found {
191-
// ignore unknown keys
192-
continue
193-
}
194-
195195
if err := opt.Set(val); err != nil {
196196
diags.AddAttributeError(path.Root("extra_env"),
197197
"Invalid value for environment variable",

0 commit comments

Comments
 (0)