mercari/terraform-provider-spinnaker

Change pipeline & pipeline template resources with native Terraform schema integration

KeisukeYamashita opened this issue · 2 comments

WHAT

We want to declare pipelines by not JSON with HCL native way.

WHY

Better developer experience.
It is hard to find diffs when the pipeline is read by JSON.

When I look at a pipeline diff it does show quite easily what the changes are, even though it's using json.

But I think the downside of the json approach is that it shows the entire json, meaning with larger json files / complex pipeline setups this can become problematic. However to solve that you'd need to split it into smaller parts but i don't think that's a better approach.

I would like to hear more about what the format would look like when using a more HCL approach and/or what the difficulties with finding the diffs were for you.

Thank you for reaching out. Nice to hear that JSON still works with good UX.

I would like to hear more about what the format would look like when using a more HCL approach and/or what the difficulties with finding the diffs were for you.

Sorry, my description was not exact. I have the same opinion to you.
Moreover, if we are able to migrate the schema with native HCL support, we can use the Terraform features (e.g. Lifecycle, Dynamic blocks, etc).

My (draft) plan is to map the JSON with HCL like below:

resource "spinnaker_pipeline"  "pipeline" {
     application = spinnaker_application.myapp.id
     name           = "wait-pipeline"
     
     stages {
          type  = "wait"
          wait_time = 3
     }

    stages {
          requiseteStageRefIds = 1
          type = "wait"
          wait_time   = 3
    }
}

If you have any opinion, please let me know 😄