How to Deploy an Azure PostgreSQL Flexible Server with Private Endpoint using Terraform

Guillermo Musumeci
7 min readJun 30, 2024

Azure Database for PostgreSQL Flexible Server is a relational database service based on the open-source Postgres database engine. It’s a fully managed database-as-a-service that can handle mission-critical workloads with predictable performance, security, high availability, and dynamic scalability.

In this story, we will learn how to deploy an Azure PostgreSQL Flexible Server with a Private Endpoint using Terraform.

Azure PostgreSQL Flexible Server can be deployed in three ways:

  • Public Access (Allowed IP addresses): accessible from the internet, access can be restricted to specific IPs (good for dev and test environments) → check this story.
  • Public Access with Private Endpoint: accessible from the internet, access can be restricted to specific IPs (good for dev and test environments) — this story —
  • Private access (VNET Integration): very secure server connected to VNET and only accessible from servers located in Azure (best option for production applications) → check this story.

1. Defining the Azure Provider

First, we will define Azure authentication variables.

--

--

Guillermo Musumeci
Guillermo Musumeci

Written by Guillermo Musumeci

Certified AWS, Azure & GCP Architect | HashiCorp Ambassador | Terraform SME | KopiCloud Founder | ex-AWS | Entrepreneur | Book Author | Husband & Dad of ✌

No responses yet