-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
show deprecation warning if -state is used with plan, apply, refresh #35660
Changes from 2 commits
80b184e
10c07f3
b379120
bfa66b4
4912455
3a7075f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,9 @@ func ParseApply(args []string) (*Apply, tfdiags.Diagnostics) { | |
} | ||
|
||
cmdFlags := extendedFlagSet("apply", apply.State, apply.Operation, apply.Vars) | ||
if apply.State != nil { | ||
diags = append(diags, tfdiags.SimpleWarning("state is deprecated")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'd be nice if this error message could present an alternative instead. The correct thing to do is update the configuration to point to the chosen state file: #35562 (comment) Maybe we could make this a proper diagnostic with the detail stating to use the path variable in the local backend? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, will update and add a commit. And also, I have found a better way to check if the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @liamcervante |
||
} | ||
cmdFlags.BoolVar(&apply.AutoApprove, "auto-approve", false, "auto-approve") | ||
cmdFlags.BoolVar(&apply.InputEnabled, "input", true, "input") | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this, the warning should still be printed whenever the diagnostics are chosen to be delayed.
Is there something else that is dropping / ignoring the warning diagnostics later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it is required to print the diagnostics before, since on line number 73
planFile, diags := c.LoadPlanFile(args.PlanPath)
returns a new diagnostic slice, it doesn't append to the already availablediags
variable.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I think we can change the other part instead of doing this 👍 It's more in keeping with the way the diagnostics are intended to work to just gather them up and report once.
You can change line 73 to something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this can be done.