# ukhan262/terraform-azurerm-search-service architecture

> Architecture diagram of the GitHub repository ukhan262/terraform-azurerm-search-service, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ukhan262/terraform-azurerm-search-service
- Repository: https://github.com/ukhan262/terraform-azurerm-search-service

## Overview

1. This repository is a Terraform module, not an application. Its purpose is to provision and configure an Azure Search Service stack with optional private connectivity and shared private link associations.

2. The module boundary is the Terraform root itself: `main.tf`, `variables.tf`, `outputs.tf`, and `versions.tf`. There are no nested modules, so all infrastructure composition happens directly in this module.

3. The core managed service is Azure Cognitive Search / Azure Search Service, created through `azurerm_search_service` resources. The module exposes the standard service sizing and deployment knobs: `sku`, `replica_count`, `partition_count`, `location`, `resource_group_name`, and `disable_local_auth`.

4. A second provisioning path uses `azapi_resource` and `azapi_update_resource`, which indicates the module reaches into Azure ARM APIs for features that are either newer, less common, or not fully modeled in `azurerm`. This is typically the boundary where service-specific configuration is applied after the base resource exists.

5. Network isolation is a first-class concern. The module creates an `azurerm_private_endpoint` tied to a supplied `subnet_id`, and it optionally integrates with a `private_dns_zone_id`. That means consumers can place the search service behind private IP connectivity instead of public access.

6. The module also manages `azurerm_search_shared_private_link_service` resources from an input list called `spls`. This is the outbound/private-link side of the architecture, letting the search service connect privately to other Azure resources or accept approved private link relationships.

7. There is an `azapi_resource_list` data source in the design, which suggests the module discovers existing Azure resources and uses that discovery to drive approval or mapping logic. In other words, the module is not only declarative creation; it also reads Azure state to connect resources correctly.

8. Inputs define the module’s contract. Required inputs cover the service identity, capacity, and connectivity: `name`, `location`, `resource_group_name`, `sku`, `replica_count`, `partition_count`, `subnet_id`, `srch_info_deploy_mode`, and `spls`. Optional inputs such as `tags`, `resource_group_id`, `private_dns_zone_id`, and `disable_local_auth` allow environment-specific tuning.

9. Outputs are intentionally minimal. The single documented output, `mapped_resources`, implies the module returns a normalized view of created or discovered Azure resources rather than exposing every internal resource directly. That makes the module easier to consume as an infrastructure building block.

10. The runtime and provider boundary is Azure Terraform: `azurerm` handles the mainstream resource types, while `azapi` bridges gaps to Azure’s ARM surface. This combination is the main architectural clue that the module must support both stable infrastructure creation and lower-level Azure service operations.

11. Repository automation is limited to documentation generation. The GitHub Actions workflow `generate-docs.yml` and `.terraform-docs.yml` indicate the README is generated from Terraform metadata, keeping inputs, outputs, providers, and resources in sync with code.

12. For an architecture diagram, the important flow is: consumer variables enter the Terraform module; the module provisions the Search Service; it then wires private endpoint and shared private link dependencies; finally it emits a compact output map for downstream stacks. The main external boundary is Azure, with networking and ARM API access as the two key integration points.

Main entry points: [`main.tf`](https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/main.tf) (Compose), [`.github/workflows/generate-docs.yml`](https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/.github/workflows/generate-docs.yml) (Docs workflow), [`versions.tf`](https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/versions.tf) (azurerm), [`variables.tf`](https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/variables.tf) (Inputs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_module["Terraform module"]
  node_consumer(("Consumer<br/>module user"))
  node_variables["Inputs<br/>interface<br/>[variables.tf]"]
  node_main["Compose<br/>root config<br/>[main.tf]"]
  node_outputs["Outputs<br/>exports<br/>[outputs.tf]"]
  node_versions["Versions<br/>constraints<br/>[versions.tf]"]
end

subgraph group_azure["Azure stack"]
  node_search[("Search<br/>[main.tf]")]
  node_azapi["ARM tweaks<br/>azapi resources<br/>[main.tf]"]
  node_discover["Discover<br/>azapi_resource_list<br/>[main.tf]"]
  node_pe["Private endpoint<br/>azurerm_private_endpoint<br/>[main.tf]"]
  node_dns[("Private DNS<br/>optional dns<br/>[main.tf]")]
  node_spls["Shared links<br/>azurerm_search_shared_private_link_service<br/>[main.tf]"]
  node_azurerm{{"azurerm<br/>provider<br/>[versions.tf]"}}
  node_azapi_provider{{"azapi<br/>provider<br/>[versions.tf]"}}
end

subgraph group_automation["Docs automation"]
  node_docs_workflow["Docs workflow<br/>github actions<br/>[generate-docs.yml]"]
  node_docs_cfg["Docs config<br/>terraform-docs"]
end

node_consumer -->|"sets"| node_variables
node_variables -->|"drives"| node_main
node_main -->|"creates"| node_search
node_main -->|"configures"| node_azapi
node_main -->|"reads"| node_discover
node_main -->|"creates"| node_pe
node_pe -->|"binds"| node_dns
node_main -->|"creates"| node_spls
node_search -->|"feeds"| node_outputs
node_discover -->|"feeds"| node_outputs
node_azurerm -->|"provides"| node_search
node_azurerm -->|"provides"| node_pe
node_azurerm -->|"provides"| node_spls
node_azapi_provider -->|"provides"| node_azapi
node_versions -->|"pins"| node_azurerm
node_versions -->|"pins"| node_azapi_provider
node_docs_cfg -->|"configures"| node_docs_workflow
node_docs_workflow -->|"renders"| node_variables
node_docs_workflow -->|"renders"| node_outputs
node_docs_workflow -->|"renders"| node_versions

click node_variables "https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/variables.tf"
click node_main "https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/main.tf"
click node_outputs "https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/outputs.tf"
click node_versions "https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/versions.tf"
click node_search "https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/main.tf"
click node_azapi "https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/main.tf"
click node_discover "https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/main.tf"
click node_pe "https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/main.tf"
click node_dns "https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/main.tf"
click node_spls "https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/main.tf"
click node_azurerm "https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/versions.tf"
click node_azapi_provider "https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/versions.tf"
click node_docs_workflow "https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/.github/workflows/generate-docs.yml"
click node_docs_cfg "https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/.terraform-docs.yml"

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_consumer,node_variables,node_main,node_outputs,node_versions toneBlue
class node_search,node_azapi,node_discover,node_pe,node_dns,node_spls,node_azurerm,node_azapi_provider toneAmber
class node_docs_workflow,node_docs_cfg toneMint
```

## Components

### Terraform module

Root module boundary and public interface

- **Consumer**: module user · Terraform caller supplying inputs
- [Inputs](https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/variables.tf): interface · Module contract for service, capacity, and connectivity · `variables.tf`
- [Compose](https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/main.tf): root config · Top-level Terraform composition for the search service stack · `main.tf`
- [Outputs](https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/outputs.tf): exports · Normalized values returned to downstream stacks · `outputs.tf`
- [Versions](https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/versions.tf): constraints · Provider and Terraform version constraints · `versions.tf`

### Azure stack

Managed service, networking, and ARM integrations

- [Search](https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/main.tf): azurerm_search_service · Core Azure Cognitive Search service · `main.tf`
- [ARM tweaks](https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/main.tf): azapi resources · Post-create configuration via Azure ARM APIs · `main.tf`
- [Discover](https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/main.tf): azapi_resource_list · Reads existing Azure resources to drive mapping logic · `main.tf`
- [Private endpoint](https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/main.tf): azurerm_private_endpoint · Private IP connectivity for the search service · `main.tf`
- [Private DNS](https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/main.tf): optional dns · Optional private DNS zone integration · `main.tf`
- [Shared links](https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/main.tf): azurerm_search_shared_private_link_service · Outbound shared private link associations · `main.tf`
- [azurerm](https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/versions.tf): provider · Main Terraform provider for Azure resources · `versions.tf`
- [azapi](https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/versions.tf): provider · ARM API bridge for newer or less modeled features · `versions.tf`

### Docs automation

Repository automation for generated documentation

- [Docs workflow](https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/.github/workflows/generate-docs.yml): github actions · Generates README content from Terraform metadata · `.github/workflows/generate-docs.yml`
- [Docs config](https://github.com/ukhan262/terraform-azurerm-search-service/blob/main/.terraform-docs.yml): terraform-docs · Documentation generation settings · `.terraform-docs.yml`

## Connections

- Consumer → Inputs: sets · Caller provides module inputs
- Inputs → Compose: drives · Inputs control the root composition
- Compose → Search: creates · Provision the Azure Search service
- Compose → ARM tweaks: configures · Apply service-specific ARM settings
- Compose → Discover: reads · Discover Azure state for mapping and approval logic
- Compose → Private endpoint: creates · Attach private connectivity
- Private endpoint → Private DNS: binds · Optionally use private DNS
- Compose → Shared links: creates · Manage shared private link associations
- Search → Outputs: feeds · Created resource contributes to output map
- Discover → Outputs: feeds · Discovered resources are normalized for consumers
- azurerm → Search: provides · Primary provider for managed service
- azurerm → Private endpoint: provides · Primary provider for private endpoint
- azurerm → Shared links: provides · Primary provider for shared private links
- azapi → ARM tweaks: provides · ARM bridge provider for advanced configuration
- Versions → azurerm: pins · Constrains provider version
- Versions → azapi: pins · Constrains provider version
- Docs config → Docs workflow: configures · Documentation generation settings used by workflow
- Docs workflow → Inputs: renders · Publishes input metadata to README
- Docs workflow → Outputs: renders · Publishes output metadata to README
- Docs workflow → Versions: renders · Publishes provider/version metadata to README
