Summary:"Can't change variable when applying a saved plan",
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()),
Subject:rng,
})
// error when possible to avoid confusion.
ifparsedVar.Value.Equals(plannedVar).False(){
switchparsedVar.SourceType{
caseterraform.ValueFromAutoFile:
// If the parsed variables comes from an auto-file,
// it's not input directly by the user so we have to ignore it.
continue
caseterraform.ValueFromEnvVar:
diags=diags.Append(&hcl.Diagnostic{
Severity:hcl.DiagWarning,
Summary:"Ignoring variable when applying a saved plan",
Detail:fmt.Sprintf("The variable %s cannot be overriden 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.",