tonyandrewmeyer/cantrip/terraform
Claude Code and agent skill by tonyandrewmeyer/cantrip
- community
- ext:[{"type":"config","description":"Configuration overrides"}]
Checking that the SKILL.md file is still in the repository.
Generating Terraform modules for declarative charm deployment
Install
npx vskill@latest install tonyandrewmeyer/cantrip/terraformSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as tonyandrewmeyer/cantrip/terraform.
Terraform Modules for Juju Charms
A Terraform module lets users deploy your charm declaratively using the Juju Terraform provider. Instead of running juju deploy commands, they write HCL that describes the desired state — the provider handles the rest.
Why Ship a Terraform Module
- Declarative deployment — users describe what they want, not how to get there
- Composability — modules can be combined into larger stacks
- GitOps workflows — infrastructure as code, version-controlled and reviewable
- Enterprise adoption — many organisations already use Terraform for provisioning
When to Generate
Generate a Terraform module after the charm is built and deployed successfully. The module codifies the deployment pattern you have already validated. Do not generate it before the charm works — the module should reflect a known-good configuration.
Suggest Terraform module generation to the user once build and deploy succeed, unless they have already mentioned it or declined.
Standard File Structure
Every charm Terraform module lives in a terraform/ directory at the charm root and contains four files:
main.tf
Defines the juju_application resource. References variables for anything the caller might want to override (model, channel, units, config values).
If the charm has required integrations (e.g. a database it cannot function without), include juju_integration resources for those. Optional integrations should be left to the caller.
variables.tf
Declare all input variables with sensible defaults:
outputs.tf
Export values that downstream modules or the caller might need:
terraform.tf
Pin the Juju Terraform provider:
The Composition Pattern
Individual charm modules do not define integrations between applications. Each module manages a single juju_application resource (and any integrations that are strictly internal to that charm's operation).
Cross-charm integrations — relating a web app to a database, wiring COS endpoints, or connecting ingress — belong at a higher composition layer. The caller combines multiple modules and adds juju_integration resources to wire them together:
This keeps modules reusable and avoids tight coupling between charms.
Using the Tools
generate_terraform
Generates the four-file module from the charm's metadata. Call it with the charm path:
The tool reads charmcraft.yaml to determine the charm name, config options, required integrations, and resources — then produces terraform/main.tf, variables.tf, outputs.tf, and terraform.tf.
validate_terraform
Validates the generated module:
This runs terraform fmt --check, terraform init, and terraform validate inside the terraform/ directory. Fix any issues it reports before committing.
Testing
After generating and validating, run the full test suite:
Terraform test files (*.tftest.hcl) can be added to terraform/tests/ to verify the module's plan output without applying changes.
Linting
Keep the module tidy with standard Terraform tooling:
terraform fmt enforces canonical HCL formatting. tflint catches common mistakes such as undeclared variables, deprecated syntax, and provider-specific issues.
Checklist
Before committing the Terraform module:
validate_terraformpasses (format, init, validate)- All variables have descriptions and sensible defaults where appropriate
model_uuidhas no default (the caller must provide it)- The composition pattern is respected — no cross-charm integrations in the module
terraform.tfpins the Juju provider version- The module is documented in the charm's README
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingsrc/cantrip/skills/terraform/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Extension points
configConfiguration overrides
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/tonyandrewmeyer/cantrip/terraform)