import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Manages a PostgreSQL Server. * * > **Note:** The `azure.postgresql.Server` resource is deprecated and will be removed in v5.0 of the AzureRM Provider. Azure Database for PostgreSQL Single Server and its sub resources have been retired as of 2025-03-28, please use the `azure.postgresql.FlexibleServer` resource instead. For more information, see https://techcommunity.microsoft.com/blog/adforpostgresql/retiring-azure-database-for-postgresql-single-server-in-2025/3783783. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azure from "@pulumi/azure"; * * const example = new azure.core.ResourceGroup("example", { * name: "example-resources", * location: "West Europe", * }); * const exampleServer = new azure.postgresql.Server("example", { * name: "example-psqlserver", * location: example.location, * resourceGroupName: example.name, * administratorLogin: "psqladmin", * administratorLoginPassword: "H@Sh1CoR3!", * skuName: "GP_Gen5_4", * version: "11", * storageMb: 640000, * backupRetentionDays: 7, * geoRedundantBackupEnabled: true, * autoGrowEnabled: true, * publicNetworkAccessEnabled: false, * sslEnforcementEnabled: true, * sslMinimalTlsVersionEnforced: "TLS1_2", * }); * ``` * * ## API Providers * * * This resource uses the following Azure API Providers: * * * `Microsoft.DBforPostgreSQL` - 2017-12-01 * * ## Import * * PostgreSQL Server's can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:postgresql/server:Server server1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.DBforPostgreSQL/servers/server1 * ``` */ export declare class Server extends pulumi.CustomResource { /** * Get an existing Server resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: ServerState, opts?: pulumi.CustomResourceOptions): Server; /** * Returns true if the given object is an instance of Server. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Server; /** * The Administrator login for the PostgreSQL Server. Required when `createMode` is `Default`. Changing this forces a new resource to be created. */ readonly administratorLogin: pulumi.Output; /** * The Password associated with the `administratorLogin` for the PostgreSQL Server. */ readonly administratorLoginPassword: pulumi.Output; /** * An integer value used to trigger an update for `administratorLoginPasswordWo`. This property should be incremented when updating `administratorLoginPasswordWo`. */ readonly administratorLoginPasswordWoVersion: pulumi.Output; /** * 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. Defaults to `true`. */ readonly autoGrowEnabled: pulumi.Output; /** * Backup retention days for the server, supported values are between `7` and `35` days. */ readonly backupRetentionDays: pulumi.Output; /** * The creation mode. Can be used to restore or replicate existing servers. Possible values are `Default`, `Replica`, `GeoRestore`, and `PointInTimeRestore`. Defaults to `Default`. */ readonly createMode: pulumi.Output; /** * For creation modes other than `Default`, the source server ID to use. */ readonly creationSourceServerId: pulumi.Output; /** * The FQDN of the PostgreSQL Server. */ readonly fqdn: pulumi.Output; /** * 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. */ readonly geoRedundantBackupEnabled: pulumi.Output; /** * An `identity` block as defined below. */ readonly identity: pulumi.Output; /** * 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. */ readonly infrastructureEncryptionEnabled: pulumi.Output; /** * Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. */ readonly location: pulumi.Output; /** * Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created. */ readonly name: pulumi.Output; /** * Whether or not public network access is allowed for this server. Defaults to `true`. */ readonly publicNetworkAccessEnabled: pulumi.Output; /** * The name of the resource group in which to create the PostgreSQL Server. Changing this forces a new resource to be created. */ readonly resourceGroupName: pulumi.Output; /** * When `createMode` is `PointInTimeRestore` the point in time to restore from `creationSourceServerId`. It should be provided in [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) format, e.g. `2013-11-08T22:00:40Z`. */ readonly restorePointInTime: pulumi.Output; /** * Specifies the SKU Name for this PostgreSQL Server. The name of the SKU, follows the `tier` + `family` + `cores` pattern (e.g. `B_Gen4_1`, `GP_Gen5_8`). For more information see the [product documentation](https://docs.microsoft.com/rest/api/postgresql/singleserver/servers/create#sku). Possible values are `B_Gen4_1`, `B_Gen4_2`, `B_Gen5_1`, `B_Gen5_2`, `GP_Gen4_2`, `GP_Gen4_4`, `GP_Gen4_8`, `GP_Gen4_16`, `GP_Gen4_32`, `GP_Gen5_2`, `GP_Gen5_4`, `GP_Gen5_8`, `GP_Gen5_16`, `GP_Gen5_32`, `GP_Gen5_64`, `MO_Gen5_2`, `MO_Gen5_4`, `MO_Gen5_8`, `MO_Gen5_16` and `MO_Gen5_32`. * * > **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](https://docs.microsoft.com/azure/postgresql/concepts-read-replicas#scaling) */ readonly skuName: pulumi.Output; /** * Specifies if SSL should be enforced on connections. Possible values are `true` and `false`. * * > **Note:** `sslMinimalTlsVersionEnforced` must be set to `TLSEnforcementDisabled` when `sslEnforcementEnabled` is set to `false`. */ readonly sslEnforcementEnabled: pulumi.Output; /** * The minimum TLS version to support on the sever. Possible values are `TLSEnforcementDisabled`, `TLS1_0`, `TLS1_1`, and `TLS1_2`. Defaults to `TLS1_2`. */ readonly sslMinimalTlsVersionEnforced: pulumi.Output; /** * Max storage allowed for a server. Possible values are between `5120` MB(5GB) and `1048576` MB(1TB) for the Basic SKU and between `5120` MB(5GB) and `16777216` MB(16TB) for General Purpose/Memory Optimized SKUs. For more information see the [product documentation](https://docs.microsoft.com/azure/postgresql/concepts-pricing-tiers#storage). */ readonly storageMb: pulumi.Output; /** * A mapping of tags to assign to the resource. */ readonly tags: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Threat detection policy configuration, known in the API as Server Security Alerts Policy. The `threatDetectionPolicy` block supports fields documented below. */ readonly threatDetectionPolicy: pulumi.Output; /** * Specifies the version of PostgreSQL to use. Valid values are `9.5`, `9.6`, `10`, `10.0`, `10.2` and `11`. Changing this forces a new resource to be created. */ readonly version: pulumi.Output; /** * Create a Server resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: ServerArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Server resources. */ export interface ServerState { /** * The Administrator login for the PostgreSQL Server. Required when `createMode` is `Default`. Changing this forces a new resource to be created. */ administratorLogin?: pulumi.Input; /** * The Password associated with the `administratorLogin` for the PostgreSQL Server. */ administratorLoginPassword?: pulumi.Input; /** * An integer value used to trigger an update for `administratorLoginPasswordWo`. This property should be incremented when updating `administratorLoginPasswordWo`. */ administratorLoginPasswordWoVersion?: pulumi.Input; /** * 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. Defaults to `true`. */ autoGrowEnabled?: pulumi.Input; /** * Backup retention days for the server, supported values are between `7` and `35` days. */ backupRetentionDays?: pulumi.Input; /** * The creation mode. Can be used to restore or replicate existing servers. Possible values are `Default`, `Replica`, `GeoRestore`, and `PointInTimeRestore`. Defaults to `Default`. */ createMode?: pulumi.Input; /** * For creation modes other than `Default`, the source server ID to use. */ creationSourceServerId?: pulumi.Input; /** * The FQDN of the PostgreSQL Server. */ fqdn?: pulumi.Input; /** * 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. */ geoRedundantBackupEnabled?: pulumi.Input; /** * An `identity` block as defined below. */ identity?: pulumi.Input; /** * 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. */ infrastructureEncryptionEnabled?: pulumi.Input; /** * Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. */ location?: pulumi.Input; /** * Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * Whether or not public network access is allowed for this server. Defaults to `true`. */ publicNetworkAccessEnabled?: pulumi.Input; /** * The name of the resource group in which to create the PostgreSQL Server. Changing this forces a new resource to be created. */ resourceGroupName?: pulumi.Input; /** * When `createMode` is `PointInTimeRestore` the point in time to restore from `creationSourceServerId`. It should be provided in [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) format, e.g. `2013-11-08T22:00:40Z`. */ restorePointInTime?: pulumi.Input; /** * Specifies the SKU Name for this PostgreSQL Server. The name of the SKU, follows the `tier` + `family` + `cores` pattern (e.g. `B_Gen4_1`, `GP_Gen5_8`). For more information see the [product documentation](https://docs.microsoft.com/rest/api/postgresql/singleserver/servers/create#sku). Possible values are `B_Gen4_1`, `B_Gen4_2`, `B_Gen5_1`, `B_Gen5_2`, `GP_Gen4_2`, `GP_Gen4_4`, `GP_Gen4_8`, `GP_Gen4_16`, `GP_Gen4_32`, `GP_Gen5_2`, `GP_Gen5_4`, `GP_Gen5_8`, `GP_Gen5_16`, `GP_Gen5_32`, `GP_Gen5_64`, `MO_Gen5_2`, `MO_Gen5_4`, `MO_Gen5_8`, `MO_Gen5_16` and `MO_Gen5_32`. * * > **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](https://docs.microsoft.com/azure/postgresql/concepts-read-replicas#scaling) */ skuName?: pulumi.Input; /** * Specifies if SSL should be enforced on connections. Possible values are `true` and `false`. * * > **Note:** `sslMinimalTlsVersionEnforced` must be set to `TLSEnforcementDisabled` when `sslEnforcementEnabled` is set to `false`. */ sslEnforcementEnabled?: pulumi.Input; /** * The minimum TLS version to support on the sever. Possible values are `TLSEnforcementDisabled`, `TLS1_0`, `TLS1_1`, and `TLS1_2`. Defaults to `TLS1_2`. */ sslMinimalTlsVersionEnforced?: pulumi.Input; /** * Max storage allowed for a server. Possible values are between `5120` MB(5GB) and `1048576` MB(1TB) for the Basic SKU and between `5120` MB(5GB) and `16777216` MB(16TB) for General Purpose/Memory Optimized SKUs. For more information see the [product documentation](https://docs.microsoft.com/azure/postgresql/concepts-pricing-tiers#storage). */ storageMb?: pulumi.Input; /** * A mapping of tags to assign to the resource. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Threat detection policy configuration, known in the API as Server Security Alerts Policy. The `threatDetectionPolicy` block supports fields documented below. */ threatDetectionPolicy?: pulumi.Input; /** * Specifies the version of PostgreSQL to use. Valid values are `9.5`, `9.6`, `10`, `10.0`, `10.2` and `11`. Changing this forces a new resource to be created. */ version?: pulumi.Input; } /** * The set of arguments for constructing a Server resource. */ export interface ServerArgs { /** * The Administrator login for the PostgreSQL Server. Required when `createMode` is `Default`. Changing this forces a new resource to be created. */ administratorLogin?: pulumi.Input; /** * The Password associated with the `administratorLogin` for the PostgreSQL Server. */ administratorLoginPassword?: pulumi.Input; /** * An integer value used to trigger an update for `administratorLoginPasswordWo`. This property should be incremented when updating `administratorLoginPasswordWo`. */ administratorLoginPasswordWoVersion?: pulumi.Input; /** * 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. Defaults to `true`. */ autoGrowEnabled?: pulumi.Input; /** * Backup retention days for the server, supported values are between `7` and `35` days. */ backupRetentionDays?: pulumi.Input; /** * The creation mode. Can be used to restore or replicate existing servers. Possible values are `Default`, `Replica`, `GeoRestore`, and `PointInTimeRestore`. Defaults to `Default`. */ createMode?: pulumi.Input; /** * For creation modes other than `Default`, the source server ID to use. */ creationSourceServerId?: pulumi.Input; /** * 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. */ geoRedundantBackupEnabled?: pulumi.Input; /** * An `identity` block as defined below. */ identity?: pulumi.Input; /** * 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. */ infrastructureEncryptionEnabled?: pulumi.Input; /** * Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. */ location?: pulumi.Input; /** * Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * Whether or not public network access is allowed for this server. Defaults to `true`. */ publicNetworkAccessEnabled?: pulumi.Input; /** * The name of the resource group in which to create the PostgreSQL Server. Changing this forces a new resource to be created. */ resourceGroupName: pulumi.Input; /** * When `createMode` is `PointInTimeRestore` the point in time to restore from `creationSourceServerId`. It should be provided in [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) format, e.g. `2013-11-08T22:00:40Z`. */ restorePointInTime?: pulumi.Input; /** * Specifies the SKU Name for this PostgreSQL Server. The name of the SKU, follows the `tier` + `family` + `cores` pattern (e.g. `B_Gen4_1`, `GP_Gen5_8`). For more information see the [product documentation](https://docs.microsoft.com/rest/api/postgresql/singleserver/servers/create#sku). Possible values are `B_Gen4_1`, `B_Gen4_2`, `B_Gen5_1`, `B_Gen5_2`, `GP_Gen4_2`, `GP_Gen4_4`, `GP_Gen4_8`, `GP_Gen4_16`, `GP_Gen4_32`, `GP_Gen5_2`, `GP_Gen5_4`, `GP_Gen5_8`, `GP_Gen5_16`, `GP_Gen5_32`, `GP_Gen5_64`, `MO_Gen5_2`, `MO_Gen5_4`, `MO_Gen5_8`, `MO_Gen5_16` and `MO_Gen5_32`. * * > **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](https://docs.microsoft.com/azure/postgresql/concepts-read-replicas#scaling) */ skuName: pulumi.Input; /** * Specifies if SSL should be enforced on connections. Possible values are `true` and `false`. * * > **Note:** `sslMinimalTlsVersionEnforced` must be set to `TLSEnforcementDisabled` when `sslEnforcementEnabled` is set to `false`. */ sslEnforcementEnabled: pulumi.Input; /** * The minimum TLS version to support on the sever. Possible values are `TLSEnforcementDisabled`, `TLS1_0`, `TLS1_1`, and `TLS1_2`. Defaults to `TLS1_2`. */ sslMinimalTlsVersionEnforced?: pulumi.Input; /** * Max storage allowed for a server. Possible values are between `5120` MB(5GB) and `1048576` MB(1TB) for the Basic SKU and between `5120` MB(5GB) and `16777216` MB(16TB) for General Purpose/Memory Optimized SKUs. For more information see the [product documentation](https://docs.microsoft.com/azure/postgresql/concepts-pricing-tiers#storage). */ storageMb?: pulumi.Input; /** * A mapping of tags to assign to the resource. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Threat detection policy configuration, known in the API as Server Security Alerts Policy. The `threatDetectionPolicy` block supports fields documented below. */ threatDetectionPolicy?: pulumi.Input; /** * Specifies the version of PostgreSQL to use. Valid values are `9.5`, `9.6`, `10`, `10.0`, `10.2` and `11`. Changing this forces a new resource to be created. */ version: pulumi.Input; }