import * as pulumi from "@pulumi/pulumi"; /** * Manages a PostgreSQL Database within a PostgreSQL Server * * > **Note:** The `azure.postgresql.Database` 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.FlexibleServerDatabase` resource instead. For more information, see https://techcommunity.microsoft.com/blog/adforpostgresql/retiring-azure-database-for-postgresql-single-server-in-2025/3783783. * * !> **Note:** To mitigate the possibility of accidental data loss it is highly recommended that you use the `preventDestroy` lifecycle argument in your configuration file for this resource. For more information on the `preventDestroy` lifecycle argument please see the terraform documentation. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azure from "@pulumi/azure"; * * const example = new azure.core.ResourceGroup("example", { * name: "api-rg-pro", * location: "West Europe", * }); * const exampleServer = new azure.postgresql.Server("example", { * name: "postgresql-server-1", * location: example.location, * resourceGroupName: example.name, * skuName: "B_Gen5_2", * storageMb: 5120, * backupRetentionDays: 7, * geoRedundantBackupEnabled: false, * autoGrowEnabled: true, * administratorLogin: "psqladmin", * administratorLoginPassword: "H@Sh1CoR3!", * version: "9.5", * sslEnforcementEnabled: true, * }); * const exampleDatabase = new azure.postgresql.Database("example", { * name: "exampledb", * resourceGroupName: example.name, * serverName: exampleServer.name, * charset: "UTF8", * collation: "English_United States.1252", * }); * ``` * * ## API Providers * * * This resource uses the following Azure API Providers: * * * `Microsoft.DBforPostgreSQL` - 2017-12-01 * * ## Import * * PostgreSQL Database's can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:postgresql/database:Database database1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/databases/database1 * ``` */ export declare class Database extends pulumi.CustomResource { /** * Get an existing Database 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?: DatabaseState, opts?: pulumi.CustomResourceOptions): Database; /** * Returns true if the given object is an instance of Database. 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 Database; /** * Specifies the Charset for the PostgreSQL Database, which needs [to be a valid PostgreSQL Charset](https://www.postgresql.org/docs/current/static/multibyte.html). Changing this forces a new resource to be created. */ readonly charset: pulumi.Output; /** * Specifies the Collation for the PostgreSQL Database, which needs [to be a valid PostgreSQL Collation](https://www.postgresql.org/docs/current/static/collation.html). Note that Microsoft uses different [notation](https://msdn.microsoft.com/library/windows/desktop/dd373814.aspx) - en-US instead of en_US. Changing this forces a new resource to be created. */ readonly collation: pulumi.Output; /** * Specifies the name of the PostgreSQL Database, which needs [to be a valid PostgreSQL identifier](https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS). Changing this forces a new resource to be created. */ readonly name: pulumi.Output; /** * The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created. */ readonly resourceGroupName: pulumi.Output; /** * Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created. */ readonly serverName: pulumi.Output; /** * Create a Database 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: DatabaseArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Database resources. */ export interface DatabaseState { /** * Specifies the Charset for the PostgreSQL Database, which needs [to be a valid PostgreSQL Charset](https://www.postgresql.org/docs/current/static/multibyte.html). Changing this forces a new resource to be created. */ charset?: pulumi.Input; /** * Specifies the Collation for the PostgreSQL Database, which needs [to be a valid PostgreSQL Collation](https://www.postgresql.org/docs/current/static/collation.html). Note that Microsoft uses different [notation](https://msdn.microsoft.com/library/windows/desktop/dd373814.aspx) - en-US instead of en_US. Changing this forces a new resource to be created. */ collation?: pulumi.Input; /** * Specifies the name of the PostgreSQL Database, which needs [to be a valid PostgreSQL identifier](https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS). Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created. */ resourceGroupName?: pulumi.Input; /** * Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created. */ serverName?: pulumi.Input; } /** * The set of arguments for constructing a Database resource. */ export interface DatabaseArgs { /** * Specifies the Charset for the PostgreSQL Database, which needs [to be a valid PostgreSQL Charset](https://www.postgresql.org/docs/current/static/multibyte.html). Changing this forces a new resource to be created. */ charset: pulumi.Input; /** * Specifies the Collation for the PostgreSQL Database, which needs [to be a valid PostgreSQL Collation](https://www.postgresql.org/docs/current/static/collation.html). Note that Microsoft uses different [notation](https://msdn.microsoft.com/library/windows/desktop/dd373814.aspx) - en-US instead of en_US. Changing this forces a new resource to be created. */ collation: pulumi.Input; /** * Specifies the name of the PostgreSQL Database, which needs [to be a valid PostgreSQL identifier](https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS). Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created. */ resourceGroupName: pulumi.Input; /** * Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created. */ serverName: pulumi.Input; }