Skip to content

Commit 28b6824

Browse files
justin808claude
andcommitted
docs: fix HCL snippet issues in cpflow vs. Terraform appendix
Address PR review feedback on the Terraform appendix: - Split the multi-attribute `variable "location"` block onto separate lines (two attributes on one line is an HCL2 parse error). - Use an integer port `number = 3000` instead of the string `"3000"`, matching templates/rails.yml and the cpln_workload schema. - Note that the SECRET_KEY_BASE placeholder is test-only and that production should use a sensitive var or cpln://secret ref. - Flag the 0.0.0.0/0 firewall CIDRs as tutorial defaults to tighten in production. - Point readers at the cpln provider docs for the remaining resource field mappings. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 8bf6e3a commit 28b6824

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

.controlplane/docs/cpflow-vs-terraform.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ models actually diverge.
5656
# variables.tf
5757
variable "app_name" { type = string } # cpflow injects {{APP_NAME}} per review app;
5858
# in TF this is a -var or a workspace name.
59-
variable "location" { type = string default = "aws-us-east-2" }
59+
variable "location" {
60+
type = string
61+
default = "aws-us-east-2"
62+
}
6063
variable "image_link" { type = string } # cpflow's {{APP_IMAGE_LINK}} is set at *deploy*
6164
# time by `deploy-image`. In TF the image is a
6265
# plain argument, so every deploy is a full apply.
@@ -73,6 +76,9 @@ resource "cpln_gvc" "app" {
7376
RAILS_ENV = "production"
7477
NODE_ENV = "production"
7578
RAILS_SERVE_STATIC_FILES = "true"
79+
# Placeholder is fine for test apps (matches templates/app.yml); in production set
80+
# SECRET_KEY_BASE via a sensitive var or a cpln://secret ref (see the two lines
81+
# below) — never commit a literal secret to an env map.
7682
SECRET_KEY_BASE = "placeholder_secret_key_base_for_test_apps_only"
7783
RENDERER_PORT = "3800"
7884
RENDERER_LOG_LEVEL = "info"
@@ -107,7 +113,7 @@ resource "cpln_workload" "rails" {
107113
108114
ports {
109115
protocol = "http" # keep http — Thruster does HTTP/2 on the TLS frontend
110-
number = "3000"
116+
number = 3000 # an integer, not a string (matches templates/rails.yml)
111117
}
112118
}
113119
@@ -120,8 +126,8 @@ resource "cpln_workload" "rails" {
120126
121127
firewall_spec {
122128
external {
123-
inbound_allow_cidr = ["0.0.0.0/0"]
124-
outbound_allow_cidr = ["0.0.0.0/0"]
129+
inbound_allow_cidr = ["0.0.0.0/0"] # mirrors templates/rails.yml; tighten for production
130+
outbound_allow_cidr = ["0.0.0.0/0"] # likewise — scope outbound to known egress in real apps
125131
}
126132
}
127133
}
@@ -130,7 +136,9 @@ resource "cpln_workload" "rails" {
130136
`templates/postgres.yml`, `templates/redis.yml`, and `templates/daily-task.yml`
131137
follow the same pattern (`cpln_workload` + `cpln_secret` + `cpln_policy` +
132138
`cpln_volumeset`). The mechanical translation is straightforward — the field
133-
names line up almost 1:1.
139+
names line up almost 1:1; see the
140+
[`cpln` provider docs](https://registry.terraform.io/providers/controlplane-com/cpln/latest/docs)
141+
for the exact attribute names of each resource.
134142

135143
What the comments are really showing: the three things cpflow gives you for free
136144
(`{{APP_NAME}}` per-PR interpolation, deploy-time `{{APP_IMAGE_LINK}}`

0 commit comments

Comments
 (0)