You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary: "Can't change variable when applying a saved plan",
350
-
Detail: fmt.Sprintf("The variable %s cannot be set using the -var and -var-file options when applying a saved plan file, because a saved plan includes the variable values that were set when it was created. The saved plan specifies %s as the value whereas during apply the value %s was %s. To declare an ephemeral variable which is not saved in the plan file, use ephemeral = true.", varName, tfdiags.CompactValueStr(parsedVar.Value), tfdiags.CompactValueStr(plannedVar), parsedVar.SourceType.DiagnosticLabel()),
351
-
Subject: rng,
352
-
})
343
+
// error when possible to avoid confusion.
344
+
ifparsedVar.Value.Equals(plannedVar).False() {
345
+
switchparsedVar.SourceType {
346
+
caseterraform.ValueFromAutoFile:
347
+
// If the parsed variables comes from an auto-file,
348
+
// it's not input directly by the user so we have to ignore it.
349
+
continue
350
+
caseterraform.ValueFromEnvVar:
351
+
diags=diags.Append(&hcl.Diagnostic{
352
+
Severity: hcl.DiagWarning,
353
+
Summary: "Ignoring variable when applying a saved plan",
354
+
Detail: fmt.Sprintf("The variable %s cannot be overriden when applying a saved plan file, "+
355
+
"because a saved plan includes the variable values that were set when it was created. "+
356
+
"The saved plan specifies %s as the value whereas during apply the value %s was %s. "+
357
+
"To declare an ephemeral variable which is not saved in the plan file, use ephemeral = true.",
0 commit comments