1. Packages
  2. PostgreSQL
  3. API Docs
  4. Server
PostgreSQL v3.11.0 published on Sunday, Mar 3, 2024 by Pulumi

postgresql.Server

Explore with Pulumi AI

postgresql logo
PostgreSQL v3.11.0 published on Sunday, Mar 3, 2024 by Pulumi

    The postgresql.Server resource creates and manages a foreign server on a PostgreSQL server.

    Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as postgresql from "@pulumi/postgresql";
    
    const extPostgresFdw = new postgresql.Extension("extPostgresFdw", {});
    const myserverPostgres = new postgresql.Server("myserverPostgres", {
        serverName: "myserver_postgres",
        fdwName: "postgres_fdw",
        options: {
            host: "foo",
            dbname: "foodb",
            port: "5432",
        },
    }, {
        dependsOn: [extPostgresFdw],
    });
    
    import pulumi
    import pulumi_postgresql as postgresql
    
    ext_postgres_fdw = postgresql.Extension("extPostgresFdw")
    myserver_postgres = postgresql.Server("myserverPostgres",
        server_name="myserver_postgres",
        fdw_name="postgres_fdw",
        options={
            "host": "foo",
            "dbname": "foodb",
            "port": "5432",
        },
        opts=pulumi.ResourceOptions(depends_on=[ext_postgres_fdw]))
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using PostgreSql = Pulumi.PostgreSql;
    
    return await Deployment.RunAsync(() => 
    {
        var extPostgresFdw = new PostgreSql.Extension("extPostgresFdw");
    
        var myserverPostgres = new PostgreSql.Server("myserverPostgres", new()
        {
            ServerName = "myserver_postgres",
            FdwName = "postgres_fdw",
            Options = 
            {
                { "host", "foo" },
                { "dbname", "foodb" },
                { "port", "5432" },
            },
        }, new CustomResourceOptions
        {
            DependsOn = new[]
            {
                extPostgresFdw,
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-postgresql/sdk/v3/go/postgresql"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		extPostgresFdw, err := postgresql.NewExtension(ctx, "extPostgresFdw", nil)
    		if err != nil {
    			return err
    		}
    		_, err = postgresql.NewServer(ctx, "myserverPostgres", &postgresql.ServerArgs{
    			ServerName: pulumi.String("myserver_postgres"),
    			FdwName:    pulumi.String("postgres_fdw"),
    			Options: pulumi.StringMap{
    				"host":   pulumi.String("foo"),
    				"dbname": pulumi.String("foodb"),
    				"port":   pulumi.String("5432"),
    			},
    		}, pulumi.DependsOn([]pulumi.Resource{
    			extPostgresFdw,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.postgresql.Extension;
    import com.pulumi.postgresql.Server;
    import com.pulumi.postgresql.ServerArgs;
    import com.pulumi.resources.CustomResourceOptions;
    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 extPostgresFdw = new Extension("extPostgresFdw");
    
            var myserverPostgres = new Server("myserverPostgres", ServerArgs.builder()        
                .serverName("myserver_postgres")
                .fdwName("postgres_fdw")
                .options(Map.ofEntries(
                    Map.entry("host", "foo"),
                    Map.entry("dbname", "foodb"),
                    Map.entry("port", "5432")
                ))
                .build(), CustomResourceOptions.builder()
                    .dependsOn(extPostgresFdw)
                    .build());
    
        }
    }
    
    resources:
      extPostgresFdw:
        type: postgresql:Extension
      myserverPostgres:
        type: postgresql:Server
        properties:
          serverName: myserver_postgres
          fdwName: postgres_fdw
          options:
            host: foo
            dbname: foodb
            port: '5432'
        options:
          dependson:
            - ${extPostgresFdw}
    
    import * as pulumi from "@pulumi/pulumi";
    import * as postgresql from "@pulumi/postgresql";
    
    const extFileFdw = new postgresql.Extension("extFileFdw", {});
    const myserverFile = new postgresql.Server("myserverFile", {
        serverName: "myserver_file",
        fdwName: "file_fdw",
    }, {
        dependsOn: [extFileFdw],
    });
    
    import pulumi
    import pulumi_postgresql as postgresql
    
    ext_file_fdw = postgresql.Extension("extFileFdw")
    myserver_file = postgresql.Server("myserverFile",
        server_name="myserver_file",
        fdw_name="file_fdw",
        opts=pulumi.ResourceOptions(depends_on=[ext_file_fdw]))
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using PostgreSql = Pulumi.PostgreSql;
    
    return await Deployment.RunAsync(() => 
    {
        var extFileFdw = new PostgreSql.Extension("extFileFdw");
    
        var myserverFile = new PostgreSql.Server("myserverFile", new()
        {
            ServerName = "myserver_file",
            FdwName = "file_fdw",
        }, new CustomResourceOptions
        {
            DependsOn = new[]
            {
                extFileFdw,
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-postgresql/sdk/v3/go/postgresql"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		extFileFdw, err := postgresql.NewExtension(ctx, "extFileFdw", nil)
    		if err != nil {
    			return err
    		}
    		_, err = postgresql.NewServer(ctx, "myserverFile", &postgresql.ServerArgs{
    			ServerName: pulumi.String("myserver_file"),
    			FdwName:    pulumi.String("file_fdw"),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			extFileFdw,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.postgresql.Extension;
    import com.pulumi.postgresql.Server;
    import com.pulumi.postgresql.ServerArgs;
    import com.pulumi.resources.CustomResourceOptions;
    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 extFileFdw = new Extension("extFileFdw");
    
            var myserverFile = new Server("myserverFile", ServerArgs.builder()        
                .serverName("myserver_file")
                .fdwName("file_fdw")
                .build(), CustomResourceOptions.builder()
                    .dependsOn(extFileFdw)
                    .build());
    
        }
    }
    
    resources:
      extFileFdw:
        type: postgresql:Extension
      myserverFile:
        type: postgresql:Server
        properties:
          serverName: myserver_file
          fdwName: file_fdw
        options:
          dependson:
            - ${extFileFdw}
    

    Create Server Resource

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

    Constructor syntax

    new Server(name: string, args: ServerArgs, opts?: CustomResourceOptions);
    @overload
    def Server(resource_name: str,
               args: ServerArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Server(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               fdw_name: Optional[str] = None,
               server_name: Optional[str] = None,
               drop_cascade: Optional[bool] = None,
               options: Optional[Mapping[str, str]] = None,
               server_owner: Optional[str] = None,
               server_type: Optional[str] = None,
               server_version: Optional[str] = None)
    func NewServer(ctx *Context, name string, args ServerArgs, opts ...ResourceOption) (*Server, error)
    public Server(string name, ServerArgs args, CustomResourceOptions? opts = null)
    public Server(String name, ServerArgs args)
    public Server(String name, ServerArgs args, CustomResourceOptions options)
    
    type: postgresql:Server
    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 ServerArgs
    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 ServerArgs
    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 ServerArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServerArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServerArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

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

    var serverResource = new PostgreSql.Server("serverResource", new()
    {
        FdwName = "string",
        ServerName = "string",
        DropCascade = false,
        Options = 
        {
            { "string", "string" },
        },
        ServerOwner = "string",
        ServerType = "string",
        ServerVersion = "string",
    });
    
    example, err := postgresql.NewServer(ctx, "serverResource", &postgresql.ServerArgs{
    	FdwName:     pulumi.String("string"),
    	ServerName:  pulumi.String("string"),
    	DropCascade: pulumi.Bool(false),
    	Options: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	ServerOwner:   pulumi.String("string"),
    	ServerType:    pulumi.String("string"),
    	ServerVersion: pulumi.String("string"),
    })
    
    var serverResource = new Server("serverResource", ServerArgs.builder()        
        .fdwName("string")
        .serverName("string")
        .dropCascade(false)
        .options(Map.of("string", "string"))
        .serverOwner("string")
        .serverType("string")
        .serverVersion("string")
        .build());
    
    server_resource = postgresql.Server("serverResource",
        fdw_name="string",
        server_name="string",
        drop_cascade=False,
        options={
            "string": "string",
        },
        server_owner="string",
        server_type="string",
        server_version="string")
    
    const serverResource = new postgresql.Server("serverResource", {
        fdwName: "string",
        serverName: "string",
        dropCascade: false,
        options: {
            string: "string",
        },
        serverOwner: "string",
        serverType: "string",
        serverVersion: "string",
    });
    
    type: postgresql:Server
    properties:
        dropCascade: false
        fdwName: string
        options:
            string: string
        serverName: string
        serverOwner: string
        serverType: string
        serverVersion: string
    

    Server 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 Server resource accepts the following input properties:

    FdwName string
    The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    ServerName string
    The name of the foreign server to be created.
    DropCascade bool
    When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
    Options Dictionary<string, string>
    This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
    ServerOwner string
    By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
    ServerType string
    Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    ServerVersion string
    Optional server version, potentially useful to foreign-data wrappers.
    FdwName string
    The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    ServerName string
    The name of the foreign server to be created.
    DropCascade bool
    When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
    Options map[string]string
    This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
    ServerOwner string
    By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
    ServerType string
    Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    ServerVersion string
    Optional server version, potentially useful to foreign-data wrappers.
    fdwName String
    The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    serverName String
    The name of the foreign server to be created.
    dropCascade Boolean
    When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
    options Map<String,String>
    This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
    serverOwner String
    By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
    serverType String
    Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    serverVersion String
    Optional server version, potentially useful to foreign-data wrappers.
    fdwName string
    The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    serverName string
    The name of the foreign server to be created.
    dropCascade boolean
    When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
    options {[key: string]: string}
    This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
    serverOwner string
    By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
    serverType string
    Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    serverVersion string
    Optional server version, potentially useful to foreign-data wrappers.
    fdw_name str
    The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    server_name str
    The name of the foreign server to be created.
    drop_cascade bool
    When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
    options Mapping[str, str]
    This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
    server_owner str
    By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
    server_type str
    Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    server_version str
    Optional server version, potentially useful to foreign-data wrappers.
    fdwName String
    The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    serverName String
    The name of the foreign server to be created.
    dropCascade Boolean
    When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
    options Map<String>
    This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
    serverOwner String
    By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
    serverType String
    Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    serverVersion String
    Optional server version, potentially useful to foreign-data wrappers.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Server 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 Server Resource

    Get an existing Server 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?: ServerState, opts?: CustomResourceOptions): Server
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            drop_cascade: Optional[bool] = None,
            fdw_name: Optional[str] = None,
            options: Optional[Mapping[str, str]] = None,
            server_name: Optional[str] = None,
            server_owner: Optional[str] = None,
            server_type: Optional[str] = None,
            server_version: Optional[str] = None) -> Server
    func GetServer(ctx *Context, name string, id IDInput, state *ServerState, opts ...ResourceOption) (*Server, error)
    public static Server Get(string name, Input<string> id, ServerState? state, CustomResourceOptions? opts = null)
    public static Server get(String name, Output<String> id, ServerState 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:
    DropCascade bool
    When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
    FdwName string
    The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    Options Dictionary<string, string>
    This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
    ServerName string
    The name of the foreign server to be created.
    ServerOwner string
    By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
    ServerType string
    Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    ServerVersion string
    Optional server version, potentially useful to foreign-data wrappers.
    DropCascade bool
    When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
    FdwName string
    The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    Options map[string]string
    This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
    ServerName string
    The name of the foreign server to be created.
    ServerOwner string
    By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
    ServerType string
    Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    ServerVersion string
    Optional server version, potentially useful to foreign-data wrappers.
    dropCascade Boolean
    When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
    fdwName String
    The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    options Map<String,String>
    This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
    serverName String
    The name of the foreign server to be created.
    serverOwner String
    By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
    serverType String
    Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    serverVersion String
    Optional server version, potentially useful to foreign-data wrappers.
    dropCascade boolean
    When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
    fdwName string
    The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    options {[key: string]: string}
    This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
    serverName string
    The name of the foreign server to be created.
    serverOwner string
    By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
    serverType string
    Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    serverVersion string
    Optional server version, potentially useful to foreign-data wrappers.
    drop_cascade bool
    When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
    fdw_name str
    The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    options Mapping[str, str]
    This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
    server_name str
    The name of the foreign server to be created.
    server_owner str
    By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
    server_type str
    Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    server_version str
    Optional server version, potentially useful to foreign-data wrappers.
    dropCascade Boolean
    When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
    fdwName String
    The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    options Map<String>
    This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
    serverName String
    The name of the foreign server to be created.
    serverOwner String
    By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
    serverType String
    Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
    serverVersion String
    Optional server version, potentially useful to foreign-data wrappers.

    Package Details

    Repository
    PostgreSQL pulumi/pulumi-postgresql
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the postgresql Terraform Provider.
    postgresql logo
    PostgreSQL v3.11.0 published on Sunday, Mar 3, 2024 by Pulumi