Redirecting the console output for a custom UI

I’m building an app that will call Terraform CLI in the back engine, however I would like to provide UI updates on the process while terraform is executing, is this possible and if so how?

I would be ok with polling if I can’t hook up to an event stream of some sort.

Hi Justin. I built a UI using Django to generate a YAML file for Salt to do its thing. The Django application uses Django channels to push progress messages across a websocket connection. Those messages are displayed in a div layer with some opacity and a spinner so it shows signs of life for users. Here is an example of a message from one of the Salt states.
- name: “Configuring System Services&#x2026 is a very simple script that takes the string and pushes it as JSON across the websocket.

At the time I did this, I didn’t know Salt well enough to use Salt beacons. They may not have even existed at the time.

In your case, Terraform isn’t likely to return anything useful for a while. For example, here is the latest machine I generated.

Creation complete after 13m43s

In your app, you could push a “Building server…” message into the websocket and display it on your frontend with a spinner before you start. Once the server has been provisioned, you can use a local-exec to push another message, say “Configuring DNS…”, or whatever makes sense for you.