How hashicorp/terraform-azurerm-terraform-enterprise-hvd works
The project is a Terraform module designed specifically to deploy Terraform Enterprise (TFE) on Microsoft Azure. The module adheres to HashiCorp’s Validated Designs (HVD) and sets up a TFE deployment on Azure VMs using container runtimes (Docker for Ubuntu and Podman for RHEL). Besides deploying the TFE application itself, the module provisions all the required infrastructure components on Azure – such as load balancers, virtual machine scale sets (VMSS) for the TFE application nodes, a PostgreSQL Flexible Server for the database, a Redis cache, and an Azure Storage Account for object storage. In addition, there are resources for Azure DNS (both public and private), Key Vault integrations for pulling in sensitive information (certificates, passwords, and keys), as well as private endpoints for enhanced security.
Main Components
a. Infrastructure Core:
• Azure Resource Group: It hosts all resources.
• Azure Virtual Network (VNet): Illustrate subnets for VMs, load balancer, database, and other components.
b. Compute and Application Layer:
• Virtual Machine Scale Set (VMSS): Represents the TFE application nodes running either Docker or Podman containers. Include annotations for the use of either container runtime.
c. Networking and Access:
• DNS Components: Both public DNS records and private DNS zones (if enabled) should be represented, indicating how the FQDN (tfe_fqdn) is resolved by clients.
d. Data and Storage:
• Azure Redis Cache: Represented along with its secured connection settings (TLS enabled, authentication, and private endpoint).
e. Security and Configuration:
• Key Vault: Central to bootstrapping the deployment, it contains the TFE license, encryption password, database credentials, and TLS certificates.
• Role Assignments and Access Policies: Indicate that there are various access policies (for the VM, PostgreSQL, Storage Account, etc.) that bind identities with required permissions.
Relationships and Interactions
• Interactions with external logging systems (e.g., Azure Log Analytics Workspace) if the log forwarding feature is enabled.
• Control path from Terraform (which deploys and manages these resources) to the Azure resources. You might represent the Terraform CLI as a separate entity that “pushes” configuration to Azure.
Architectural Patterns and Design Principles
• The module follows the “Infrastructure as Code” paradigm with Terraform, and employs a modular design (indicated by the organized file layout). Emphasize important patterns such as separation of concerns (compute, network, storage, security).
• Use a layered approach: base infrastructure (VNet, resource group), compute (VMSS), and back-end services (database, storage, cache) are conceptually separated.
• Data security and secret management are enforced via integration with Azure Key Vault.