GalleyBytes / terraform-operator

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

Create a web client to replace the actions configmap #39

Open isaaguilar opened 3 years ago

isaaguilar commented 3 years ago

Currently the actions a user has to take in order to review a plan before applying is "hacky" to say the least.

Steps to take are:

First the user has to configure *all of applyOnCreate, applyOnUpdate, and applyOnDelete in the tf resource.

Then the user creates the resource, waits for the pod to be created, and has to do a kubectl logs on the pod.

Finally, after the user view the plan, the user has to go find the RESOURCE_NAME-actions ConfigMap and edit the data value with "apply".

all -- this is technically not true, Just one of the `applyOn`'s need to be defined depending on the lifecycle of the tf resource, but that's so confusing might as well do all of them just in case.

 

This is a horrible design (and I am ashamed) 👎🏾

I think a better solution would be to make an internal web-client a user can interact with. The web-client would be a refreshing take on how to view plans and trigger applys. Perhaps something like:

# View a plan
curl http://terraform-operator.tf-system.svc.cluster.local/<namespace>/<tf-resource-name>/view

# Apply
curl http://terraform-operator.tf-system.svc.cluster.local/<namespace>/<tf-resource-name>/apply

This work should come after https://github.com/isaaguilar/terraform-operator/issues/26 (https://github.com/isaaguilar/terraform-operator/blob/feature/terraform-runner-container-states/docs/container-states.md) since pods will be split up between init/plan/apply stages and the controller will have more control between each stage.