GalleyBytes / terraform-operator

A Kubernetes CRD to handle terraform operations
http://tf.galleybytes.com
Apache License 2.0
366 stars 47 forks source link

Keep latest pods #94

Closed flanaras closed 2 years ago

flanaras commented 2 years ago

Hi, would it make sense to have a flag, i.e. keepLatestPods, in the CRD similar to keepCompletedPods that clears up pods (setup, init, plan, apply) from previous executions, only keeping pods from the last/current execution?

Such a feature would help us track and visualise the status and timestamp of terraform's last execution in a dashboard like the one in ArgoCD, without having to dig into logs.

As far I have search this is not currently possible, am I missing something obvious?

isaaguilar commented 2 years ago

I like the idea for keepLatestPods. I'll add this in the next release.

As far as logs go, this has been on my mind and I finally started a CLI for tfo that will be able to intelligently gather data from a generation. The cli is still rough around the edges, but I was going to be adding

tfo logs <tfo-resource>

and

tfo logs <tfo-k8s-resource> --generation <n>

This command would show the init, plan, and apply (or how ever many were completed). Before I can do this, I need to write logs somewhere where they will persist and can be organized.

flanaras commented 2 years ago

Thanks, that will be very much appreciated.

Nice to know about the cli, I was not aware about that.

isaaguilar commented 2 years ago

Release v0.8.0 with this change. See https://github.com/isaaguilar/terraform-operator/releases/tag/v0.8.0

flanaras commented 2 years ago

I tested it out, works as expected!