1. Packages
  2. PostgreSQL
  3. API Docs
  4. Schema
PostgreSQL v3.11.1 published on Friday, May 10, 2024 by Pulumi

postgresql.Schema

Explore with Pulumi AI

postgresql logo
PostgreSQL v3.11.1 published on Friday, May 10, 2024 by Pulumi

    Create Schema Resource

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

    Constructor syntax

    new Schema(name: string, args?: SchemaArgs, opts?: CustomResourceOptions);
    @overload
    def Schema(resource_name: str,
               args: Optional[SchemaArgs] = None,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Schema(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               database: Optional[str] = None,
               drop_cascade: Optional[bool] = None,
               if_not_exists: Optional[bool] = None,
               name: Optional[str] = None,
               owner: Optional[str] = None,
               policies: Optional[Sequence[SchemaPolicyArgs]] = None)
    func NewSchema(ctx *Context, name string, args *SchemaArgs, opts ...ResourceOption) (*Schema, error)
    public Schema(string name, SchemaArgs? args = null, CustomResourceOptions? opts = null)
    public Schema(String name, SchemaArgs args)
    public Schema(String name, SchemaArgs args, CustomResourceOptions options)
    
    type: postgresql:Schema
    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 SchemaArgs
    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 SchemaArgs
    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 SchemaArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SchemaArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SchemaArgs
    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 schemaResource = new PostgreSql.Schema("schemaResource", new()
    {
        Database = "string",
        DropCascade = false,
        IfNotExists = false,
        Name = "string",
        Owner = "string",
    });
    
    example, err := postgresql.NewSchema(ctx, "schemaResource", &postgresql.SchemaArgs{
    	Database:    pulumi.String("string"),
    	DropCascade: pulumi.Bool(false),
    	IfNotExists: pulumi.Bool(false),
    	Name:        pulumi.String("string"),
    	Owner:       pulumi.String("string"),
    })
    
    var schemaResource = new Schema("schemaResource", SchemaArgs.builder()
        .database("string")
        .dropCascade(false)
        .ifNotExists(false)
        .name("string")
        .owner("string")
        .build());
    
    schema_resource = postgresql.Schema("schemaResource",
        database="string",
        drop_cascade=False,
        if_not_exists=False,
        name="string",
        owner="string")
    
    const schemaResource = new postgresql.Schema("schemaResource", {
        database: "string",
        dropCascade: false,
        ifNotExists: false,
        name: "string",
        owner: "string",
    });
    
    type: postgresql:Schema
    properties:
        database: string
        dropCascade: false
        ifNotExists: false
        name: string
        owner: string
    

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

    Database string
    The DATABASE in which where this schema will be created. (Default: The database used by your provider configuration)
    DropCascade bool
    When true, will also drop all the objects that are contained in the schema. (Default: false)
    IfNotExists bool
    When true, use the existing schema if it exists. (Default: true)
    Name string
    The name of the schema. Must be unique in the PostgreSQL database instance where it is configured.
    Owner string
    The ROLE who owns the schema.
    Policies List<Pulumi.PostgreSql.Inputs.SchemaPolicy>
    Can be specified multiple times for each policy. Each policy block supports fields documented below.

    Deprecated: Use postgresql.Grant resource instead (with object_type="schema")

    Database string
    The DATABASE in which where this schema will be created. (Default: The database used by your provider configuration)
    DropCascade bool
    When true, will also drop all the objects that are contained in the schema. (Default: false)
    IfNotExists bool
    When true, use the existing schema if it exists. (Default: true)
    Name string
    The name of the schema. Must be unique in the PostgreSQL database instance where it is configured.
    Owner string
    The ROLE who owns the schema.
    Policies []SchemaPolicyArgs
    Can be specified multiple times for each policy. Each policy block supports fields documented below.

    Deprecated: Use postgresql.Grant resource instead (with object_type="schema")

    database String
    The DATABASE in which where this schema will be created. (Default: The database used by your provider configuration)
    dropCascade Boolean
    When true, will also drop all the objects that are contained in the schema. (Default: false)
    ifNotExists Boolean
    When true, use the existing schema if it exists. (Default: true)
    name String
    The name of the schema. Must be unique in the PostgreSQL database instance where it is configured.
    owner String
    The ROLE who owns the schema.
    policies List<SchemaPolicy>
    Can be specified multiple times for each policy. Each policy block supports fields documented below.

    Deprecated: Use postgresql.Grant resource instead (with object_type="schema")

    database string
    The DATABASE in which where this schema will be created. (Default: The database used by your provider configuration)
    dropCascade boolean
    When true, will also drop all the objects that are contained in the schema. (Default: false)
    ifNotExists boolean
    When true, use the existing schema if it exists. (Default: true)
    name string
    The name of the schema. Must be unique in the PostgreSQL database instance where it is configured.
    owner string
    The ROLE who owns the schema.
    policies SchemaPolicy[]
    Can be specified multiple times for each policy. Each policy block supports fields documented below.

    Deprecated: Use postgresql.Grant resource instead (with object_type="schema")

    database str
    The DATABASE in which where this schema will be created. (Default: The database used by your provider configuration)
    drop_cascade bool
    When true, will also drop all the objects that are contained in the schema. (Default: false)
    if_not_exists bool
    When true, use the existing schema if it exists. (Default: true)
    name str
    The name of the schema. Must be unique in the PostgreSQL database instance where it is configured.
    owner str
    The ROLE who owns the schema.
    policies Sequence[SchemaPolicyArgs]
    Can be specified multiple times for each policy. Each policy block supports fields documented below.

    Deprecated: Use postgresql.Grant resource instead (with object_type="schema")

    database String
    The DATABASE in which where this schema will be created. (Default: The database used by your provider configuration)
    dropCascade Boolean
    When true, will also drop all the objects that are contained in the schema. (Default: false)
    ifNotExists Boolean
    When true, use the existing schema if it exists. (Default: true)
    name String
    The name of the schema. Must be unique in the PostgreSQL database instance where it is configured.
    owner String
    The ROLE who owns the schema.
    policies List<Property Map>
    Can be specified multiple times for each policy. Each policy block supports fields documented below.

    Deprecated: Use postgresql.Grant resource instead (with object_type="schema")

    Outputs

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

    Get an existing Schema 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?: SchemaState, opts?: CustomResourceOptions): Schema
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            database: Optional[str] = None,
            drop_cascade: Optional[bool] = None,
            if_not_exists: Optional[bool] = None,
            name: Optional[str] = None,
            owner: Optional[str] = None,
            policies: Optional[Sequence[SchemaPolicyArgs]] = None) -> Schema
    func GetSchema(ctx *Context, name string, id IDInput, state *SchemaState, opts ...ResourceOption) (*Schema, error)
    public static Schema Get(string name, Input<string> id, SchemaState? state, CustomResourceOptions? opts = null)
    public static Schema get(String name, Output<String> id, SchemaState 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:
    Database string
    The DATABASE in which where this schema will be created. (Default: The database used by your provider configuration)
    DropCascade bool
    When true, will also drop all the objects that are contained in the schema. (Default: false)
    IfNotExists bool
    When true, use the existing schema if it exists. (Default: true)
    Name string
    The name of the schema. Must be unique in the PostgreSQL database instance where it is configured.
    Owner string
    The ROLE who owns the schema.
    Policies List<Pulumi.PostgreSql.Inputs.SchemaPolicy>
    Can be specified multiple times for each policy. Each policy block supports fields documented below.

    Deprecated: Use postgresql.Grant resource instead (with object_type="schema")

    Database string
    The DATABASE in which where this schema will be created. (Default: The database used by your provider configuration)
    DropCascade bool
    When true, will also drop all the objects that are contained in the schema. (Default: false)
    IfNotExists bool
    When true, use the existing schema if it exists. (Default: true)
    Name string
    The name of the schema. Must be unique in the PostgreSQL database instance where it is configured.
    Owner string
    The ROLE who owns the schema.
    Policies []SchemaPolicyArgs
    Can be specified multiple times for each policy. Each policy block supports fields documented below.

    Deprecated: Use postgresql.Grant resource instead (with object_type="schema")

    database String
    The DATABASE in which where this schema will be created. (Default: The database used by your provider configuration)
    dropCascade Boolean
    When true, will also drop all the objects that are contained in the schema. (Default: false)
    ifNotExists Boolean
    When true, use the existing schema if it exists. (Default: true)
    name String
    The name of the schema. Must be unique in the PostgreSQL database instance where it is configured.
    owner String
    The ROLE who owns the schema.
    policies List<SchemaPolicy>
    Can be specified multiple times for each policy. Each policy block supports fields documented below.

    Deprecated: Use postgresql.Grant resource instead (with object_type="schema")

    database string
    The DATABASE in which where this schema will be created. (Default: The database used by your provider configuration)
    dropCascade boolean
    When true, will also drop all the objects that are contained in the schema. (Default: false)
    ifNotExists boolean
    When true, use the existing schema if it exists. (Default: true)
    name string
    The name of the schema. Must be unique in the PostgreSQL database instance where it is configured.
    owner string
    The ROLE who owns the schema.
    policies SchemaPolicy[]
    Can be specified multiple times for each policy. Each policy block supports fields documented below.

    Deprecated: Use postgresql.Grant resource instead (with object_type="schema")

    database str
    The DATABASE in which where this schema will be created. (Default: The database used by your provider configuration)
    drop_cascade bool
    When true, will also drop all the objects that are contained in the schema. (Default: false)
    if_not_exists bool
    When true, use the existing schema if it exists. (Default: true)
    name str
    The name of the schema. Must be unique in the PostgreSQL database instance where it is configured.
    owner str
    The ROLE who owns the schema.
    policies Sequence[SchemaPolicyArgs]
    Can be specified multiple times for each policy. Each policy block supports fields documented below.

    Deprecated: Use postgresql.Grant resource instead (with object_type="schema")

    database String
    The DATABASE in which where this schema will be created. (Default: The database used by your provider configuration)
    dropCascade Boolean
    When true, will also drop all the objects that are contained in the schema. (Default: false)
    ifNotExists Boolean
    When true, use the existing schema if it exists. (Default: true)
    name String
    The name of the schema. Must be unique in the PostgreSQL database instance where it is configured.
    owner String
    The ROLE who owns the schema.
    policies List<Property Map>
    Can be specified multiple times for each policy. Each policy block supports fields documented below.

    Deprecated: Use postgresql.Grant resource instead (with object_type="schema")

    Supporting Types

    SchemaPolicy, SchemaPolicyArgs

    Create bool
    Should the specified ROLE have CREATE privileges to the specified SCHEMA.
    CreateWithGrant bool
    Should the specified ROLE have CREATE privileges to the specified SCHEMA and the ability to GRANT the CREATE privilege to other ROLEs.
    Role string
    The ROLE who is receiving the policy. If this value is empty or not specified it implies the policy is referring to the PUBLIC role.
    Usage bool
    Should the specified ROLE have USAGE privileges to the specified SCHEMA.
    UsageWithGrant bool

    Should the specified ROLE have USAGE privileges to the specified SCHEMA and the ability to GRANT the USAGE privilege to other ROLEs.

    NOTE on policy: The permissions of a role specified in multiple policy blocks is cumulative. For example, if the same role is specified in two different policy each with different permissions (e.g. create and usage_with_grant, respectively), then the specified role with have both create and usage_with_grant privileges.

    Create bool
    Should the specified ROLE have CREATE privileges to the specified SCHEMA.
    CreateWithGrant bool
    Should the specified ROLE have CREATE privileges to the specified SCHEMA and the ability to GRANT the CREATE privilege to other ROLEs.
    Role string
    The ROLE who is receiving the policy. If this value is empty or not specified it implies the policy is referring to the PUBLIC role.
    Usage bool
    Should the specified ROLE have USAGE privileges to the specified SCHEMA.
    UsageWithGrant bool

    Should the specified ROLE have USAGE privileges to the specified SCHEMA and the ability to GRANT the USAGE privilege to other ROLEs.

    NOTE on policy: The permissions of a role specified in multiple policy blocks is cumulative. For example, if the same role is specified in two different policy each with different permissions (e.g. create and usage_with_grant, respectively), then the specified role with have both create and usage_with_grant privileges.

    create Boolean
    Should the specified ROLE have CREATE privileges to the specified SCHEMA.
    createWithGrant Boolean
    Should the specified ROLE have CREATE privileges to the specified SCHEMA and the ability to GRANT the CREATE privilege to other ROLEs.
    role String
    The ROLE who is receiving the policy. If this value is empty or not specified it implies the policy is referring to the PUBLIC role.
    usage Boolean
    Should the specified ROLE have USAGE privileges to the specified SCHEMA.
    usageWithGrant Boolean

    Should the specified ROLE have USAGE privileges to the specified SCHEMA and the ability to GRANT the USAGE privilege to other ROLEs.

    NOTE on policy: The permissions of a role specified in multiple policy blocks is cumulative. For example, if the same role is specified in two different policy each with different permissions (e.g. create and usage_with_grant, respectively), then the specified role with have both create and usage_with_grant privileges.

    create boolean
    Should the specified ROLE have CREATE privileges to the specified SCHEMA.
    createWithGrant boolean
    Should the specified ROLE have CREATE privileges to the specified SCHEMA and the ability to GRANT the CREATE privilege to other ROLEs.
    role string
    The ROLE who is receiving the policy. If this value is empty or not specified it implies the policy is referring to the PUBLIC role.
    usage boolean
    Should the specified ROLE have USAGE privileges to the specified SCHEMA.
    usageWithGrant boolean

    Should the specified ROLE have USAGE privileges to the specified SCHEMA and the ability to GRANT the USAGE privilege to other ROLEs.

    NOTE on policy: The permissions of a role specified in multiple policy blocks is cumulative. For example, if the same role is specified in two different policy each with different permissions (e.g. create and usage_with_grant, respectively), then the specified role with have both create and usage_with_grant privileges.

    create bool
    Should the specified ROLE have CREATE privileges to the specified SCHEMA.
    create_with_grant bool
    Should the specified ROLE have CREATE privileges to the specified SCHEMA and the ability to GRANT the CREATE privilege to other ROLEs.
    role str
    The ROLE who is receiving the policy. If this value is empty or not specified it implies the policy is referring to the PUBLIC role.
    usage bool
    Should the specified ROLE have USAGE privileges to the specified SCHEMA.
    usage_with_grant bool

    Should the specified ROLE have USAGE privileges to the specified SCHEMA and the ability to GRANT the USAGE privilege to other ROLEs.

    NOTE on policy: The permissions of a role specified in multiple policy blocks is cumulative. For example, if the same role is specified in two different policy each with different permissions (e.g. create and usage_with_grant, respectively), then the specified role with have both create and usage_with_grant privileges.

    create Boolean
    Should the specified ROLE have CREATE privileges to the specified SCHEMA.
    createWithGrant Boolean
    Should the specified ROLE have CREATE privileges to the specified SCHEMA and the ability to GRANT the CREATE privilege to other ROLEs.
    role String
    The ROLE who is receiving the policy. If this value is empty or not specified it implies the policy is referring to the PUBLIC role.
    usage Boolean
    Should the specified ROLE have USAGE privileges to the specified SCHEMA.
    usageWithGrant Boolean

    Should the specified ROLE have USAGE privileges to the specified SCHEMA and the ability to GRANT the USAGE privilege to other ROLEs.

    NOTE on policy: The permissions of a role specified in multiple policy blocks is cumulative. For example, if the same role is specified in two different policy each with different permissions (e.g. create and usage_with_grant, respectively), then the specified role with have both create and usage_with_grant privileges.

    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.1 published on Friday, May 10, 2024 by Pulumi