© Copyright 2024, Intel Corporation
This module can be used to deploy an Intel optimized Azure PostgreSQL Flexible Server instance. Instance selection and PostgreSQL optimization are included by default in the code.
The PostgreSQL Optimizations were based off Intel Xeon Tuning guides
Boost Azure PostgreSQL performance by up to 1.42x with 3rd Generation Intel® Xeon® Scalable Processor (Ice Lake)
Process up to 1.24x more Azure PostgreSQL transactions with 3rd Generation Intel® Xeon® Scalable Processor (Ice Lake)
Up to 1.23x more Azure PostgreSQL OLTP transactions per minute with 3rd Generation Intel® Xeon® Scalable Processor (Ice Lake)
See examples folder for complete examples.
By default, you will only have to pass three variables
resource_group_name
db_server_name
db_password
variables.tf
variable "db_password" {
description = "Password for the master database user."
type = string
sensitive = true
}
main.tf
module "optimized-postgresql-server" {
source = "intel/azure-postgresql-flexible-server/intel"
resource_group_name = "<RESOURCE_GROUP_NAME>"
db_server_name = "<DB_SERVER_NAME>"
db_password = var.db_password
}
Run Terraform
export TF_VAR_db_password ='<USE_A_STRONG_PASSWORD>'
terraform init
terraform plan
terraform apply
If you see this error message below, this is because the pgsql_server_name already exist and the user needs to provide different unique pgsql_server_name.
Error Message ::: " Server Name: "optimized-pgsql-server"): polling after Create: Code="ServerGroupDropping" Message="Operations on a server group in dropping state are not allowed."
If you see this error message below, this is because the High Avability Mode is disabled for that region. Acceptable regions are Azure Region
Error Message ::: "Server Name: "optimized-postgres-server"): polling after Create: Code="HADisabledForRegion" Message="HA is disabled for region westus2.""
This module further provides the ability to add firewall_ip_range (Usage Example provided above). For more information azurerm_postgresql_flexible_server_firewall_rule
Note that this example creates resources. Run terraform destroy
when you don't need these resources.
Name | Version |
---|---|
terraform | >=1.3.0 |
azurerm | ~>3.86 |
Name | Version |
---|---|
azurerm | ~>3.86 |
No modules.
Name | Type |
---|---|
azurerm_postgresql_flexible_server.postgres | resource |
azurerm_postgresql_flexible_server_configuration.postgres | resource |
azurerm_postgresql_flexible_server_database.postgres | resource |
azurerm_postgresql_flexible_server_firewall_rule.firewall | resource |
azurerm_resource_group.rg | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
db_allocated_storage | The max storage allowed for the PostgreSQL Flexible Server. Possible values (MB) are 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, and 16777216. | number |
2097152 |
no |
db_backup_retention_period | The days to retain backups for. Must be between 1 and 35. | number |
7 |
no |
db_charset | Specifies the Charset for the database. | string |
"UTF8" |
no |
db_collation | Specifies the Collation for the Database. | string |
"en_US.UTF8" |
no |
db_create_mode | The creation mode which can be used to restore or replicate existing servers. | string |
"Default" |
no |
db_create_source_id | For creation modes other than Default, the source server ID to use. | string |
null |
no |
db_delegated_subnet_id | The ID of the virtual network subnet to create the Flexible Server. | string |
null |
no |
db_engine | Database engine for Azure database instance. | string |
"postgres" |
no |
db_engine_version | Database engine version for the Azure database instance. | string |
"14" |
no |
db_firewall_rules | Map of IP ranges that (if specified) will create firewall rules for the server to access those addresses. | list(object({ |
[] |
no |
db_geo_backup_enabled | Turn Geo-redundant server backups on/off. This allows you to choose between locally redundant or geo-redundant backup storage in the General Purpose and Memory Optimized tiers. When the backups are stored in geo-redundant backup storage, they are not only stored within the region in which your server is hosted, but are also replicated to a paired data center. This provides better protection and ability to restore your server in a different region in the event of a disaster | bool |
false |
no |
db_ha_mode | The high availability mode for the Flexible Server. Possibles values are ZoneRedundant. | string |
"ZoneRedundant" |
no |
db_ha_standby_zone | Specifies the Availability Zone in which the standby Flexible Server should be located. Possible values are 1, 2 and 3. | string |
"1" |
no |
db_maintenance_day | The day of week for maintenance window. | string |
null |
no |
db_maintenance_hour | The start hour for maintenance window. | string |
null |
no |
db_maintenance_minute | The start minute for maintenance window. | string |
null |
no |
db_name | Name of the database that will be created on the flexible instance. If this is specified then a database will be created as a part of the instance provisioning process. | string |
null |
no |
db_parameters | Intel Cloud optimizations for Xeon processors | object({ |
{ |
no |
db_password | Password for the master database user. | string |
n/a | yes |
db_private_dns_zone_id | The ID of the private DNS zone to create the Flexible Server. | string |
null |
no |
db_restore_time | When create_mode is PointInTimeRestore, specifies the point in time to restore from creation_source_server_id. It should be provided in RFC3339 format, e.g. 2013-11-08T22:00:40Z. | string |
null |
no |
db_server_name | Name of the server that will be created. | string |
n/a | yes |
db_server_sku | Instance SKU, see comments above for guidance | string |
"MO_Standard_E8ds_v4" |
no |
db_timeouts | Map of timeouts that can be adjusted when executing the module. This allows you to customize how long certain operations are allowed to take before being considered to have failed. | object({ |
{ |
no |
db_username | Username for the master database user. | string |
"pgadmin" |
no |
db_zone | Specifies the Availability Zone in which this Flexible Server should be located. Possible values are 1, 2 and 3. | string |
"2" |
no |
resource_group_name | Existing Resource Group where resource will be created. | string |
n/a | yes |
tags | Tags to apply to the Database Server | map(string) |
{} |
no |
Name | Description |
---|---|
db_allocated_storage | Storage allocated to the database instance. |
db_backup_retention | Number of configured backups to keep for the database instance. |
db_charset | The Charset configured on the database. |
db_collation | The Collation configured on the database. |
db_create_mode | The creation mode that was configured on the instance. |
db_create_source_id | For creation modes other than Default, the source server ID to use. |
db_delegated_subnet_id | The ID of the virtual network subnet to create the MySQL Flexible Server. |
db_engine_version_actual | Running engine version of the database (full version number) |
db_firewall_rules | Database Firewall Rules. |
db_ha_mode | The high availability mode for the MySQL Flexible Server. |
db_ha_standby_zone | Specifies the Availability Zone in which the standby Flexible Server should be located. |
db_hostname | Database instance fully qualified domain name. |
db_id | Database instance ID. |
db_location | Database instance location. |
db_maintenance_window_day | Maintainence window for the database instance. |
db_maintenance_window_hour | Maintainence window for the database instance. |
db_maintenance_window_minute | Maintainence window for the database instance. |
db_name | Name of the database that has been provisioned on the database instance. |
db_password | Database instance master password. |
db_private_dns_zone_id | The ID of the private DNS zone that the instance will use. |
db_resource_group_name | Resource Group where the database instance resides. |
db_restore_time | Specifies the point in time to restore from creation_source_server_id. |
db_server_name | Database instance hostname. |
db_server_sku | Instance SKU in use for the database instance that was created. |
db_username | Database instance master username. |
db_zone | Zone where the database instance was deployed. |