Terraform vs Ansible: source lines of code compared

This page compares the source lines of code (SLOC) of hashicorp/terraform and ansible/ansible using cached OctoCounts reports. Code size is not code quality: a larger count only means more source material, not a better or worse project.

As of 2026-09-07, hashicorp/terraform contains 745,609 total lines (591,821 code) across 3,980 files, while ansible/ansible contains 166,997 total lines (126,700 code) across 871 files as of 2026-08-31. hashicorp/terraform is about 4.7x 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.

Metrichashicorp/terraformansible/ansible
Files3,980871
Total lines745,609166,997
Code lines591,821126,700
Comment lines73,09115,064
Blank lines80,69725,233
Languages counted1211

Top languages in hashicorp/terraform: Go (92.8% of code), JSON (4.6% 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 7b8c301b55dd) on 2026-09-07; ansible/ansible was counted at ref devel (commit deecfd6e8c03) on 2026-08-31. 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.

Compare FAQ

Which has more lines of code, hashicorp/terraform or ansible/ansible?

hashicorp/terraform has more code: 591,821 code lines versus 126,700 for ansible/ansible, about 4.7x as much, based on cached OctoCounts reports as of 2026-09-07.

Does more source lines of code mean more complexity?

Not necessarily. SLOC measures size, not complexity, quality, or maintainability. A larger codebase can mean more features, more generated or vendored code, more verbose language idioms, or more tests — none of which imply the code is harder to work with. Use SLOC to gauge the scale of what you'd be reading or maintaining, not as a quality signal for hashicorp/terraform, ansible/ansible, or any repository.

How is this comparison calculated?

Methodology: both counts come from cached OctoCounts reports generated with tokei. hashicorp/terraform was counted at ref main (commit 7b8c301b55dd) on 2026-09-07; ansible/ansible was counted at ref devel (commit deecfd6e8c03) on 2026-08-31. See the counting methodology for ignored directories and analysis options.

Can I compare a different branch, tag, or commit?

Yes. This page shows the default branch for each repository. Use the interactive comparison tool to pick any public GitHub repository, branch, tag, or commit SHA for both sides and get a fresh side-by-side report.