Skip to content

Commit b8f9fe6

Browse files
boojackclaude
andauthored
docs: update terraform tutorial with default rollout policy (#910)
Update the rollout policy section to reflect the new default behavior where Bytebase applies a default rollout policy with checkers when none is found. Add explicit checker configuration examples with correct enum values (ERROR_ONLY, STRICT) and comprehensive documentation of options. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
1 parent da05a95 commit b8f9fe6

File tree

1 file changed

+45
-16
lines changed

1 file changed

+45
-16
lines changed

mintlify/tutorials/manage-environments-with-terraform.mdx

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@ You'll see the existing `test` and `prod` environments.
156156

157157
## Step 4 - Define the Environment Configuration
158158

159-
| | |
160-
| --------------------- | ---------------------------------------------------------------------------------------------------------------------- |
161-
| Terraform resource | [bytebase_setting](https://registry.terraform.io/providers/bytebase/bytebase/latest/docs/resources/setting) |
162-
| Sample file | [1-1-env-setting.tf](https://github.com/bytebase/terraform-provider-bytebase/blob/main/tutorials/1-1-env-setting.tf) |
159+
| | |
160+
| ------------------ | -------------------------------------------------------------------------------------------------------------------- |
161+
| Terraform resource | [bytebase_setting](https://registry.terraform.io/providers/bytebase/bytebase/latest/docs/resources/setting) |
162+
| Sample file | [1-1-env-setting.tf](https://github.com/bytebase/terraform-provider-bytebase/blob/main/tutorials/1-1-env-setting.tf) |
163163

164164
Create `1-1-env-setting.tf`:
165165

@@ -193,15 +193,20 @@ Let's add rollout and data protection policies, for more details, see: [Environm
193193

194194
### Rollout Policy
195195

196-
| | |
197-
| --------------------- | ---------------------------------------------------------------------------------------------------------------------- |
198-
| Terraform resource | [bytebase_policy](https://registry.terraform.io/providers/bytebase/bytebase/latest/docs/resources/policy) |
199-
| Sample file | [1-2-env-policy-rollout.tf](https://github.com/bytebase/terraform-provider-bytebase/blob/main/tutorials/1-2-env-policy-rollout.tf) |
196+
| | |
197+
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------- |
198+
| Terraform resource | [bytebase_policy](https://registry.terraform.io/providers/bytebase/bytebase/latest/docs/resources/policy) |
199+
| Sample file | [1-2-env-policy-rollout.tf](https://github.com/bytebase/terraform-provider-bytebase/blob/main/tutorials/1-2-env-policy-rollout.tf) |
200200

201-
Create `1-2-env-policy-rollout.tf`:
201+
When no rollout policy is found for an environment, Bytebase applies a default rollout policy with the following checkers:
202+
203+
- **Required Issue Approval**: Changes must be approved before deployment
204+
- **Plan Check Enforcement**: SQL plan checks must pass (errors only)
205+
206+
You can explicitly configure these policies using Terraform. Create `1-2-env-policy-rollout.tf`:
202207

203208
```hcl 1-2-env-policy-rollout.tf
204-
# Test environment - automatic deployment
209+
# Test environment - automatic deployment with default checkers
205210
resource "bytebase_policy" "rollout_policy_test" {
206211
depends_on = [bytebase_setting.environments]
207212
parent = bytebase_setting.environments.environment_setting[0].environment[0].name
@@ -215,10 +220,18 @@ resource "bytebase_policy" "rollout_policy_test" {
215220
"roles/LAST_APPROVER",
216221
"roles/CREATOR"
217222
]
223+
224+
# Default checkers (explicitly configured)
225+
checkers {
226+
required_issue_approval = true
227+
required_status_checks {
228+
plan_check_enforcement = "ERROR_ONLY" # Block on errors only
229+
}
230+
}
218231
}
219232
}
220233
221-
# Production - manual deployment required
234+
# Production - manual deployment with stricter checks
222235
resource "bytebase_policy" "rollout_policy_prod" {
223236
depends_on = [bytebase_setting.environments]
224237
parent = bytebase_setting.environments.environment_setting[0].environment[1].name
@@ -232,18 +245,34 @@ resource "bytebase_policy" "rollout_policy_prod" {
232245
"roles/LAST_APPROVER",
233246
"roles/CREATOR"
234247
]
248+
249+
# Enforce all plan checks (errors and warnings)
250+
checkers {
251+
required_issue_approval = true
252+
required_status_checks {
253+
plan_check_enforcement = "STRICT" # Block on both errors and warnings
254+
}
255+
}
235256
}
236257
}
237258
```
238259

239-
- `roles` is the list of roles that are allowed to click the button to deploy changes manually. Even if automatic rollout is enabled, manual approval is still needed while there is any automatic check failure.
260+
**Key Configuration Options:**
261+
262+
- `automatic`: When `true`, changes deploy automatically after approval. When `false`, requires manual click to deploy.
263+
- `roles`: List of roles allowed to manually deploy changes. Required even with automatic rollout, as manual approval is needed when checks fail.
264+
- `checkers.required_issue_approval`: When `true`, requires issue approval before rollout.
265+
- `checkers.required_status_checks.plan_check_enforcement`: Controls SQL plan check enforcement:
266+
- `PLAN_CHECK_ENFORCEMENT_UNSPECIFIED`: Allow rollout regardless of plan check results (no enforcement)
267+
- `ERROR_ONLY`: Block rollout only when plan check finds errors (default)
268+
- `STRICT`: Block rollout when plan check finds errors or warnings (stricter for production)
240269

241270
### Data Protection Policy
242271

243-
| | |
244-
| --------------------- | ---------------------------------------------------------------------------------------------------------------------- |
245-
| Terraform resource | [bytebase_policy](https://registry.terraform.io/providers/bytebase/bytebase/latest/docs/resources/policy) |
246-
| Sample file | [1-3-env-policy-data.tf](https://github.com/bytebase/terraform-provider-bytebase/blob/main/tutorials/1-3-env-policy-data.tf) |
272+
| | |
273+
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
274+
| Terraform resource | [bytebase_policy](https://registry.terraform.io/providers/bytebase/bytebase/latest/docs/resources/policy) |
275+
| Sample file | [1-3-env-policy-data.tf](https://github.com/bytebase/terraform-provider-bytebase/blob/main/tutorials/1-3-env-policy-data.tf) |
247276

248277
Create `1-3-env-policy-data.tf`:
249278

0 commit comments

Comments
 (0)