Terraform vs Ansible: source lines of code compared
As of 2026-07-27, hashicorp/terraform contains 731,928 total lines (580,256 code) across 3,936 files, while ansible/ansible contains 166,680 total lines (126,448 code) across 856 files as of 2026-07-27. hashicorp/terraform is about 4.6x the size of ansible/ansible by code lines. Code size is not code quality: a larger count only means more source material, not a better or worse project.
| Metric | hashicorp/terraform | ansible/ansible |
|---|
| Files | 3,936 | 856 |
| Total lines | 731,928 | 166,680 |
| Code lines | 580,256 | 126,448 |
| Comment lines | 72,392 | 15,041 |
| Blank lines | 79,280 | 25,191 |
| Languages counted | 12 | 11 |
Top languages in hashicorp/terraform: Go (92.7% of code), JSON (4.7% of code), HCL (2.3% of code). Top languages in ansible/ansible: Python (82.1% of code), YAML (11.6% of code), C# (2.9% of code). Go, JSON, HCL, Protocol Buffers, Shell appear only in hashicorp/terraform's top languages; Python, YAML, C#, PowerShell, Jinja2 appear only in ansible/ansible's top languages.
Methodology: both counts come from cached OctoCounts reports generated with tokei. hashicorp/terraform was counted at ref main (commit 38e20815846f) on 2026-07-27; ansible/ansible was counted at ref devel (commit 76884711a617) on 2026-07-27. See the counting methodology for ignored directories and analysis options.
Evidence and next steps:
Note: code size is not code quality. OctoCounts only reports reproducible line counts and makes no claim that either project is better.