Skip to main content

CI Templates

The ci.templates section configures custom Markdown templates for job summaries and PR comments. Templates use Go template syntax with access to plan/apply context data.

Experimental

Configuration

atmos.yaml

ci:
templates:
base_path: ".atmos/ci/templates"
terraform:
plan: "plan.md"
apply: "apply.md"
ci.templates.base_path

Directory containing custom template files, relative to the repository root.

Default: .atmos/ci/templates

ci.templates.terraform.plan

Filename of the custom plan summary template within the base path.

Default: Built-in template

ci.templates.terraform.apply

Filename of the custom apply summary template within the base path.

Default: Built-in template

Template Context

Templates receive a context object with plan/apply data.

Plan Template Variables

VariableTypeDescription
.ComponentstringComponent name
.StackstringStack name
.CommandstringTerraform command (plan)
.HasChangesboolWhether the plan has changes
.AdditionsintNumber of resources to create
.ChangesintNumber of resources to change
.DestructionsintNumber of resources to destroy
.ImportsintNumber of resources to import
.SummarystringOne-line plan summary
.ResourcesobjectResource lists by action type
.Warnings[]stringTerraform warning messages

Apply Template Variables

VariableTypeDescription
.ComponentstringComponent name
.StackstringStack name
.CommandstringTerraform command (apply)
.SuccessboolWhether apply succeeded
.SummarystringOne-line apply summary
.ResourcesobjectResource lists by action type
.OutputsmapTerraform outputs
.Warnings[]stringTerraform warning messages

Example Custom Template

.atmos/ci/templates/plan.md

## {{ .Component }} / {{ .Stack }}

{{ if .HasChanges }}
**Changes detected:** {{ .Additions }} to add, {{ .Changes }} to change, {{ .Destructions }} to destroy

{{ if gt .Destructions 0 }}
> **Warning:** This plan destroys resources!
{{ end }}
{{ else }}
No changes. Infrastructure is up-to-date.
{{ end }}

Built-in Templates

The default templates are embedded in the Atmos binary at pkg/ci/plugins/terraform/templates/. You can use these as a starting point for customization.