# microsoft/azure-pipelines-terraform architecture

> Architecture diagram of the GitHub repository microsoft/azure-pipelines-terraform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/microsoft/azure-pipelines-terraform
- Repository: https://github.com/microsoft/azure-pipelines-terraform

## Overview

This Azure DevOps extension installs Terraform and runs it in pipeline tasks, including provider-specific authentication and Terraform operations. It also provides a build-plan summary view that retrieves Terraform plan attachments and formats them for display. The task versions share a repeated architecture; the graph uses V5 as the representative implementation, with V1–V4 still present in the repository. Relationships are limited to calls or imports visible in excerpts or the source index; undocumented task dispatch is omitted.

Main entry points: [`Tasks/TerraformTask/TerraformTaskV5/src/azure-terraform-command-handler.ts`](https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/azure-terraform-command-handler.ts) (Azure handler), [`views/terraform-plan/src/plan-summary-tab/plan-summary-tab.tsx`](https://github.com/microsoft/azure-pipelines-terraform/blob/main/views/terraform-plan/src/plan-summary-tab/plan-summary-tab.tsx) (Plan summary), [`Tasks/TerraformTask/TerraformTaskV5/src/base-terraform-command-handler.ts`](https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/base-terraform-command-handler.ts) (Command handler), [`views/terraform-plan/src/services/attachments.ts`](https://github.com/microsoft/azure-pipelines-terraform/blob/main/views/terraform-plan/src/services/attachments.ts) (Plan attachments)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_install["Terraform installation"]
  node_installer_entry["Installer entry<br/>[index.ts]"]
  node_installer["Terraform installer"]
end

subgraph group_execution["Pipeline execution"]
  node_task_entry["Task entry<br/>[index.ts]"]
  node_parent["Task coordinator<br/>[parent-handler.ts]"]
  node_base["Command handler"]
  node_commands["Command models"]
  node_terraform["Terraform runner<br/>[terraform.ts]"]
end

subgraph group_auth["Provider authentication"]
  node_aws_auth["AWS handler"]
  node_azure_auth["Azure handler"]
  node_gcp_auth["GCP handler"]
  node_oci_auth["OCI handler"]
  node_envvars["Environment variables"]
  node_idtoken["ID token generator"]
end

subgraph group_planview["Plan summary view"]
  node_view_entry["View entry<br/>[index.tsx]"]
  node_summary["Plan summary"]
  node_attachments["Plan attachments<br/>[attachments.ts]"]
  node_formatter["Plan formatter<br/>[plan-formatter.ts]"]
end

node_pipeline(("Pipeline author"))
node_terraform_cli["Terraform CLI"]
node_azdo["Azure DevOps"]

node_pipeline -->|"configures install"| node_installer_entry
node_installer_entry -->|"invokes"| node_installer
node_pipeline -->|"configures task"| node_task_entry
node_base -->|"uses command models"| node_commands
node_base -->|"executes commands"| node_terraform_cli
node_azure_auth -->|"extends handler"| node_base
node_azure_auth -->|"initializes authorization"| node_commands
node_azure_auth -->|"uses helper"| node_envvars
node_azure_auth -->|"generates token"| node_idtoken
node_view_entry -->|"renders"| node_summary
node_view_entry -->|"creates service"| node_attachments
node_summary -->|"loads attachments"| node_attachments
node_summary -->|"formats plans"| node_formatter
node_attachments -->|"reads build data"| node_azdo

click node_installer_entry "https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformInstaller/TerraformInstallerV0/src/index.ts"
click node_installer "https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformInstaller/TerraformInstallerV0/src/terraform-installer.ts"
click node_task_entry "https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/index.ts"
click node_parent "https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/parent-handler.ts"
click node_base "https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/base-terraform-command-handler.ts"
click node_commands "https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/terraform-commands.ts"
click node_terraform "https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/terraform.ts"
click node_aws_auth "https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/aws-terraform-command-handler.ts"
click node_azure_auth "https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/azure-terraform-command-handler.ts"
click node_gcp_auth "https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/gcp-terraform-command-handler.ts"
click node_oci_auth "https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/oci-terraform-command-handler.ts"
click node_envvars "https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/environment-variables.ts"
click node_idtoken "https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/id-token-generator.ts"
click node_view_entry "https://github.com/microsoft/azure-pipelines-terraform/blob/main/views/terraform-plan/src/index.tsx"
click node_summary "https://github.com/microsoft/azure-pipelines-terraform/blob/main/views/terraform-plan/src/plan-summary-tab/plan-summary-tab.tsx"
click node_attachments "https://github.com/microsoft/azure-pipelines-terraform/blob/main/views/terraform-plan/src/services/attachments.ts"
click node_formatter "https://github.com/microsoft/azure-pipelines-terraform/blob/main/views/terraform-plan/src/services/plan-formatter.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_installer_entry,node_installer toneBlue
class node_task_entry,node_parent,node_base,node_commands,node_terraform toneAmber
class node_aws_auth,node_azure_auth,node_gcp_auth,node_oci_auth,node_envvars,node_idtoken toneMint
class node_view_entry,node_summary,node_attachments,node_formatter toneRose
class node_pipeline,node_terraform_cli,node_azdo toneIndigo
```

## Components

### Terraform installation

- [Installer entry](https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformInstaller/TerraformInstallerV0/src/index.ts): `Tasks/TerraformInstaller/TerraformInstallerV0/src/index.ts`
- [Terraform installer](https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformInstaller/TerraformInstallerV0/src/terraform-installer.ts): `Tasks/TerraformInstaller/TerraformInstallerV0/src/terraform-installer.ts`

### Pipeline execution

- [Task entry](https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/index.ts): `Tasks/TerraformTask/TerraformTaskV5/src/index.ts`
- [Task coordinator](https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/parent-handler.ts): `Tasks/TerraformTask/TerraformTaskV5/src/parent-handler.ts`
- [Command handler](https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/base-terraform-command-handler.ts): `Tasks/TerraformTask/TerraformTaskV5/src/base-terraform-command-handler.ts`
- [Command models](https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/terraform-commands.ts): `Tasks/TerraformTask/TerraformTaskV5/src/terraform-commands.ts`
- [Terraform runner](https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/terraform.ts): `Tasks/TerraformTask/TerraformTaskV5/src/terraform.ts`

### Provider authentication

- [AWS handler](https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/aws-terraform-command-handler.ts): `Tasks/TerraformTask/TerraformTaskV5/src/aws-terraform-command-handler.ts`
- [Azure handler](https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/azure-terraform-command-handler.ts): `Tasks/TerraformTask/TerraformTaskV5/src/azure-terraform-command-handler.ts`
- [GCP handler](https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/gcp-terraform-command-handler.ts): `Tasks/TerraformTask/TerraformTaskV5/src/gcp-terraform-command-handler.ts`
- [OCI handler](https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/oci-terraform-command-handler.ts): `Tasks/TerraformTask/TerraformTaskV5/src/oci-terraform-command-handler.ts`
- [Environment variables](https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/environment-variables.ts): `Tasks/TerraformTask/TerraformTaskV5/src/environment-variables.ts`
- [ID token generator](https://github.com/microsoft/azure-pipelines-terraform/blob/main/Tasks/TerraformTask/TerraformTaskV5/src/id-token-generator.ts): `Tasks/TerraformTask/TerraformTaskV5/src/id-token-generator.ts`

### Plan summary view

- [View entry](https://github.com/microsoft/azure-pipelines-terraform/blob/main/views/terraform-plan/src/index.tsx): `views/terraform-plan/src/index.tsx`
- [Plan summary](https://github.com/microsoft/azure-pipelines-terraform/blob/main/views/terraform-plan/src/plan-summary-tab/plan-summary-tab.tsx): `views/terraform-plan/src/plan-summary-tab/plan-summary-tab.tsx`
- [Plan attachments](https://github.com/microsoft/azure-pipelines-terraform/blob/main/views/terraform-plan/src/services/attachments.ts): `views/terraform-plan/src/services/attachments.ts`
- [Plan formatter](https://github.com/microsoft/azure-pipelines-terraform/blob/main/views/terraform-plan/src/services/plan-formatter.ts): `views/terraform-plan/src/services/plan-formatter.ts`

### Other components

- **Pipeline author**
- **Terraform CLI**
- **Azure DevOps**

## Connections

- Pipeline author → Installer entry: configures install
- Installer entry → Terraform installer: invokes (evidence: `Tasks/TerraformInstaller/TerraformInstallerV0/src/index.ts`)
- Pipeline author → Task entry: configures task
- Command handler → Command models: uses command models (evidence: `Tasks/TerraformTask/TerraformTaskV5/src/base-terraform-command-handler.ts`)
- Command handler → Terraform CLI: executes commands (evidence: `Tasks/TerraformTask/TerraformTaskV5/src/base-terraform-command-handler.ts`)
- Azure handler → Command handler: extends handler (evidence: `Tasks/TerraformTask/TerraformTaskV5/src/azure-terraform-command-handler.ts`)
- Azure handler → Command models: initializes authorization (evidence: `Tasks/TerraformTask/TerraformTaskV5/src/azure-terraform-command-handler.ts`)
- Azure handler → Environment variables: uses helper (evidence: `Tasks/TerraformTask/TerraformTaskV5/src/azure-terraform-command-handler.ts`)
- Azure handler → ID token generator: generates token (evidence: `Tasks/TerraformTask/TerraformTaskV5/src/azure-terraform-command-handler.ts`)
- View entry → Plan summary: renders (evidence: `views/terraform-plan/src/index.tsx`)
- View entry → Plan attachments: creates service (evidence: `views/terraform-plan/src/index.tsx`)
- Plan summary → Plan attachments: loads attachments (evidence: `views/terraform-plan/src/plan-summary-tab/plan-summary-tab.tsx`)
- Plan summary → Plan formatter: formats plans (evidence: `views/terraform-plan/src/plan-summary-tab/plan-summary-tab.tsx`)
- Plan attachments → Azure DevOps: reads build data (evidence: `views/terraform-plan/src/services/attachments.ts`)
