1. Packages
  2. Neon Provider
  3. API Docs
  4. Role
neon 0.9.0 published on Tuesday, May 6, 2025 by kislerdm

neon.Role

Explore with Pulumi AI

neon logo
neon 0.9.0 published on Tuesday, May 6, 2025 by kislerdm

    Project Role. Note that User and Role are synonymous terms in Neon. See details: https://neon.tech/docs/manage/users/

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as neon from "@pulumi/neon";
    
    const exampleProject = new neon.Project("exampleProject", {});
    const exampleBranch = new neon.Branch("exampleBranch", {projectId: exampleProject.id});
    const exampleRole = new neon.Role("exampleRole", {
        projectId: exampleProject.id,
        branchId: exampleBranch.id,
    });
    
    import pulumi
    import pulumi_neon as neon
    
    example_project = neon.Project("exampleProject")
    example_branch = neon.Branch("exampleBranch", project_id=example_project.id)
    example_role = neon.Role("exampleRole",
        project_id=example_project.id,
        branch_id=example_branch.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/neon/neon"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleProject, err := neon.NewProject(ctx, "exampleProject", nil)
    		if err != nil {
    			return err
    		}
    		exampleBranch, err := neon.NewBranch(ctx, "exampleBranch", &neon.BranchArgs{
    			ProjectId: exampleProject.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = neon.NewRole(ctx, "exampleRole", &neon.RoleArgs{
    			ProjectId: exampleProject.ID(),
    			BranchId:  exampleBranch.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Neon = Pulumi.Neon;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleProject = new Neon.Project("exampleProject");
    
        var exampleBranch = new Neon.Branch("exampleBranch", new()
        {
            ProjectId = exampleProject.Id,
        });
    
        var exampleRole = new Neon.Role("exampleRole", new()
        {
            ProjectId = exampleProject.Id,
            BranchId = exampleBranch.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.neon.Project;
    import com.pulumi.neon.Branch;
    import com.pulumi.neon.BranchArgs;
    import com.pulumi.neon.Role;
    import com.pulumi.neon.RoleArgs;
    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 exampleProject = new Project("exampleProject");
    
            var exampleBranch = new Branch("exampleBranch", BranchArgs.builder()
                .projectId(exampleProject.id())
                .build());
    
            var exampleRole = new Role("exampleRole", RoleArgs.builder()
                .projectId(exampleProject.id())
                .branchId(exampleBranch.id())
                .build());
    
        }
    }
    
    resources:
      exampleProject:
        type: neon:Project
      exampleBranch:
        type: neon:Branch
        properties:
          projectId: ${exampleProject.id}
      exampleRole:
        type: neon:Role
        properties:
          projectId: ${exampleProject.id}
          branchId: ${exampleBranch.id}
    

    Create Role Resource

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

    Constructor syntax

    new Role(name: string, args: RoleArgs, opts?: CustomResourceOptions);
    @overload
    def Role(resource_name: str,
             args: RoleArgs,
             opts: Optional[ResourceOptions] = None)
    
    @overload
    def Role(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             branch_id: Optional[str] = None,
             project_id: Optional[str] = None,
             name: Optional[str] = None,
             role_id: Optional[str] = None)
    func NewRole(ctx *Context, name string, args RoleArgs, opts ...ResourceOption) (*Role, error)
    public Role(string name, RoleArgs args, CustomResourceOptions? opts = null)
    public Role(String name, RoleArgs args)
    public Role(String name, RoleArgs args, CustomResourceOptions options)
    
    type: neon:Role
    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 RoleArgs
    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 RoleArgs
    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 RoleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RoleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RoleArgs
    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 roleResource = new Neon.Role("roleResource", new()
    {
        BranchId = "string",
        ProjectId = "string",
        Name = "string",
        RoleId = "string",
    });
    
    example, err := neon.NewRole(ctx, "roleResource", &neon.RoleArgs{
    	BranchId:  pulumi.String("string"),
    	ProjectId: pulumi.String("string"),
    	Name:      pulumi.String("string"),
    	RoleId:    pulumi.String("string"),
    })
    
    var roleResource = new Role("roleResource", RoleArgs.builder()
        .branchId("string")
        .projectId("string")
        .name("string")
        .roleId("string")
        .build());
    
    role_resource = neon.Role("roleResource",
        branch_id="string",
        project_id="string",
        name="string",
        role_id="string")
    
    const roleResource = new neon.Role("roleResource", {
        branchId: "string",
        projectId: "string",
        name: "string",
        roleId: "string",
    });
    
    type: neon:Role
    properties:
        branchId: string
        name: string
        projectId: string
        roleId: string
    

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

    BranchId string
    Branch ID.
    ProjectId string
    Project ID.
    Name string
    Role name.
    RoleId string
    The ID of this resource.
    BranchId string
    Branch ID.
    ProjectId string
    Project ID.
    Name string
    Role name.
    RoleId string
    The ID of this resource.
    branchId String
    Branch ID.
    projectId String
    Project ID.
    name String
    Role name.
    roleId String
    The ID of this resource.
    branchId string
    Branch ID.
    projectId string
    Project ID.
    name string
    Role name.
    roleId string
    The ID of this resource.
    branch_id str
    Branch ID.
    project_id str
    Project ID.
    name str
    Role name.
    role_id str
    The ID of this resource.
    branchId String
    Branch ID.
    projectId String
    Project ID.
    name String
    Role name.
    roleId String
    The ID of this resource.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Password string
    Database authentication password.
    Protected bool
    Id string
    The provider-assigned unique ID for this managed resource.
    Password string
    Database authentication password.
    Protected bool
    id String
    The provider-assigned unique ID for this managed resource.
    password String
    Database authentication password.
    protected_ Boolean
    id string
    The provider-assigned unique ID for this managed resource.
    password string
    Database authentication password.
    protected boolean
    id str
    The provider-assigned unique ID for this managed resource.
    password str
    Database authentication password.
    protected bool
    id String
    The provider-assigned unique ID for this managed resource.
    password String
    Database authentication password.
    protected Boolean

    Look up Existing Role Resource

    Get an existing Role 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?: RoleState, opts?: CustomResourceOptions): Role
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            branch_id: Optional[str] = None,
            name: Optional[str] = None,
            password: Optional[str] = None,
            project_id: Optional[str] = None,
            protected: Optional[bool] = None,
            role_id: Optional[str] = None) -> Role
    func GetRole(ctx *Context, name string, id IDInput, state *RoleState, opts ...ResourceOption) (*Role, error)
    public static Role Get(string name, Input<string> id, RoleState? state, CustomResourceOptions? opts = null)
    public static Role get(String name, Output<String> id, RoleState state, CustomResourceOptions options)
    resources:  _:    type: neon:Role    get:      id: ${id}
    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:
    BranchId string
    Branch ID.
    Name string
    Role name.
    Password string
    Database authentication password.
    ProjectId string
    Project ID.
    Protected bool
    RoleId string
    The ID of this resource.
    BranchId string
    Branch ID.
    Name string
    Role name.
    Password string
    Database authentication password.
    ProjectId string
    Project ID.
    Protected bool
    RoleId string
    The ID of this resource.
    branchId String
    Branch ID.
    name String
    Role name.
    password String
    Database authentication password.
    projectId String
    Project ID.
    protected_ Boolean
    roleId String
    The ID of this resource.
    branchId string
    Branch ID.
    name string
    Role name.
    password string
    Database authentication password.
    projectId string
    Project ID.
    protected boolean
    roleId string
    The ID of this resource.
    branch_id str
    Branch ID.
    name str
    Role name.
    password str
    Database authentication password.
    project_id str
    Project ID.
    protected bool
    role_id str
    The ID of this resource.
    branchId String
    Branch ID.
    name String
    Role name.
    password String
    Database authentication password.
    projectId String
    Project ID.
    protected Boolean
    roleId String
    The ID of this resource.

    Import

    The Neon Role can be imported to the terraform state by the identifier which is composed of the projectID, branchID

    and the Role name. For example, the identifier of the Role myRole from the branch br-snowy-mountain-a5jkb18i

    of the project shiny-cell-31746257 is shiny-cell-31746257/br-snowy-mountain-a5jkb18i/myRole.

    Import using the import block:

    For example:

    hcl

    import {

    to = neon_role.example

    id = “shiny-cell-31746257/br-snowy-mountain-a5jkb18i/myRole”

    }

    Import using the command pulumi import:

    commandline

    $ pulumi import neon:index/role:Role example "shiny-cell-31746257/br-snowy-mountain-a5jkb18i/myRole"
    

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

    Package Details

    Repository
    neon kislerdm/terraform-provider-neon
    License
    Notes
    This Pulumi package is based on the neon Terraform Provider.
    neon logo
    neon 0.9.0 published on Tuesday, May 6, 2025 by kislerdm