1. Packages
  2. Azure Classic
  3. API Docs
  4. postgresql
  5. FlexibleServerVirtualEndpoint

We recommend using Azure Native.

Azure Classic v6.2.0 published on Friday, Sep 27, 2024 by Pulumi

azure.postgresql.FlexibleServerVirtualEndpoint

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v6.2.0 published on Friday, Sep 27, 2024 by Pulumi

    Allows you to create a Virtual Endpoint associated with a Postgres Flexible Replica.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = new azure.core.ResourceGroup("example", {
        name: "example-resources",
        location: "East US",
    });
    const exampleFlexibleServer = new azure.postgresql.FlexibleServer("example", {
        name: "example",
        resourceGroupName: example.name,
        location: example.location,
        version: "16",
        publicNetworkAccessEnabled: false,
        administratorLogin: "psqladmin",
        administratorPassword: "H@Sh1CoR3!",
        zone: "1",
        storageMb: 32768,
        storageTier: "P30",
        skuName: "GP_Standard_D2ads_v5",
    });
    const exampleReplica = new azure.postgresql.FlexibleServer("example_replica", {
        name: "example-replica",
        resourceGroupName: exampleFlexibleServer.resourceGroupName,
        location: exampleFlexibleServer.location,
        createMode: "Replica",
        sourceServerId: exampleFlexibleServer.id,
        version: "16",
        publicNetworkAccessEnabled: false,
        zone: "1",
        storageMb: 32768,
        storageTier: "P30",
        skuName: "GP_Standard_D2ads_v5",
    });
    const exampleFlexibleServerVirtualEndpoint = new azure.postgresql.FlexibleServerVirtualEndpoint("example", {
        name: "example-endpoint-1",
        sourceServerId: exampleFlexibleServer.id,
        replicaServerId: exampleReplica.id,
        type: "ReadWrite",
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.core.ResourceGroup("example",
        name="example-resources",
        location="East US")
    example_flexible_server = azure.postgresql.FlexibleServer("example",
        name="example",
        resource_group_name=example.name,
        location=example.location,
        version="16",
        public_network_access_enabled=False,
        administrator_login="psqladmin",
        administrator_password="H@Sh1CoR3!",
        zone="1",
        storage_mb=32768,
        storage_tier="P30",
        sku_name="GP_Standard_D2ads_v5")
    example_replica = azure.postgresql.FlexibleServer("example_replica",
        name="example-replica",
        resource_group_name=example_flexible_server.resource_group_name,
        location=example_flexible_server.location,
        create_mode="Replica",
        source_server_id=example_flexible_server.id,
        version="16",
        public_network_access_enabled=False,
        zone="1",
        storage_mb=32768,
        storage_tier="P30",
        sku_name="GP_Standard_D2ads_v5")
    example_flexible_server_virtual_endpoint = azure.postgresql.FlexibleServerVirtualEndpoint("example",
        name="example-endpoint-1",
        source_server_id=example_flexible_server.id,
        replica_server_id=example_replica.id,
        type="ReadWrite")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/postgresql"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
    			Name:     pulumi.String("example-resources"),
    			Location: pulumi.String("East US"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleFlexibleServer, err := postgresql.NewFlexibleServer(ctx, "example", &postgresql.FlexibleServerArgs{
    			Name:                       pulumi.String("example"),
    			ResourceGroupName:          example.Name,
    			Location:                   example.Location,
    			Version:                    pulumi.String("16"),
    			PublicNetworkAccessEnabled: pulumi.Bool(false),
    			AdministratorLogin:         pulumi.String("psqladmin"),
    			AdministratorPassword:      pulumi.String("H@Sh1CoR3!"),
    			Zone:                       pulumi.String("1"),
    			StorageMb:                  pulumi.Int(32768),
    			StorageTier:                pulumi.String("P30"),
    			SkuName:                    pulumi.String("GP_Standard_D2ads_v5"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleReplica, err := postgresql.NewFlexibleServer(ctx, "example_replica", &postgresql.FlexibleServerArgs{
    			Name:                       pulumi.String("example-replica"),
    			ResourceGroupName:          exampleFlexibleServer.ResourceGroupName,
    			Location:                   exampleFlexibleServer.Location,
    			CreateMode:                 pulumi.String("Replica"),
    			SourceServerId:             exampleFlexibleServer.ID(),
    			Version:                    pulumi.String("16"),
    			PublicNetworkAccessEnabled: pulumi.Bool(false),
    			Zone:                       pulumi.String("1"),
    			StorageMb:                  pulumi.Int(32768),
    			StorageTier:                pulumi.String("P30"),
    			SkuName:                    pulumi.String("GP_Standard_D2ads_v5"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = postgresql.NewFlexibleServerVirtualEndpoint(ctx, "example", &postgresql.FlexibleServerVirtualEndpointArgs{
    			Name:            pulumi.String("example-endpoint-1"),
    			SourceServerId:  exampleFlexibleServer.ID(),
    			ReplicaServerId: exampleReplica.ID(),
    			Type:            pulumi.String("ReadWrite"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Azure.Core.ResourceGroup("example", new()
        {
            Name = "example-resources",
            Location = "East US",
        });
    
        var exampleFlexibleServer = new Azure.PostgreSql.FlexibleServer("example", new()
        {
            Name = "example",
            ResourceGroupName = example.Name,
            Location = example.Location,
            Version = "16",
            PublicNetworkAccessEnabled = false,
            AdministratorLogin = "psqladmin",
            AdministratorPassword = "H@Sh1CoR3!",
            Zone = "1",
            StorageMb = 32768,
            StorageTier = "P30",
            SkuName = "GP_Standard_D2ads_v5",
        });
    
        var exampleReplica = new Azure.PostgreSql.FlexibleServer("example_replica", new()
        {
            Name = "example-replica",
            ResourceGroupName = exampleFlexibleServer.ResourceGroupName,
            Location = exampleFlexibleServer.Location,
            CreateMode = "Replica",
            SourceServerId = exampleFlexibleServer.Id,
            Version = "16",
            PublicNetworkAccessEnabled = false,
            Zone = "1",
            StorageMb = 32768,
            StorageTier = "P30",
            SkuName = "GP_Standard_D2ads_v5",
        });
    
        var exampleFlexibleServerVirtualEndpoint = new Azure.PostgreSql.FlexibleServerVirtualEndpoint("example", new()
        {
            Name = "example-endpoint-1",
            SourceServerId = exampleFlexibleServer.Id,
            ReplicaServerId = exampleReplica.Id,
            Type = "ReadWrite",
        });
    
    });
    
    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.FlexibleServer;
    import com.pulumi.azure.postgresql.FlexibleServerArgs;
    import com.pulumi.azure.postgresql.FlexibleServerVirtualEndpoint;
    import com.pulumi.azure.postgresql.FlexibleServerVirtualEndpointArgs;
    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 {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var example = new ResourceGroup("example", ResourceGroupArgs.builder()
                .name("example-resources")
                .location("East US")
                .build());
    
            var exampleFlexibleServer = new FlexibleServer("exampleFlexibleServer", FlexibleServerArgs.builder()
                .name("example")
                .resourceGroupName(example.name())
                .location(example.location())
                .version("16")
                .publicNetworkAccessEnabled(false)
                .administratorLogin("psqladmin")
                .administratorPassword("H@Sh1CoR3!")
                .zone("1")
                .storageMb(32768)
                .storageTier("P30")
                .skuName("GP_Standard_D2ads_v5")
                .build());
    
            var exampleReplica = new FlexibleServer("exampleReplica", FlexibleServerArgs.builder()
                .name("example-replica")
                .resourceGroupName(exampleFlexibleServer.resourceGroupName())
                .location(exampleFlexibleServer.location())
                .createMode("Replica")
                .sourceServerId(exampleFlexibleServer.id())
                .version("16")
                .publicNetworkAccessEnabled(false)
                .zone("1")
                .storageMb(32768)
                .storageTier("P30")
                .skuName("GP_Standard_D2ads_v5")
                .build());
    
            var exampleFlexibleServerVirtualEndpoint = new FlexibleServerVirtualEndpoint("exampleFlexibleServerVirtualEndpoint", FlexibleServerVirtualEndpointArgs.builder()
                .name("example-endpoint-1")
                .sourceServerId(exampleFlexibleServer.id())
                .replicaServerId(exampleReplica.id())
                .type("ReadWrite")
                .build());
    
        }
    }
    
    resources:
      example:
        type: azure:core:ResourceGroup
        properties:
          name: example-resources
          location: East US
      exampleFlexibleServer:
        type: azure:postgresql:FlexibleServer
        name: example
        properties:
          name: example
          resourceGroupName: ${example.name}
          location: ${example.location}
          version: '16'
          publicNetworkAccessEnabled: false
          administratorLogin: psqladmin
          administratorPassword: H@Sh1CoR3!
          zone: '1'
          storageMb: 32768
          storageTier: P30
          skuName: GP_Standard_D2ads_v5
      exampleReplica:
        type: azure:postgresql:FlexibleServer
        name: example_replica
        properties:
          name: example-replica
          resourceGroupName: ${exampleFlexibleServer.resourceGroupName}
          location: ${exampleFlexibleServer.location}
          createMode: Replica
          sourceServerId: ${exampleFlexibleServer.id}
          version: '16'
          publicNetworkAccessEnabled: false
          zone: '1'
          storageMb: 32768
          storageTier: P30
          skuName: GP_Standard_D2ads_v5
      exampleFlexibleServerVirtualEndpoint:
        type: azure:postgresql:FlexibleServerVirtualEndpoint
        name: example
        properties:
          name: example-endpoint-1
          sourceServerId: ${exampleFlexibleServer.id}
          replicaServerId: ${exampleReplica.id}
          type: ReadWrite
    

    Note: If creating multiple replicas, an error can occur if virtual endpoints are created before all replicas have been completed. To avoid this error, use a depends_on property on azure.postgresql.FlexibleServerVirtualEndpoint that references all Postgres Flexible Server Replicas.

    Create FlexibleServerVirtualEndpoint Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new FlexibleServerVirtualEndpoint(name: string, args: FlexibleServerVirtualEndpointArgs, opts?: CustomResourceOptions);
    @overload
    def FlexibleServerVirtualEndpoint(resource_name: str,
                                      args: FlexibleServerVirtualEndpointArgs,
                                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def FlexibleServerVirtualEndpoint(resource_name: str,
                                      opts: Optional[ResourceOptions] = None,
                                      replica_server_id: Optional[str] = None,
                                      source_server_id: Optional[str] = None,
                                      type: Optional[str] = None,
                                      name: Optional[str] = None)
    func NewFlexibleServerVirtualEndpoint(ctx *Context, name string, args FlexibleServerVirtualEndpointArgs, opts ...ResourceOption) (*FlexibleServerVirtualEndpoint, error)
    public FlexibleServerVirtualEndpoint(string name, FlexibleServerVirtualEndpointArgs args, CustomResourceOptions? opts = null)
    public FlexibleServerVirtualEndpoint(String name, FlexibleServerVirtualEndpointArgs args)
    public FlexibleServerVirtualEndpoint(String name, FlexibleServerVirtualEndpointArgs args, CustomResourceOptions options)
    
    type: azure:postgresql:FlexibleServerVirtualEndpoint
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args FlexibleServerVirtualEndpointArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args FlexibleServerVirtualEndpointArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args FlexibleServerVirtualEndpointArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args FlexibleServerVirtualEndpointArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args FlexibleServerVirtualEndpointArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var flexibleServerVirtualEndpointResource = new Azure.PostgreSql.FlexibleServerVirtualEndpoint("flexibleServerVirtualEndpointResource", new()
    {
        ReplicaServerId = "string",
        SourceServerId = "string",
        Type = "string",
        Name = "string",
    });
    
    example, err := postgresql.NewFlexibleServerVirtualEndpoint(ctx, "flexibleServerVirtualEndpointResource", &postgresql.FlexibleServerVirtualEndpointArgs{
    	ReplicaServerId: pulumi.String("string"),
    	SourceServerId:  pulumi.String("string"),
    	Type:            pulumi.String("string"),
    	Name:            pulumi.String("string"),
    })
    
    var flexibleServerVirtualEndpointResource = new FlexibleServerVirtualEndpoint("flexibleServerVirtualEndpointResource", FlexibleServerVirtualEndpointArgs.builder()
        .replicaServerId("string")
        .sourceServerId("string")
        .type("string")
        .name("string")
        .build());
    
    flexible_server_virtual_endpoint_resource = azure.postgresql.FlexibleServerVirtualEndpoint("flexibleServerVirtualEndpointResource",
        replica_server_id="string",
        source_server_id="string",
        type="string",
        name="string")
    
    const flexibleServerVirtualEndpointResource = new azure.postgresql.FlexibleServerVirtualEndpoint("flexibleServerVirtualEndpointResource", {
        replicaServerId: "string",
        sourceServerId: "string",
        type: "string",
        name: "string",
    });
    
    type: azure:postgresql:FlexibleServerVirtualEndpoint
    properties:
        name: string
        replicaServerId: string
        sourceServerId: string
        type: string
    

    FlexibleServerVirtualEndpoint Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The FlexibleServerVirtualEndpoint resource accepts the following input properties:

    ReplicaServerId string
    The Resource ID of the Replica Postgres Flexible Server this should be associated with
    SourceServerId string
    The Resource ID of the Source Postgres Flexible Server this should be associated with.
    Type string
    The type of Virtual Endpoint. Currently only ReadWrite is supported.
    Name string
    The name of the Virtual Endpoint
    ReplicaServerId string
    The Resource ID of the Replica Postgres Flexible Server this should be associated with
    SourceServerId string
    The Resource ID of the Source Postgres Flexible Server this should be associated with.
    Type string
    The type of Virtual Endpoint. Currently only ReadWrite is supported.
    Name string
    The name of the Virtual Endpoint
    replicaServerId String
    The Resource ID of the Replica Postgres Flexible Server this should be associated with
    sourceServerId String
    The Resource ID of the Source Postgres Flexible Server this should be associated with.
    type String
    The type of Virtual Endpoint. Currently only ReadWrite is supported.
    name String
    The name of the Virtual Endpoint
    replicaServerId string
    The Resource ID of the Replica Postgres Flexible Server this should be associated with
    sourceServerId string
    The Resource ID of the Source Postgres Flexible Server this should be associated with.
    type string
    The type of Virtual Endpoint. Currently only ReadWrite is supported.
    name string
    The name of the Virtual Endpoint
    replica_server_id str
    The Resource ID of the Replica Postgres Flexible Server this should be associated with
    source_server_id str
    The Resource ID of the Source Postgres Flexible Server this should be associated with.
    type str
    The type of Virtual Endpoint. Currently only ReadWrite is supported.
    name str
    The name of the Virtual Endpoint
    replicaServerId String
    The Resource ID of the Replica Postgres Flexible Server this should be associated with
    sourceServerId String
    The Resource ID of the Source Postgres Flexible Server this should be associated with.
    type String
    The type of Virtual Endpoint. Currently only ReadWrite is supported.
    name String
    The name of the Virtual Endpoint

    Outputs

    All input properties are implicitly available as output properties. Additionally, the FlexibleServerVirtualEndpoint resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing FlexibleServerVirtualEndpoint Resource

    Get an existing FlexibleServerVirtualEndpoint resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: FlexibleServerVirtualEndpointState, opts?: CustomResourceOptions): FlexibleServerVirtualEndpoint
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            replica_server_id: Optional[str] = None,
            source_server_id: Optional[str] = None,
            type: Optional[str] = None) -> FlexibleServerVirtualEndpoint
    func GetFlexibleServerVirtualEndpoint(ctx *Context, name string, id IDInput, state *FlexibleServerVirtualEndpointState, opts ...ResourceOption) (*FlexibleServerVirtualEndpoint, error)
    public static FlexibleServerVirtualEndpoint Get(string name, Input<string> id, FlexibleServerVirtualEndpointState? state, CustomResourceOptions? opts = null)
    public static FlexibleServerVirtualEndpoint get(String name, Output<String> id, FlexibleServerVirtualEndpointState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Name string
    The name of the Virtual Endpoint
    ReplicaServerId string
    The Resource ID of the Replica Postgres Flexible Server this should be associated with
    SourceServerId string
    The Resource ID of the Source Postgres Flexible Server this should be associated with.
    Type string
    The type of Virtual Endpoint. Currently only ReadWrite is supported.
    Name string
    The name of the Virtual Endpoint
    ReplicaServerId string
    The Resource ID of the Replica Postgres Flexible Server this should be associated with
    SourceServerId string
    The Resource ID of the Source Postgres Flexible Server this should be associated with.
    Type string
    The type of Virtual Endpoint. Currently only ReadWrite is supported.
    name String
    The name of the Virtual Endpoint
    replicaServerId String
    The Resource ID of the Replica Postgres Flexible Server this should be associated with
    sourceServerId String
    The Resource ID of the Source Postgres Flexible Server this should be associated with.
    type String
    The type of Virtual Endpoint. Currently only ReadWrite is supported.
    name string
    The name of the Virtual Endpoint
    replicaServerId string
    The Resource ID of the Replica Postgres Flexible Server this should be associated with
    sourceServerId string
    The Resource ID of the Source Postgres Flexible Server this should be associated with.
    type string
    The type of Virtual Endpoint. Currently only ReadWrite is supported.
    name str
    The name of the Virtual Endpoint
    replica_server_id str
    The Resource ID of the Replica Postgres Flexible Server this should be associated with
    source_server_id str
    The Resource ID of the Source Postgres Flexible Server this should be associated with.
    type str
    The type of Virtual Endpoint. Currently only ReadWrite is supported.
    name String
    The name of the Virtual Endpoint
    replicaServerId String
    The Resource ID of the Replica Postgres Flexible Server this should be associated with
    sourceServerId String
    The Resource ID of the Source Postgres Flexible Server this should be associated with.
    type String
    The type of Virtual Endpoint. Currently only ReadWrite is supported.

    Import

    A PostgreSQL Flexible Virtual Endpoint can be imported using the resource id, e.g.

    $ pulumi import azure:postgresql/flexibleServerVirtualEndpoint:FlexibleServerVirtualEndpoint example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DBforPostgreSQL/flexibleServers/server1/virtualEndpoints/endpoint1
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure Classic v6.2.0 published on Friday, Sep 27, 2024 by Pulumi