GalleyBytes / terraform-operator

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

Is it possible to perform only some tasks? #155

Closed UncleSamSwiss closed 1 year ago

UncleSamSwiss commented 1 year ago

We would like to be able to only do init and plan, but not the other tasks.

Reason for this is, we are using GitHub Actions to test the effect of changes to terraform projects in a PR. So, in the PR we currently log the output of terraform plan. Now we are considering to move from running Terraform directly in GitHub Actions to running it in terraform-operator and we would like to keep this feedback on the PR.

We can create a custom script for the plan task that uploads the output of terraform plan to the GitHub PR, but can we prevent running apply completely?

isaaguilar commented 1 year ago

I can think of a very "hacky" solution.

spec:
  taskOptions:
  - for: ["apply", "apply-delete"] 
    script:
      inline: |-
        #!/bin/bash
        echo do nothing

I have alternative ideas, but the one above is the easiest to do.

UncleSamSwiss commented 1 year ago

Oh, I didn't think about that, but of course this will work. Thanks a lot!