|
| 1 | +# Azure PostgreSQL Flexible Server Database |
| 2 | + |
| 3 | +This template deploys an [Azure PostgreSQL Flexible Server Database](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/postgresql_flexible_server_database). |
| 4 | + |
| 5 | +## Resources |
| 6 | + |
| 7 | +| Terraform Resource Type | Description | |
| 8 | +| - | - | |
| 9 | +| `azurerm_resource_group` | The resource group all resources are deployed into | |
| 10 | +| `azurerm_virtual_network` | Manages the Azure Virtual Network including any configured subnets | |
| 11 | +| `azurerm_network_security_group` | Manages the Azure Network Security Group that contains a list of network security rules | |
| 12 | +| `azurerm_subnet` | Manages the Azure Subnet | |
| 13 | +| `azurerm_subnet_network_security_group_association` | Associates an Azure Network Security Group with an Azure Subnet within an Azure Virtual Network | |
| 14 | +| `azurerm_private_dns_zone` | Manages Azure Private DNS zones within Azure DNS | |
| 15 | +| `azurerm_private_dns_zone_virtual_network_link` | Manages Private DNS zone Virtual Network Links | |
| 16 | +| `azurerm_postgresql_flexible_server` | The Azure PostgreSQL Flexible Server that the Azure PostgreSQL Flexible Server Database will run on | |
| 17 | +| `azurerm_postgresql_flexible_server_database` | The Azure PostgreSQL Flexible Server Database | |
| 18 | + |
| 19 | +## Variables |
| 20 | + |
| 21 | +| Name | Description | |
| 22 | +|-|-| |
| 23 | +| `name` | Name of the deployment | |
| 24 | +| `environment` | The depolyment environment name (used for postfixing resource names) | |
| 25 | +| `location` | The Azure Region to deploy these resources in | |
| 26 | + |
| 27 | + |
| 28 | +## Example |
| 29 | + |
| 30 | +```bash |
| 31 | +>terraform plan |
| 32 | + |
| 33 | +Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: |
| 34 | + + create |
| 35 | + |
| 36 | +Terraform will perform the following actions: |
| 37 | + |
| 38 | + # azurerm_network_security_group.default will be created |
| 39 | + + resource "azurerm_network_security_group" "default" { |
| 40 | + + id = (known after apply) |
| 41 | + + location = "westeurope" |
| 42 | + + name = "demo-postgresql-fs-dev-nsg" |
| 43 | + + resource_group_name = "demo-postgresql-fs-dev-rg" |
| 44 | + + security_rule = [ |
| 45 | + + { |
| 46 | + + access = "Allow" |
| 47 | + + description = "" |
| 48 | + + destination_address_prefix = "*" |
| 49 | + + destination_address_prefixes = [] |
| 50 | + + destination_application_security_group_ids = [] |
| 51 | + + destination_port_range = "*" |
| 52 | + + destination_port_ranges = [] |
| 53 | + + direction = "Inbound" |
| 54 | + + name = "test123" |
| 55 | + + priority = 100 |
| 56 | + + protocol = "Tcp" |
| 57 | + + source_address_prefix = "*" |
| 58 | + + source_address_prefixes = [] |
| 59 | + + source_application_security_group_ids = [] |
| 60 | + + source_port_range = "*" |
| 61 | + + source_port_ranges = [] |
| 62 | + }, |
| 63 | + ] |
| 64 | + } |
| 65 | + |
| 66 | + # azurerm_postgresql_flexible_server.default will be created |
| 67 | + + resource "azurerm_postgresql_flexible_server" "default" { |
| 68 | + + administrator_login = "adminTerraform" |
| 69 | + + administrator_password = (sensitive value) |
| 70 | + + backup_retention_days = 7 |
| 71 | + + cmk_enabled = (known after apply) |
| 72 | + + delegated_subnet_id = (known after apply) |
| 73 | + + fqdn = (known after apply) |
| 74 | + + geo_redundant_backup_enabled = false |
| 75 | + + id = (known after apply) |
| 76 | + + location = "westeurope" |
| 77 | + + name = "demo-postgresql-fs-dev-server" |
| 78 | + + private_dns_zone_id = (known after apply) |
| 79 | + + public_network_access_enabled = (known after apply) |
| 80 | + + resource_group_name = "demo-postgresql-fs-dev-rg" |
| 81 | + + sku_name = "GP_Standard_D2s_v3" |
| 82 | + + storage_mb = 32768 |
| 83 | + + version = "13" |
| 84 | + + zone = "1" |
| 85 | + } |
| 86 | + |
| 87 | + # azurerm_postgresql_flexible_server_database.default will be created |
| 88 | + + resource "azurerm_postgresql_flexible_server_database" "default" { |
| 89 | + + charset = "UTF8" |
| 90 | + + collation = "en_US.UTF8" |
| 91 | + + id = (known after apply) |
| 92 | + + name = "demo-postgresql-fs-dev-db" |
| 93 | + + server_id = (known after apply) |
| 94 | + } |
| 95 | + |
| 96 | + # azurerm_private_dns_zone.default will be created |
| 97 | + + resource "azurerm_private_dns_zone" "default" { |
| 98 | + + id = (known after apply) |
| 99 | + + max_number_of_record_sets = (known after apply) |
| 100 | + + max_number_of_virtual_network_links = (known after apply) |
| 101 | + + max_number_of_virtual_network_links_with_registration = (known after apply) |
| 102 | + + name = "demo-postgresql-fs-dev-pdz.postgres.database.azure.com" |
| 103 | + + number_of_record_sets = (known after apply) |
| 104 | + + resource_group_name = "demo-postgresql-fs-dev-rg" |
| 105 | + |
| 106 | + + soa_record { |
| 107 | + + email = (known after apply) |
| 108 | + + expire_time = (known after apply) |
| 109 | + + fqdn = (known after apply) |
| 110 | + + host_name = (known after apply) |
| 111 | + + minimum_ttl = (known after apply) |
| 112 | + + refresh_time = (known after apply) |
| 113 | + + retry_time = (known after apply) |
| 114 | + + serial_number = (known after apply) |
| 115 | + + tags = (known after apply) |
| 116 | + + ttl = (known after apply) |
| 117 | + } |
| 118 | + } |
| 119 | + |
| 120 | + # azurerm_private_dns_zone_virtual_network_link.default will be created |
| 121 | + + resource "azurerm_private_dns_zone_virtual_network_link" "default" { |
| 122 | + + id = (known after apply) |
| 123 | + + name = "demo-postgresql-fs-dev-pdzvnetlink.com" |
| 124 | + + private_dns_zone_name = "demo-postgresql-fs-dev-pdz.postgres.database.azure.com" |
| 125 | + + registration_enabled = false |
| 126 | + + resource_group_name = "demo-postgresql-fs-dev-rg" |
| 127 | + + virtual_network_id = (known after apply) |
| 128 | + } |
| 129 | + |
| 130 | + # azurerm_resource_group.default will be created |
| 131 | + + resource "azurerm_resource_group" "default" { |
| 132 | + + id = (known after apply) |
| 133 | + + location = "westeurope" |
| 134 | + + name = "demo-postgresql-fs-dev-rg" |
| 135 | + } |
| 136 | + |
| 137 | + # azurerm_subnet.default will be created |
| 138 | + + resource "azurerm_subnet" "default" { |
| 139 | + + address_prefix = (known after apply) |
| 140 | + + address_prefixes = [ |
| 141 | + + "10.0.2.0/24", |
| 142 | + ] |
| 143 | + + enforce_private_link_endpoint_network_policies = false |
| 144 | + + enforce_private_link_service_network_policies = false |
| 145 | + + id = (known after apply) |
| 146 | + + name = "demo-postgresql-fs-dev-subnet" |
| 147 | + + resource_group_name = "demo-postgresql-fs-dev-rg" |
| 148 | + + service_endpoints = [ |
| 149 | + + "Microsoft.Storage", |
| 150 | + ] |
| 151 | + + virtual_network_name = "demo-postgresql-fs-dev-vnet" |
| 152 | + |
| 153 | + + delegation { |
| 154 | + + name = "fs" |
| 155 | + |
| 156 | + + service_delegation { |
| 157 | + + actions = [ |
| 158 | + + "Microsoft.Network/virtualNetworks/subnets/join/action", |
| 159 | + ] |
| 160 | + + name = "Microsoft.DBforPostgreSQL/flexibleServers" |
| 161 | + } |
| 162 | + } |
| 163 | + } |
| 164 | + |
| 165 | + # azurerm_subnet_network_security_group_association.default will be created |
| 166 | + + resource "azurerm_subnet_network_security_group_association" "default" { |
| 167 | + + id = (known after apply) |
| 168 | + + network_security_group_id = (known after apply) |
| 169 | + + subnet_id = (known after apply) |
| 170 | + } |
| 171 | + |
| 172 | + # azurerm_virtual_network.default will be created |
| 173 | + + resource "azurerm_virtual_network" "default" { |
| 174 | + + address_space = [ |
| 175 | + + "10.0.0.0/16", |
| 176 | + ] |
| 177 | + + dns_servers = (known after apply) |
| 178 | + + guid = (known after apply) |
| 179 | + + id = (known after apply) |
| 180 | + + location = "westeurope" |
| 181 | + + name = "demo-postgresql-fs-dev-vnet" |
| 182 | + + resource_group_name = "demo-postgresql-fs-dev-rg" |
| 183 | + + subnet = (known after apply) |
| 184 | + + vm_protection_enabled = false |
| 185 | + } |
| 186 | + |
| 187 | +Plan: 9 to add, 0 to change, 0 to destroy. |
| 188 | + |
| 189 | +Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now. |
| 190 | +``` |
0 commit comments