1. Packages
  2. Postgresql Provider
  3. API Docs
  4. Publication
PostgreSQL v3.13.0 published on Monday, Oct 28, 2024 by Pulumi

postgresql.Publication

Explore with Pulumi AI

postgresql logo
PostgreSQL v3.13.0 published on Monday, Oct 28, 2024 by Pulumi

    The postgresql.Publication resource creates and manages a publication on a PostgreSQL server.

    Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as postgresql from "@pulumi/postgresql";
    
    const publication = new postgresql.Publication("publication", {
        name: "publication",
        tables: [
            "public.test",
            "another_schema.test",
        ],
    });
    
    import pulumi
    import pulumi_postgresql as postgresql
    
    publication = postgresql.Publication("publication",
        name="publication",
        tables=[
            "public.test",
            "another_schema.test",
        ])
    
    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 {
    		_, err := postgresql.NewPublication(ctx, "publication", &postgresql.PublicationArgs{
    			Name: pulumi.String("publication"),
    			Tables: pulumi.StringArray{
    				pulumi.String("public.test"),
    				pulumi.String("another_schema.test"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using PostgreSql = Pulumi.PostgreSql;
    
    return await Deployment.RunAsync(() => 
    {
        var publication = new PostgreSql.Publication("publication", new()
        {
            Name = "publication",
            Tables = new[]
            {
                "public.test",
                "another_schema.test",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.postgresql.Publication;
    import com.pulumi.postgresql.PublicationArgs;
    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 publication = new Publication("publication", PublicationArgs.builder()
                .name("publication")
                .tables(            
                    "public.test",
                    "another_schema.test")
                .build());
    
        }
    }
    
    resources:
      publication:
        type: postgresql:Publication
        properties:
          name: publication
          tables:
            - public.test
            - another_schema.test
    

    Create Publication Resource

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

    Constructor syntax

    new Publication(name: string, args?: PublicationArgs, opts?: CustomResourceOptions);
    @overload
    def Publication(resource_name: str,
                    args: Optional[PublicationArgs] = None,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def Publication(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    all_tables: Optional[bool] = None,
                    database: Optional[str] = None,
                    drop_cascade: Optional[bool] = None,
                    name: Optional[str] = None,
                    owner: Optional[str] = None,
                    publish_params: Optional[Sequence[str]] = None,
                    publish_via_partition_root_param: Optional[bool] = None,
                    tables: Optional[Sequence[str]] = None)
    func NewPublication(ctx *Context, name string, args *PublicationArgs, opts ...ResourceOption) (*Publication, error)
    public Publication(string name, PublicationArgs? args = null, CustomResourceOptions? opts = null)
    public Publication(String name, PublicationArgs args)
    public Publication(String name, PublicationArgs args, CustomResourceOptions options)
    
    type: postgresql:Publication
    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 PublicationArgs
    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 PublicationArgs
    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 PublicationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PublicationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PublicationArgs
    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 publicationResource = new PostgreSql.Publication("publicationResource", new()
    {
        AllTables = false,
        Database = "string",
        DropCascade = false,
        Name = "string",
        Owner = "string",
        PublishParams = new[]
        {
            "string",
        },
        PublishViaPartitionRootParam = false,
        Tables = new[]
        {
            "string",
        },
    });
    
    example, err := postgresql.NewPublication(ctx, "publicationResource", &postgresql.PublicationArgs{
    	AllTables:   pulumi.Bool(false),
    	Database:    pulumi.String("string"),
    	DropCascade: pulumi.Bool(false),
    	Name:        pulumi.String("string"),
    	Owner:       pulumi.String("string"),
    	PublishParams: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	PublishViaPartitionRootParam: pulumi.Bool(false),
    	Tables: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var publicationResource = new Publication("publicationResource", PublicationArgs.builder()
        .allTables(false)
        .database("string")
        .dropCascade(false)
        .name("string")
        .owner("string")
        .publishParams("string")
        .publishViaPartitionRootParam(false)
        .tables("string")
        .build());
    
    publication_resource = postgresql.Publication("publicationResource",
        all_tables=False,
        database="string",
        drop_cascade=False,
        name="string",
        owner="string",
        publish_params=["string"],
        publish_via_partition_root_param=False,
        tables=["string"])
    
    const publicationResource = new postgresql.Publication("publicationResource", {
        allTables: false,
        database: "string",
        dropCascade: false,
        name: "string",
        owner: "string",
        publishParams: ["string"],
        publishViaPartitionRootParam: false,
        tables: ["string"],
    });
    
    type: postgresql:Publication
    properties:
        allTables: false
        database: string
        dropCascade: false
        name: string
        owner: string
        publishParams:
            - string
        publishViaPartitionRootParam: false
        tables:
            - string
    

    Publication Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Publication resource accepts the following input properties:

    AllTables bool
    Should be ALL TABLES added to the publication. Defaults to 'false'
    Database string
    Which database to create the publication on. Defaults to provider database.
    DropCascade bool
    Should all subsequent resources of the publication be dropped. Defaults to 'false'
    Name string
    The name of the publication.
    Owner string
    Who owns the publication. Defaults to provider user.
    PublishParams List<string>
    Which 'publish' options should be turned on. Default to 'insert','update','delete'
    PublishViaPartitionRootParam bool
    Should be option 'publish_via_partition_root' be turned on. Default to 'false'
    Tables List<string>
    Which tables add to the publication. By defaults no tables added. Format of table is <schema_name>.<table_name>. If <schema_name> is not specified - default database schema will be used. Table string must be listed in alphabetical order.
    AllTables bool
    Should be ALL TABLES added to the publication. Defaults to 'false'
    Database string
    Which database to create the publication on. Defaults to provider database.
    DropCascade bool
    Should all subsequent resources of the publication be dropped. Defaults to 'false'
    Name string
    The name of the publication.
    Owner string
    Who owns the publication. Defaults to provider user.
    PublishParams []string
    Which 'publish' options should be turned on. Default to 'insert','update','delete'
    PublishViaPartitionRootParam bool
    Should be option 'publish_via_partition_root' be turned on. Default to 'false'
    Tables []string
    Which tables add to the publication. By defaults no tables added. Format of table is <schema_name>.<table_name>. If <schema_name> is not specified - default database schema will be used. Table string must be listed in alphabetical order.
    allTables Boolean
    Should be ALL TABLES added to the publication. Defaults to 'false'
    database String
    Which database to create the publication on. Defaults to provider database.
    dropCascade Boolean
    Should all subsequent resources of the publication be dropped. Defaults to 'false'
    name String
    The name of the publication.
    owner String
    Who owns the publication. Defaults to provider user.
    publishParams List<String>
    Which 'publish' options should be turned on. Default to 'insert','update','delete'
    publishViaPartitionRootParam Boolean
    Should be option 'publish_via_partition_root' be turned on. Default to 'false'
    tables List<String>
    Which tables add to the publication. By defaults no tables added. Format of table is <schema_name>.<table_name>. If <schema_name> is not specified - default database schema will be used. Table string must be listed in alphabetical order.
    allTables boolean
    Should be ALL TABLES added to the publication. Defaults to 'false'
    database string
    Which database to create the publication on. Defaults to provider database.
    dropCascade boolean
    Should all subsequent resources of the publication be dropped. Defaults to 'false'
    name string
    The name of the publication.
    owner string
    Who owns the publication. Defaults to provider user.
    publishParams string[]
    Which 'publish' options should be turned on. Default to 'insert','update','delete'
    publishViaPartitionRootParam boolean
    Should be option 'publish_via_partition_root' be turned on. Default to 'false'
    tables string[]
    Which tables add to the publication. By defaults no tables added. Format of table is <schema_name>.<table_name>. If <schema_name> is not specified - default database schema will be used. Table string must be listed in alphabetical order.
    all_tables bool
    Should be ALL TABLES added to the publication. Defaults to 'false'
    database str
    Which database to create the publication on. Defaults to provider database.
    drop_cascade bool
    Should all subsequent resources of the publication be dropped. Defaults to 'false'
    name str
    The name of the publication.
    owner str
    Who owns the publication. Defaults to provider user.
    publish_params Sequence[str]
    Which 'publish' options should be turned on. Default to 'insert','update','delete'
    publish_via_partition_root_param bool
    Should be option 'publish_via_partition_root' be turned on. Default to 'false'
    tables Sequence[str]
    Which tables add to the publication. By defaults no tables added. Format of table is <schema_name>.<table_name>. If <schema_name> is not specified - default database schema will be used. Table string must be listed in alphabetical order.
    allTables Boolean
    Should be ALL TABLES added to the publication. Defaults to 'false'
    database String
    Which database to create the publication on. Defaults to provider database.
    dropCascade Boolean
    Should all subsequent resources of the publication be dropped. Defaults to 'false'
    name String
    The name of the publication.
    owner String
    Who owns the publication. Defaults to provider user.
    publishParams List<String>
    Which 'publish' options should be turned on. Default to 'insert','update','delete'
    publishViaPartitionRootParam Boolean
    Should be option 'publish_via_partition_root' be turned on. Default to 'false'
    tables List<String>
    Which tables add to the publication. By defaults no tables added. Format of table is <schema_name>.<table_name>. If <schema_name> is not specified - default database schema will be used. Table string must be listed in alphabetical order.

    Outputs

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

    Get an existing Publication 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?: PublicationState, opts?: CustomResourceOptions): Publication
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            all_tables: Optional[bool] = None,
            database: Optional[str] = None,
            drop_cascade: Optional[bool] = None,
            name: Optional[str] = None,
            owner: Optional[str] = None,
            publish_params: Optional[Sequence[str]] = None,
            publish_via_partition_root_param: Optional[bool] = None,
            tables: Optional[Sequence[str]] = None) -> Publication
    func GetPublication(ctx *Context, name string, id IDInput, state *PublicationState, opts ...ResourceOption) (*Publication, error)
    public static Publication Get(string name, Input<string> id, PublicationState? state, CustomResourceOptions? opts = null)
    public static Publication get(String name, Output<String> id, PublicationState 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:
    AllTables bool
    Should be ALL TABLES added to the publication. Defaults to 'false'
    Database string
    Which database to create the publication on. Defaults to provider database.
    DropCascade bool
    Should all subsequent resources of the publication be dropped. Defaults to 'false'
    Name string
    The name of the publication.
    Owner string
    Who owns the publication. Defaults to provider user.
    PublishParams List<string>
    Which 'publish' options should be turned on. Default to 'insert','update','delete'
    PublishViaPartitionRootParam bool
    Should be option 'publish_via_partition_root' be turned on. Default to 'false'
    Tables List<string>
    Which tables add to the publication. By defaults no tables added. Format of table is <schema_name>.<table_name>. If <schema_name> is not specified - default database schema will be used. Table string must be listed in alphabetical order.
    AllTables bool
    Should be ALL TABLES added to the publication. Defaults to 'false'
    Database string
    Which database to create the publication on. Defaults to provider database.
    DropCascade bool
    Should all subsequent resources of the publication be dropped. Defaults to 'false'
    Name string
    The name of the publication.
    Owner string
    Who owns the publication. Defaults to provider user.
    PublishParams []string
    Which 'publish' options should be turned on. Default to 'insert','update','delete'
    PublishViaPartitionRootParam bool
    Should be option 'publish_via_partition_root' be turned on. Default to 'false'
    Tables []string
    Which tables add to the publication. By defaults no tables added. Format of table is <schema_name>.<table_name>. If <schema_name> is not specified - default database schema will be used. Table string must be listed in alphabetical order.
    allTables Boolean
    Should be ALL TABLES added to the publication. Defaults to 'false'
    database String
    Which database to create the publication on. Defaults to provider database.
    dropCascade Boolean
    Should all subsequent resources of the publication be dropped. Defaults to 'false'
    name String
    The name of the publication.
    owner String
    Who owns the publication. Defaults to provider user.
    publishParams List<String>
    Which 'publish' options should be turned on. Default to 'insert','update','delete'
    publishViaPartitionRootParam Boolean
    Should be option 'publish_via_partition_root' be turned on. Default to 'false'
    tables List<String>
    Which tables add to the publication. By defaults no tables added. Format of table is <schema_name>.<table_name>. If <schema_name> is not specified - default database schema will be used. Table string must be listed in alphabetical order.
    allTables boolean
    Should be ALL TABLES added to the publication. Defaults to 'false'
    database string
    Which database to create the publication on. Defaults to provider database.
    dropCascade boolean
    Should all subsequent resources of the publication be dropped. Defaults to 'false'
    name string
    The name of the publication.
    owner string
    Who owns the publication. Defaults to provider user.
    publishParams string[]
    Which 'publish' options should be turned on. Default to 'insert','update','delete'
    publishViaPartitionRootParam boolean
    Should be option 'publish_via_partition_root' be turned on. Default to 'false'
    tables string[]
    Which tables add to the publication. By defaults no tables added. Format of table is <schema_name>.<table_name>. If <schema_name> is not specified - default database schema will be used. Table string must be listed in alphabetical order.
    all_tables bool
    Should be ALL TABLES added to the publication. Defaults to 'false'
    database str
    Which database to create the publication on. Defaults to provider database.
    drop_cascade bool
    Should all subsequent resources of the publication be dropped. Defaults to 'false'
    name str
    The name of the publication.
    owner str
    Who owns the publication. Defaults to provider user.
    publish_params Sequence[str]
    Which 'publish' options should be turned on. Default to 'insert','update','delete'
    publish_via_partition_root_param bool
    Should be option 'publish_via_partition_root' be turned on. Default to 'false'
    tables Sequence[str]
    Which tables add to the publication. By defaults no tables added. Format of table is <schema_name>.<table_name>. If <schema_name> is not specified - default database schema will be used. Table string must be listed in alphabetical order.
    allTables Boolean
    Should be ALL TABLES added to the publication. Defaults to 'false'
    database String
    Which database to create the publication on. Defaults to provider database.
    dropCascade Boolean
    Should all subsequent resources of the publication be dropped. Defaults to 'false'
    name String
    The name of the publication.
    owner String
    Who owns the publication. Defaults to provider user.
    publishParams List<String>
    Which 'publish' options should be turned on. Default to 'insert','update','delete'
    publishViaPartitionRootParam Boolean
    Should be option 'publish_via_partition_root' be turned on. Default to 'false'
    tables List<String>
    Which tables add to the publication. By defaults no tables added. Format of table is <schema_name>.<table_name>. If <schema_name> is not specified - default database schema will be used. Table string must be listed in alphabetical order.

    Import

    Example

    Publication can be imported using this format:

    $ terraform import postgresql_publication.publication {{database_name}}.{{publication_name}}
    

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

    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.13.0 published on Monday, Oct 28, 2024 by Pulumi