How to Deploy a Public Access Azure PostgreSQL Flexible Server using Terraform

Guillermo Musumeci
5 min read4 days ago

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 a Public Azure PostgreSQL Flexible Server 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) — this story —
  • Public Access with Private Endpoint: This is accessible from the Internet, and access can be restricted to specific IPs (good for dev and test environments) → check this story.
  • Private access (VNET Integration): a very secure server connected to VNET that is only accessible from servers located in Azure (the best option for production applications) → check this story.

In this story, we will learn how to deploy a Public Access Azure PostgreSQL Flexible Server using Terraform.

1. Defining the Azure Provider

--

--

Guillermo Musumeci

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