Retrieve action apply/plan/destroy/refresh from plugin

Is it possible to fetch the action being performed (apply/plan/destroy/refresh) from the plugin SDK or any other way so I can use it in a provider code?

I was looking at this part of terraform code and saw the action is retrieve from the CLI args

Output from plan:
[INFO] CLI args: []string{"/usr/local/bin/terraform", "plan"}

And here too

[INFO] CLI command args: []string{"plan"}

However if I try to print it os.Args from a provider code I get an empty a string array
log.Printf("[INFO] MORE_CLI_ARGS = %#v", os.Args[1:])
[INFO] MORE_CLI_ARGS = []string{}

Is it possible to retrieve the command line args that were used from somewhere (undocumented env var or what not)?
Is there a FR already open for this? If not I can make one.

This is not currently possible. The terraform issue tracker is probably the right place to request this. :slight_smile:

Thanks @paddy
Just made the FR and as mentioned in the FR I found a quick solution for this.