import * as pulumi from "@pulumi/pulumi"; /** * Manages a Customer Managed Key for a PostgreSQL Server. * * > **Note:** The `azure.postgresql.ServerKey` 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. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azure from "@pulumi/azure"; * * const current = azure.core.getClientConfig({}); * const example = new azure.core.ResourceGroup("example", { * name: "example-resources", * location: "West Europe", * }); * const exampleKeyVault = new azure.keyvault.KeyVault("example", { * name: "examplekv", * location: example.location, * resourceGroupName: example.name, * tenantId: current.then(current => current.tenantId), * skuName: "premium", * purgeProtectionEnabled: true, * }); * const exampleServer = new azure.postgresql.Server("example", { * name: "example-postgre-server", * location: example.location, * resourceGroupName: example.name, * administratorLogin: "psqladmin", * administratorLoginPassword: "H@Sh1CoR3!", * skuName: "GP_Gen5_2", * version: "11", * storageMb: 51200, * sslEnforcementEnabled: true, * identity: { * type: "SystemAssigned", * }, * }); * const server = new azure.keyvault.AccessPolicy("server", { * keyVaultId: exampleKeyVault.id, * tenantId: current.then(current => current.tenantId), * objectId: exampleServer.identity.apply(identity => identity?.principalId), * keyPermissions: [ * "Get", * "UnwrapKey", * "WrapKey", * ], * secretPermissions: ["Get"], * }); * const client = new azure.keyvault.AccessPolicy("client", { * keyVaultId: exampleKeyVault.id, * tenantId: current.then(current => current.tenantId), * objectId: current.then(current => current.objectId), * keyPermissions: [ * "Get", * "Create", * "Delete", * "List", * "Restore", * "Recover", * "UnwrapKey", * "WrapKey", * "Purge", * "Encrypt", * "Decrypt", * "Sign", * "Verify", * "GetRotationPolicy", * ], * secretPermissions: ["Get"], * }); * const exampleKey = new azure.keyvault.Key("example", { * name: "tfex-key", * keyVaultId: exampleKeyVault.id, * keyType: "RSA", * keySize: 2048, * keyOpts: [ * "decrypt", * "encrypt", * "sign", * "unwrapKey", * "verify", * "wrapKey", * ], * }, { * dependsOn: [ * client, * server, * ], * }); * const exampleServerKey = new azure.postgresql.ServerKey("example", { * serverId: exampleServer.id, * keyVaultKeyId: exampleKey.id, * }); * ``` * * ## API Providers * * * This resource uses the following Azure API Providers: * * * `Microsoft.DBforPostgreSQL` - 2020-01-01 * * ## Import * * A PostgreSQL Server Key can be imported using the `resource id` of the PostgreSQL Server Key, e.g. * * ```sh * $ pulumi import azure:postgresql/serverKey:ServerKey example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DBforPostgreSQL/servers/server1/keys/keyvaultname_key-name_keyversion * ``` */ export declare class ServerKey extends pulumi.CustomResource { /** * Get an existing ServerKey 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?: ServerKeyState, opts?: pulumi.CustomResourceOptions): ServerKey; /** * Returns true if the given object is an instance of ServerKey. 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 ServerKey; /** * The URL to a Key Vault Key. */ readonly keyVaultKeyId: pulumi.Output; /** * The ID of the PostgreSQL Server. Changing this forces a new resource to be created. */ readonly serverId: pulumi.Output; /** * Create a ServerKey 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: ServerKeyArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering ServerKey resources. */ export interface ServerKeyState { /** * The URL to a Key Vault Key. */ keyVaultKeyId?: pulumi.Input; /** * The ID of the PostgreSQL Server. Changing this forces a new resource to be created. */ serverId?: pulumi.Input; } /** * The set of arguments for constructing a ServerKey resource. */ export interface ServerKeyArgs { /** * The URL to a Key Vault Key. */ keyVaultKeyId: pulumi.Input; /** * The ID of the PostgreSQL Server. Changing this forces a new resource to be created. */ serverId: pulumi.Input; }