com.pulumi.azure.postgresql.Server Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure Show documentation
Show all versions of azure Show documentation
A Pulumi package for creating and managing Microsoft Azure cloud resources, based on the Terraform azurerm provider. We recommend using the [Azure Native provider](https://github.com/pulumi/pulumi-azure-native) to provision Azure infrastructure. Azure Native provides complete coverage of Azure resources and same-day access to new resources and resource updates.
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.azure.postgresql;
import com.pulumi.azure.Utilities;
import com.pulumi.azure.postgresql.ServerArgs;
import com.pulumi.azure.postgresql.inputs.ServerState;
import com.pulumi.azure.postgresql.outputs.ServerIdentity;
import com.pulumi.azure.postgresql.outputs.ServerThreatDetectionPolicy;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Boolean;
import java.lang.Integer;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Manages a PostgreSQL Server.
*
* ## Example Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azure.core.ResourceGroup;
* import com.pulumi.azure.core.ResourceGroupArgs;
* import com.pulumi.azure.postgresql.Server;
* import com.pulumi.azure.postgresql.ServerArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
*
* public class App }{{@code
* public static void main(String[] args) }{{@code
* Pulumi.run(App::stack);
* }}{@code
*
* public static void stack(Context ctx) }{{@code
* var example = new ResourceGroup("example", ResourceGroupArgs.builder()
* .name("example-resources")
* .location("West Europe")
* .build());
*
* var exampleServer = new Server("exampleServer", ServerArgs.builder()
* .name("example-psqlserver")
* .location(example.location())
* .resourceGroupName(example.name())
* .administratorLogin("psqladmin")
* .administratorLoginPassword("H}{@literal @}{@code Sh1CoR3!")
* .skuName("GP_Gen5_4")
* .version("11")
* .storageMb(640000)
* .backupRetentionDays(7)
* .geoRedundantBackupEnabled(true)
* .autoGrowEnabled(true)
* .publicNetworkAccessEnabled(false)
* .sslEnforcementEnabled(true)
* .sslMinimalTlsVersionEnforced("TLS1_2")
* .build());
*
* }}{@code
* }}{@code
* }
*
* <!--End PulumiCodeChooser -->
*
* ## 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
* ```
*
*/
@ResourceType(type="azure:postgresql/server:Server")
public class Server extends com.pulumi.resources.CustomResource {
/**
* The Administrator login for the PostgreSQL Server. Required when `create_mode` is `Default`. Changing this forces a new resource to be created.
*
*/
@Export(name="administratorLogin", refs={String.class}, tree="[0]")
private Output administratorLogin;
/**
* @return The Administrator login for the PostgreSQL Server. Required when `create_mode` is `Default`. Changing this forces a new resource to be created.
*
*/
public Output administratorLogin() {
return this.administratorLogin;
}
/**
* The Password associated with the `administrator_login` for the PostgreSQL Server. Required when `create_mode` is `Default`.
*
*/
@Export(name="administratorLoginPassword", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> administratorLoginPassword;
/**
* @return The Password associated with the `administrator_login` for the PostgreSQL Server. Required when `create_mode` is `Default`.
*
*/
public Output> administratorLoginPassword() {
return Codegen.optional(this.administratorLoginPassword);
}
/**
* 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`.
*
*/
@Export(name="autoGrowEnabled", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> autoGrowEnabled;
/**
* @return 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`.
*
*/
public Output> autoGrowEnabled() {
return Codegen.optional(this.autoGrowEnabled);
}
/**
* Backup retention days for the server, supported values are between `7` and `35` days.
*
*/
@Export(name="backupRetentionDays", refs={Integer.class}, tree="[0]")
private Output backupRetentionDays;
/**
* @return Backup retention days for the server, supported values are between `7` and `35` days.
*
*/
public Output backupRetentionDays() {
return this.backupRetentionDays;
}
/**
* The creation mode. Can be used to restore or replicate existing servers. Possible values are `Default`, `Replica`, `GeoRestore`, and `PointInTimeRestore`. Defaults to `Default`.
*
*/
@Export(name="createMode", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> createMode;
/**
* @return The creation mode. Can be used to restore or replicate existing servers. Possible values are `Default`, `Replica`, `GeoRestore`, and `PointInTimeRestore`. Defaults to `Default`.
*
*/
public Output> createMode() {
return Codegen.optional(this.createMode);
}
/**
* For creation modes other than `Default`, the source server ID to use.
*
*/
@Export(name="creationSourceServerId", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> creationSourceServerId;
/**
* @return For creation modes other than `Default`, the source server ID to use.
*
*/
public Output> creationSourceServerId() {
return Codegen.optional(this.creationSourceServerId);
}
/**
* The FQDN of the PostgreSQL Server.
*
*/
@Export(name="fqdn", refs={String.class}, tree="[0]")
private Output fqdn;
/**
* @return The FQDN of the PostgreSQL Server.
*
*/
public Output fqdn() {
return this.fqdn;
}
/**
* 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.
*
*/
@Export(name="geoRedundantBackupEnabled", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> geoRedundantBackupEnabled;
/**
* @return 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.
*
*/
public Output> geoRedundantBackupEnabled() {
return Codegen.optional(this.geoRedundantBackupEnabled);
}
/**
* An `identity` block as defined below.
*
*/
@Export(name="identity", refs={ServerIdentity.class}, tree="[0]")
private Output* @Nullable */ ServerIdentity> identity;
/**
* @return An `identity` block as defined below.
*
*/
public Output> identity() {
return Codegen.optional(this.identity);
}
/**
* 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 `infrastructure_encryption_enabled` 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.
*
*/
@Export(name="infrastructureEncryptionEnabled", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> infrastructureEncryptionEnabled;
/**
* @return 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 `infrastructure_encryption_enabled` 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.
*
*/
public Output> infrastructureEncryptionEnabled() {
return Codegen.optional(this.infrastructureEncryptionEnabled);
}
/**
* Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
*
*/
@Export(name="location", refs={String.class}, tree="[0]")
private Output location;
/**
* @return Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
*
*/
public Output location() {
return this.location;
}
/**
* Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created.
*
*/
public Output name() {
return this.name;
}
/**
* Whether or not public network access is allowed for this server. Defaults to `true`.
*
*/
@Export(name="publicNetworkAccessEnabled", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> publicNetworkAccessEnabled;
/**
* @return Whether or not public network access is allowed for this server. Defaults to `true`.
*
*/
public Output> publicNetworkAccessEnabled() {
return Codegen.optional(this.publicNetworkAccessEnabled);
}
/**
* The name of the resource group in which to create the PostgreSQL Server. Changing this forces a new resource to be created.
*
*/
@Export(name="resourceGroupName", refs={String.class}, tree="[0]")
private Output resourceGroupName;
/**
* @return The name of the resource group in which to create the PostgreSQL Server. Changing this forces a new resource to be created.
*
*/
public Output resourceGroupName() {
return this.resourceGroupName;
}
/**
* When `create_mode` is `PointInTimeRestore` the point in time to restore from `creation_source_server_id`. It should be provided in [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) format, e.g. `2013-11-08T22:00:40Z`.
*
*/
@Export(name="restorePointInTime", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> restorePointInTime;
/**
* @return When `create_mode` is `PointInTimeRestore` the point in time to restore from `creation_source_server_id`. It should be provided in [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) format, e.g. `2013-11-08T22:00:40Z`.
*
*/
public Output> restorePointInTime() {
return Codegen.optional(this.restorePointInTime);
}
/**
* 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 `sku_name` 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)
*
*/
@Export(name="skuName", refs={String.class}, tree="[0]")
private Output skuName;
/**
* @return 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 `sku_name` 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)
*
*/
public Output skuName() {
return this.skuName;
}
/**
* Specifies if SSL should be enforced on connections. Possible values are `true` and `false`.
*
* > **NOTE:** `ssl_minimal_tls_version_enforced` must be set to `TLSEnforcementDisabled` when `ssl_enforcement_enabled` is set to `false`.
*
*/
@Export(name="sslEnforcementEnabled", refs={Boolean.class}, tree="[0]")
private Output sslEnforcementEnabled;
/**
* @return Specifies if SSL should be enforced on connections. Possible values are `true` and `false`.
*
* > **NOTE:** `ssl_minimal_tls_version_enforced` must be set to `TLSEnforcementDisabled` when `ssl_enforcement_enabled` is set to `false`.
*
*/
public Output sslEnforcementEnabled() {
return this.sslEnforcementEnabled;
}
/**
* The minimum TLS version to support on the sever. Possible values are `TLSEnforcementDisabled`, `TLS1_0`, `TLS1_1`, and `TLS1_2`. Defaults to `TLS1_2`.
*
*/
@Export(name="sslMinimalTlsVersionEnforced", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> sslMinimalTlsVersionEnforced;
/**
* @return The minimum TLS version to support on the sever. Possible values are `TLSEnforcementDisabled`, `TLS1_0`, `TLS1_1`, and `TLS1_2`. Defaults to `TLS1_2`.
*
*/
public Output> sslMinimalTlsVersionEnforced() {
return Codegen.optional(this.sslMinimalTlsVersionEnforced);
}
/**
* 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).
*
*/
@Export(name="storageMb", refs={Integer.class}, tree="[0]")
private Output storageMb;
/**
* @return 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).
*
*/
public Output storageMb() {
return this.storageMb;
}
/**
* A mapping of tags to assign to the resource.
*
*/
@Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]")
private Output* @Nullable */ Map> tags;
/**
* @return A mapping of tags to assign to the resource.
*
*/
public Output>> tags() {
return Codegen.optional(this.tags);
}
/**
* Threat detection policy configuration, known in the API as Server Security Alerts Policy. The `threat_detection_policy` block supports fields documented below.
*
*/
@Export(name="threatDetectionPolicy", refs={ServerThreatDetectionPolicy.class}, tree="[0]")
private Output* @Nullable */ ServerThreatDetectionPolicy> threatDetectionPolicy;
/**
* @return Threat detection policy configuration, known in the API as Server Security Alerts Policy. The `threat_detection_policy` block supports fields documented below.
*
*/
public Output> threatDetectionPolicy() {
return Codegen.optional(this.threatDetectionPolicy);
}
/**
* 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.
*
*/
@Export(name="version", refs={String.class}, tree="[0]")
private Output version;
/**
* @return 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.
*
*/
public Output version() {
return this.version;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public Server(java.lang.String name) {
this(name, ServerArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public Server(java.lang.String name, ServerArgs args) {
this(name, args, null);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
* @param options A bag of options that control this resource's behavior.
*/
public Server(java.lang.String name, ServerArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:postgresql/server:Server", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private Server(java.lang.String name, Output id, @Nullable ServerState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:postgresql/server:Server", name, state, makeResourceOptions(options, id), false);
}
private static ServerArgs makeArgs(ServerArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? ServerArgs.Empty : args;
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) {
var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
.version(Utilities.getVersion())
.additionalSecretOutputs(List.of(
"administratorLoginPassword"
))
.build();
return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
}
/**
* Get an existing Host 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
* @param options Optional settings to control the behavior of the CustomResource.
*/
public static Server get(java.lang.String name, Output id, @Nullable ServerState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new Server(name, id, state, options);
}
}