shakacode / control-plane-flow

The power of Kubernetes with the ease of Heroku! Our playbook for migrating from Heroku to Control Plane, controlplane.com, and CPL CLI source
MIT License
43 stars 2 forks source link

[USEFUL] Enable creation of terraform files from CPLN YAML files for new app #173

Open justin808 opened 4 months ago

justin808 commented 4 months ago
  1. In addition to .controlplane/templates dir, support a .controlplane/terraform dir and enable commands to use those.
zzaakiirr commented 1 month ago

After discussion with @borela we came up this first task that we can work on:

Why? User wants to use terraform to deploy application using CPLN as a provider

Goal Create Terraform config files from existing YAML configuration files in .controlplane folder

Before

controlplane/
├─ templates/
│  ├─ app.yml -- GVC config
│  ├─ postgres.yml -- workload config
│  ├─ rails.yml -- worload config
├─ controlplane.yml -- configs for overall application
├─ Dockerfile
├─ entrypoint.sh

After (generated files may change)

.controlplane/
├─ templates/
│  ├─ app.yml -- GVC config
│  ├─ postgres.yml -- workload config
│  ├─ rails.yml -- worload config
├─ terraform/
│  ├─ app.tf -- GVC config in HCL
│  ├─ postgres.tf -- Postgres workload config in HCL
│  ├─ rails.tf -- Rails worload config in HCL
│  ├─ providers.tf -- CPLN provider config in HCL
│  ├─ variables.tf -- Variables config in HCL
│  ├─ loacals.tf   -- Local variables config in HCL
├─ controlplane.yml -- configs for overall application
├─ Dockerfile
├─ entrypoint.sh

Task Add cpflow terraform generate command which transforms existing controlplane configs in YAML format to Terraform configs in HCL format and saves them in .controlplane/terraform folder