azurermPostgresqlServer
Manages a PostgreSQL Server.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "West Europe",
name: "example-resources",
}
);
const azurermPostgresqlServerExample =
new azurerm.postgresqlServer.PostgresqlServer(this, "example_1", {
administrator_login: "psqladmin",
administrator_login_password: "H@Sh1CoR3!",
auto_grow_enabled: true,
backup_retention_days: 7,
geo_redundant_backup_enabled: true,
location: azurermResourceGroupExample.location,
name: "example-psqlserver",
public_network_access_enabled: false,
resource_group_name: azurermResourceGroupExample.name,
sku_name: "GP_Gen5_4",
ssl_enforcement_enabled: true,
ssl_minimal_tls_version_enforced: "TLS1_2",
storage_mb: 640000,
version: "11",
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermPostgresqlServerExample.overrideLogicalId("example");
Argument Reference
The following arguments are supported:
-
name
- (Required) Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created. -
resourceGroupName
- (Required) The name of the resource group in which to create the PostgreSQL Server. Changing this forces a new resource to be created. -
location
- (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. -
skuName
- (Required) Specifies the SKU Name for this PostgreSQL Server. The name of the SKU, follows thetier
+family
+cores
pattern (e.g.bGen41
,gpGen58
). For more information see the product documentation. Possible values arebGen41
,bGen42
,bGen51
,bGen52
,gpGen42
,gpGen44
,gpGen48
,gpGen416
,gpGen432
,gpGen52
,gpGen54
,gpGen58
,gpGen516
,gpGen532
,gpGen564
,moGen52
,moGen54
,moGen58
,moGen516
andmoGen532
.
\~> NOTE: When replication is set up and skuName
is changed to a higher tier or more capacity for the primary, all replicas are scaled up to the same tier/capacity. This is an Azure requirement, for more information see the replica scaling documentation
-
version
- (Required) Specifies the version of PostgreSQL to use. Valid values are95
,96
,10
,100
,102
and11
. Changing this forces a new resource to be created. -
administratorLogin
- (Optional) The Administrator login for the PostgreSQL Server. Required whencreateMode
isdefault
. Changing this forces a new resource to be created. -
administratorLoginPassword
- (Optional) The Password associated with theadministratorLogin
for the PostgreSQL Server. Required whencreateMode
isdefault
. -
autoGrowEnabled
- (Optional) Enable/Disable auto-growing of the storage. Storage auto-grow prevents your server from running out of storage and becoming read-only. If storage auto grow is enabled, the storage automatically grows without impacting the workload. The default value if not explicitly specified istrue
. -
backupRetentionDays
- (Optional) Backup retention days for the server, supported values are between7
and35
days. -
createMode
- (Optional) The creation mode. Can be used to restore or replicate existing servers. Possible values aredefault
,replica
,geoRestore
, andpointInTimeRestore
. Defaults todefault
-
creationSourceServerId
- (Optional) For creation modes other thandefault
, the source server ID to use. -
geoRedundantBackupEnabled
- (Optional) 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. This is not support for the Basic tier. Changing this forces a new resource to be created. -
identity
- (Optional) Anidentity
block as defined below. -
infrastructureEncryptionEnabled
- (Optional) Whether or not infrastructure is encrypted for this server. Changing this forces a new resource to be created.
\~> NOTE: This property is currently still in development and not supported by Microsoft. If the infrastructureEncryptionEnabled
attribute is set to true
the PostgreSQL instance will incur a substantial performance degradation due to a second encryption pass on top of the existing default encryption that is already provided by Azure Storage. It is strongly suggested to leave this value false
as not doing so can lead to unclear error messages.
-
publicNetworkAccessEnabled
- (Optional) Whether or not public network access is allowed for this server. Defaults totrue
. -
restorePointInTime
- (Optional) WhencreateMode
ispointInTimeRestore
the point in time to restore fromcreationSourceServerId
. It should be provided in RFC3339 format, e.g.20131108T22:00:40Z
. -
sslEnforcementEnabled
- (Required) Specifies if SSL should be enforced on connections. Possible values aretrue
andfalse
.
-> NOTE: sslMinimalTlsVersionEnforced
must be set to tlsEnforcementDisabled
when sslEnforcementEnabled
is set to false
.
-
sslMinimalTlsVersionEnforced
- (Optional) The minimum TLS version to support on the sever. Possible values aretlsEnforcementDisabled
,tls10
,tls11
, andtls12
. Defaults totls12
. -
storageMb
- (Optional) Max storage allowed for a server. Possible values are between5120
MB(5GB) and1048576
MB(1TB) for the Basic SKU and between5120
MB(5GB) and16777216
MB(16TB) for General Purpose/Memory Optimized SKUs. For more information see the product documentation. -
threatDetectionPolicy
- (Optional) Threat detection policy configuration, known in the API as Server Security Alerts Policy. ThethreatDetectionPolicy
block supports fields documented below. -
tags
- (Optional) A mapping of tags to assign to the resource.
A identity
block supports the following:
type
- (Required) Specifies the type of Managed Service Identity that should be configured on this PostgreSQL Server. The only possible value issystemAssigned
.
a threatDetectionPolicy
block supports the following:
-
enabled
- (Optional) Is the policy enabled? -
disabledAlerts
- (Optional) Specifies a list of alerts which should be disabled. Possible values aresqlInjection
,sqlInjectionVulnerability
,accessAnomaly
,dataExfiltration
andunsafeAction
. -
emailAccountAdmins
- (Optional) Should the account administrators be emailed when this alert is triggered? -
emailAddresses
- (Optional) A list of email addresses which alerts should be sent to. -
retentionDays
- (Optional) Specifies the number of days to keep in the Threat Detection audit logs. -
storageAccountAccessKey
- (Optional) Specifies the identifier key of the Threat Detection audit storage account. -
storageEndpoint
- (Optional) Specifies the blob storage endpoint (e.g. https://example.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.
Attributes Reference
The following attributes are exported:
-
id
- The ID of the PostgreSQL Server. -
fqdn
- The FQDN of the PostgreSQL Server. -
identity
- Anidentity
block as documented below.
An identity
block exports the following:
-
principalId
- The Principal ID associated with this Managed Service Identity. -
tenantId
- The Tenant ID associated with this Managed Service Identity.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 60 minutes) Used when creating the PostgreSQL Server.update
- (Defaults to 60 minutes) Used when updating the PostgreSQL Server.read
- (Defaults to 5 minutes) Used when retrieving the PostgreSQL Server.delete
- (Defaults to 60 minutes) Used when deleting the PostgreSQL Server.
Import
PostgreSQL Server's can be imported using the resourceId
, e.g.