import * as pulumi from "@pulumi/pulumi"; /** * Manages a PostgreSQL Virtual Network Rule. * * > **Note:** The `azure.postgresql.VirtualNetworkRule` 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. For more information, see https://techcommunity.microsoft.com/blog/adforpostgresql/retiring-azure-database-for-postgresql-single-server-in-2025/3783783. * * > **Note:** PostgreSQL Virtual Network Rules [can only be used with SKU Tiers of `GeneralPurpose` or `MemoryOptimized`](https://docs.microsoft.com/azure/postgresql/concepts-data-access-and-security-vnet) * * ## 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 exampleVirtualNetwork = new azure.network.VirtualNetwork("example", { * name: "example-vnet", * addressSpaces: ["10.7.29.0/29"], * location: example.location, * resourceGroupName: example.name, * }); * const internal = new azure.network.Subnet("internal", { * name: "internal", * resourceGroupName: example.name, * virtualNetworkName: exampleVirtualNetwork.name, * addressPrefixes: ["10.7.29.0/29"], * serviceEndpoints: ["Microsoft.Sql"], * }); * const exampleServer = new azure.postgresql.Server("example", { * name: "postgresql-server-1", * location: example.location, * resourceGroupName: example.name, * skuName: "GP_Gen5_2", * storageMb: 5120, * backupRetentionDays: 7, * administratorLogin: "psqladmin", * administratorLoginPassword: "H@Sh1CoR3!", * version: "9.5", * sslEnforcementEnabled: true, * }); * const exampleVirtualNetworkRule = new azure.postgresql.VirtualNetworkRule("example", { * name: "postgresql-vnet-rule", * resourceGroupName: example.name, * serverName: exampleServer.name, * subnetId: internal.id, * ignoreMissingVnetServiceEndpoint: true, * }); * ``` * * ## API Providers * * * This resource uses the following Azure API Providers: * * * `Microsoft.DBforPostgreSQL` - 2017-12-01 * * ## Import * * PostgreSQL Virtual Network Rules can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:postgresql/virtualNetworkRule:VirtualNetworkRule rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.DBforPostgreSQL/servers/myserver/virtualNetworkRules/vnetrulename * ``` */ export declare class VirtualNetworkRule extends pulumi.CustomResource { /** * Get an existing VirtualNetworkRule 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?: VirtualNetworkRuleState, opts?: pulumi.CustomResourceOptions): VirtualNetworkRule; /** * Returns true if the given object is an instance of VirtualNetworkRule. 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 VirtualNetworkRule; /** * Should the Virtual Network Rule be created before the Subnet has the Virtual Network Service Endpoint enabled? */ readonly ignoreMissingVnetServiceEndpoint: pulumi.Output; /** * The name of the PostgreSQL virtual network rule. Cannot be empty and must only contain alphanumeric characters and hyphens. Cannot start with a number, and cannot start or end with a hyphen. Changing this forces a new resource to be created. * * > **Note:** `name` must be between 1-128 characters long and must satisfy all of the requirements below: * * 1. Contains only alphanumeric and hyphen characters * 2. Cannot start with a number or hyphen * 3. Cannot end with a hyphen */ readonly name: pulumi.Output; /** * The name of the resource group where the PostgreSQL server resides. Changing this forces a new resource to be created. */ readonly resourceGroupName: pulumi.Output; /** * The name of the SQL Server to which this PostgreSQL virtual network rule will be applied to. Changing this forces a new resource to be created. */ readonly serverName: pulumi.Output; /** * The ID of the subnet that the PostgreSQL server will be connected to. */ readonly subnetId: pulumi.Output; /** * Create a VirtualNetworkRule 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: VirtualNetworkRuleArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering VirtualNetworkRule resources. */ export interface VirtualNetworkRuleState { /** * Should the Virtual Network Rule be created before the Subnet has the Virtual Network Service Endpoint enabled? */ ignoreMissingVnetServiceEndpoint?: pulumi.Input; /** * The name of the PostgreSQL virtual network rule. Cannot be empty and must only contain alphanumeric characters and hyphens. Cannot start with a number, and cannot start or end with a hyphen. Changing this forces a new resource to be created. * * > **Note:** `name` must be between 1-128 characters long and must satisfy all of the requirements below: * * 1. Contains only alphanumeric and hyphen characters * 2. Cannot start with a number or hyphen * 3. Cannot end with a hyphen */ name?: pulumi.Input; /** * The name of the resource group where the PostgreSQL server resides. Changing this forces a new resource to be created. */ resourceGroupName?: pulumi.Input; /** * The name of the SQL Server to which this PostgreSQL virtual network rule will be applied to. Changing this forces a new resource to be created. */ serverName?: pulumi.Input; /** * The ID of the subnet that the PostgreSQL server will be connected to. */ subnetId?: pulumi.Input; } /** * The set of arguments for constructing a VirtualNetworkRule resource. */ export interface VirtualNetworkRuleArgs { /** * Should the Virtual Network Rule be created before the Subnet has the Virtual Network Service Endpoint enabled? */ ignoreMissingVnetServiceEndpoint?: pulumi.Input; /** * The name of the PostgreSQL virtual network rule. Cannot be empty and must only contain alphanumeric characters and hyphens. Cannot start with a number, and cannot start or end with a hyphen. Changing this forces a new resource to be created. * * > **Note:** `name` must be between 1-128 characters long and must satisfy all of the requirements below: * * 1. Contains only alphanumeric and hyphen characters * 2. Cannot start with a number or hyphen * 3. Cannot end with a hyphen */ name?: pulumi.Input; /** * The name of the resource group where the PostgreSQL server resides. Changing this forces a new resource to be created. */ resourceGroupName: pulumi.Input; /** * The name of the SQL Server to which this PostgreSQL virtual network rule will be applied to. Changing this forces a new resource to be created. */ serverName: pulumi.Input; /** * The ID of the subnet that the PostgreSQL server will be connected to. */ subnetId: pulumi.Input; }