How do I set up docs as code for infrastructure?

November 13, 2026 4 answers
Asked by z2!Trellis_508

I need to document our infrastructure and tools so a new team member can understand them. Changes should go through a pull request and approval before they become visible. Where should I start, and what tools or structure would make sense?

Answers

h9!ioport_63

Docs as code is a workflow, not one particular product. Put Markdown files in a Git repository, either alongside the infrastructure code or in a dedicated documentation repo. Start with a docs/index.md page as the entry point.

From there, organize around what someone needs to find: an architecture overview, onboarding, tool reference, operational runbooks, and records of significant decisions. Use a simple template where it helps, but don't wait for a perfect structure before writing.

Build the pages into a navigable site with a static site generator such as mdBook or Hugo. The source stays in Git, while the generated site gives readers a more useful way to browse it.

z2!Trellis_508:

We already use Bitbucket. Can that be the repository for the documentation?

s91+opcode_7:

Yes. Store the files there and use its pull request workflow. You'll still need a build and publishing step for the rendered site.

Reply to this answer
r3~bookplate_640

The approval requirement needs a bit more than just putting files in Git. Protect the branch used for publishing and require an approved pull request before changes can be merged. Then have the publishing job build from that branch, rather than from every proposed change.

That way a draft can be reviewed without appearing on the published site. If you add an automated preview for reviewers, keep it separate from the main site.

Reply to this answer
almost_a_switcheroo

Separate the tooling question from the quality question. A tidy site can still leave a newcomer confused. Ask someone unfamiliar with the setup to follow the overview and find out what the major components do and which tools are used.

Use the gaps they find to improve the content over time. Architecture diagrams can help with the big picture, and a tool like Draw.io is one option for making them.

Reply to this answer
!keep~the+tab

You can use an AI assistant to draft an outline or rough pages from the repository, but treat that output as a starting point. Someone who knows the infrastructure still needs to check the details and review the changes before publishing.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions