on
Golden paths with Backstage: scaffold GitOps-ready apps using Terraform and Argo CD
Golden paths are opinionated, well-documented workflows that let developers move fast while staying within safe, maintainable boundaries. Backstage is an excellent place to host those paths: its Scaffolder (software templates) lets platform teams codify the exact steps—repo layout, CI/CD wiring, infrastructure, and catalog registration—so developers follow the right path with a single form. (backstage.io)
This article walks a practical, recent approach to designing a golden path that scaffolds a GitOps-ready application: a single Scaffolder template that creates the app repo, bootstraps Terraform-managed infrastructure, and registers a GitOps deployment in Argo CD—surfaceable inside Backstage via an Argo CD plugin. Community plugins and example template repos already show this pattern is feasible and actively used. (github.com)
Why this works
- Single entry point: Developers click a template, answer a few form fields, and get a repo + infra + catalog entry without needing infra or platform knowledge. Backstage Scaffolder supports custom actions and secrets handling to make this safe and repeatable. (backstage.io)
- GitOps-first: Generating code and manifests into a Git repo aligns with GitOps workflows; Argo CD can then pick up the repo and deploy automatically.
- Observability in the portal: Backstage plugins for Argo CD let developers see sync/health status alongside docs and ownership in the catalog, closing the feedback loop. (roadie.io)
A concrete golden path (developer flow)
- Developer opens Backstage → Create new service → selects “GitOps App (Terraform + Argo CD)”.
- Fill in name, owner, environment (dev/stage/prod), cloud account or workspace.
- Scaffolder actions:
- Create a new Git repository (publish:github).
- Add application code + k8s manifests + Argo CD application manifest.
- Invoke a custom scaffolder action that creates a Terraform workspace (or repo of Terragrunt) and bootstraps cloud resources.
- Register the component in the Backstage Software Catalog.
- CI (GitHub Actions/GitLab CI) runs and pushes infra/config; Argo CD picks up manifests and deploys.
- Backstage shows deployment status via Argo CD plugin; developers can click through to rollout history or open the repo.
Key implementation pieces
- Scaffolder templates and custom actions
- Use Backstage’s Software Templates to create the UI form and sequence of actions. Templates are simple YAML objects that describe parameters and action steps; custom actions let you call internal APIs or cloud providers. (backstage.io)
- Keep the form minimal and use custom field extensions (OwnerPicker, repo pickers) to reduce errors.
- Terraform integration
- Implement a custom scaffolder action (or reuse community examples) to create Terraform Cloud/Enterprise projects and workspaces or to scaffold a Terragrunt repo layout. Community examples show a pattern where Backstage obtains short-lived credentials (e.g., from Vault) and instructs Terraform Cloud to create workspaces, helping with Day 2 operations. Note: scaffolder actions that touch external state are often non-idempotent — design for safe reruns and provide clear rollback instructions. (github.com)
- Argo CD wiring and visibility
- Generate an Argo CD Application manifest in the new repo, or call Argo CD’s API to create an application pointing at the Git repo. Use a Backstage Argo CD plugin to show sync/health status and deployment history on the entity page so developers see runtime feedback in the same portal. Roadie and community-maintained plugins are available and actively maintained. (roadie.io)
Example (simplified) template steps (conceptual)
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
name: gitops-terraform-app
spec:
title: GitOps app (Terraform + Argo CD)
parameters:
- name: appName
title: App name
type: string
- name: owner
title: Owner
type: string
steps:
- id: create-repo
action: publish:github
input:
repoUrl: $
- id: scaffold-code
action: fetch:template
input:
path: templates/app-template
- id: create-terraform-workspace
action: custom:createTerraformWorkspace
input:
workspaceName: $-infra
- id: register-catalog
action: catalog:register
input:
entity: $
This is illustrative: real templates should use secret handling, permissions, and careful error handling per Backstage docs. (backstage.io)
Operational and security considerations
- Secrets and credentials: Don’t pass secrets in plain form parameters. Use Backstage’s secrets support, Vault integration, or short-lived tokens pulled by the backend so templates never persist sensitive values in the UI. (backstage.io)
- Permissions: Limit who can run certain template steps (e.g., creating cloud workspaces or production infra) using Backstage’s permission tags on parameters and steps. (backstage.io)
- Idempotency & retries: If your scaffolder action creates external state (Terraform Cloud projects, cloud accounts), design for safe retries or detect existing resources and skip creation. The Terraform Cloud example repo explicitly warns about non-idempotency in some actions. (github.com)
Where to look for examples and plugins
- Backstage official docs and community software-templates repo for starter templates and writing guidance. (backstage.io)
- Community Terraform plugin demonstrating Terraform Cloud and Vault flows. (github.com)
- Argo CD plugins and Roadie-maintained integrations that show deployment status inside Backstage. (roadie.io)
Next steps
- Start with a minimal template that only creates a repo and registers the component, iterate by adding Terraform workspace creation and Argo CD wiring.
- Build tests for template steps (dry-run mode and template editor).
- Collect developer feedback and measure time-to-first-deploy to quantify the golden path’s impact.
Designing a golden path with Backstage means shifting platform effort into a predictable, repeatable form: less context-switching for developers, consistent security and infrastructure patterns for platform teams, and a clear line of sight from code to deployment in the portal. With scaffolder templates, Terraform integrations, and Argo CD plugins already available in the ecosystem, you can prototype a GitOps-first golden path today and iterate safely from there. (backstage.io)