> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyshift.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Infrastructure as Code

> Anyshift is built on IaC. Annie correlates your Terraform code, Terraform state, and live infrastructure so you always know what you declared, what you stored, and what is actually running.

## Built on Infrastructure as Code

Anyshift doesn't just read your cloud. It reads your **code**, your **state**, and your **live infrastructure**, then correlates the three so you can see where they agree and where they've drifted.

<img src="https://mintcdn.com/anyshift/LDU-qrcdNwKzq2j9/images/graphs/three_universes.svg?fit=max&auto=format&n=LDU-qrcdNwKzq2j9&q=85&s=93086bf83c3fa52d66b8e53330e31c10" alt="Terraform code instantiates Terraform state, which manages live infrastructure" style={{ width: '100%', maxWidth: '960px', margin: '1.5rem auto', display: 'block' }} width="1100" height="380" data-path="images/graphs/three_universes.svg" />

Declared resources are linked to the state that instantiated them, and state entries are linked to the live resources they manage. That's how Annie answers questions that span layers: *"Which module deployed this pod?"*, *"What code manages this RDS instance?"*, *"Which resources are running without any Terraform backing?"*

<Tip>
  The same model applies to Kubernetes: declared manifests (or Helm charts) → live cluster state, streamed by the Anyshift agent.
</Tip>

## See the graph

Annie can also draw the graph. Ask *"map our cluster"* or *"diagram the dependencies of the payment service"* and she renders the live topology from the [knowledge graph](/pages/overview/knowledge_graph) as a diagram you can read at a glance.

<Frame caption="A live Kubernetes topology Annie drew from the knowledge graph: ingress, namespaces, workloads, and the cross-layer dependencies between them.">
  <img src="https://mintcdn.com/anyshift/V3uQ_7BnONnvRk3g/images/product/mermaid_diagram_example.png?fit=max&auto=format&n=V3uQ_7BnONnvRk3g&q=85&s=7a553ea53f3bbd659e0ab3eee55dd678" alt="Annie-generated Mermaid diagram of a Kubernetes production cluster topology" width="798" height="586" data-path="images/product/mermaid_diagram_example.png" />
</Frame>

The diagram comes from the same graph that powers [Annie Knowledge](/pages/product/annie_knowledge), so it shows what is *actually running* right now: real resource names, live dependencies, and gaps like a missing config or an unmanaged instance. No stale wiki sketch.

### Working with diagrams

<CardGroup cols={2}>
  <Card title="Explore" icon="magnifying-glass-plus">
    Zoom, pan, and open any diagram fullscreen to follow a dependency chain across layers.
  </Card>

  <Card title="Saved to your library" icon="folder-open">
    Every diagram lands in [**Artifacts → Diagrams**](https://app.anyshift.io/artifacts), so you can reopen and share it later.
  </Card>

  <Card title="Standard Mermaid" icon="diagram-project">
    Diagrams are plain [Mermaid](https://mermaid.js.org). Copy the source and paste it into GitHub, Notion, or any Mermaid-compatible tool.
  </Card>

  <Card title="From any surface" icon="comments">
    Ask for a diagram in a [conversation](/pages/product/annie_knowledge), and dig deeper with a follow-up question right where you are.
  </Card>
</CardGroup>

## What You Can Ask Annie

<AccordionGroup>
  <Accordion icon="code" title="Code-to-infra questions">
    * *"Which Terraform module created this EC2 instance?"*
    * *"Show me all resources defined in the networking module"*
    * *"What variables does this state file use?"*
  </Accordion>

  <Accordion icon="code-compare" title="Drift detection">
    * *"What resources were modified outside of Terraform this week?"*
    * *"Which live resources have no Terraform backing?"*
    * *"Are my declared replicas matching the pods actually running?"*

    See the [Drift Detection](/pages/iac/drift_detection) page for more.
  </Accordion>

  <Accordion icon="diagram-project" title="Impact analysis">
    * *"What breaks if I destroy this module?"*
    * *"Which services depend on this security group?"*
    * *"If I change this variable, what resources are affected?"*
  </Accordion>
</AccordionGroup>

## Explore the IaC Section

<CardGroup cols={2}>
  <Card title="Terraform" icon="cube" href="/pages/iac/terraform">
    How Annie ingests Terraform code and state, and what she does with them.
  </Card>

  <Card title="Kubernetes (Live)" icon="cubes" href="/pages/iac/kubernetes_live">
    How Annie streams live cluster state and ties it to your declared K8s manifests.
  </Card>

  <Card title="Drift Detection" icon="code-compare" href="/pages/iac/drift_detection">
    Find the gap between what you declared and what's actually running.
  </Card>

  <Card title="Knowledge Graph" icon="database" href="/pages/overview/knowledge_graph">
    How all of this connects under the hood.
  </Card>
</CardGroup>
