| name | add-module |
| description | Scaffold a new OCI Terraform module following project conventions |
| allowed-tools | Read, Write, Edit, Grep, Glob |
| argument-hint | <module-name> |
Scaffold a New Module
Create a new Terraform module under terraform/modules/oci-$ARGUMENTS/ following the conventions of this project.
Project conventions
- Read an existing module (e.g.,
terraform/modules/oci-storage/) to match the structure
- Every module has exactly three files:
main.tf, variables.tf, outputs.tf
- Module header comment in
main.tf includes: description, what it provisions, usage example
- All modules declare their own
required_providers block (oracle/oci >= 5.0)
compartment_id variable with OCID validation: can(regex("^ocid1\\.(compartment|tenancy)\\.oc", ...))
- All resources get
freeform_tags = var.tags with a tags variable (default {})
- Use
===== section separators between resource groups
- Variables have
description, type, default (where appropriate), and validation blocks
- Outputs include both IDs and human-readable summaries
Steps
- Validate the module name is provided
- Create
terraform/modules/oci-$0/main.tf with provider block, header comment, and placeholder resources
- Create
terraform/modules/oci-$0/variables.tf with compartment_id and tags
- Create
terraform/modules/oci-$0/outputs.tf with placeholder outputs
- Tell the user to wire the module in
terraform/environments/oci-prod/main.tf
- Format with
terraform fmt terraform/modules/oci-$0/