neon.Branch
Explore with Pulumi AI
Project Branch. See details: https://neon.tech/docs/introduction/branching/
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});
//## create a protected branch
const exampleIndex_branchBranch = new neon.Branch("exampleIndex/branchBranch", {
projectId: exampleProject.id,
"protected": "yes",
});
//## create a branch off of a parent branch
const parent = new neon.Branch("parent", {projectId: exampleProject.id});
const child = new neon.Branch("child", {
projectId: exampleProject.id,
parentId: parent.id,
});
import pulumi
import pulumi_neon as neon
example_project = neon.Project("exampleProject")
example_branch = neon.Branch("exampleBranch", project_id=example_project.id)
### create a protected branch
example_index_branch_branch = neon.Branch("exampleIndex/branchBranch",
project_id=example_project.id,
protected="yes")
### create a branch off of a parent branch
parent = neon.Branch("parent", project_id=example_project.id)
child = neon.Branch("child",
project_id=example_project.id,
parent_id=parent.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
}
_, err = neon.NewBranch(ctx, "exampleBranch", &neon.BranchArgs{
ProjectId: exampleProject.ID(),
})
if err != nil {
return err
}
// ## create a protected branch
_, err = neon.NewBranch(ctx, "exampleIndex/branchBranch", &neon.BranchArgs{
ProjectId: exampleProject.ID(),
Protected: pulumi.String("yes"),
})
if err != nil {
return err
}
// ## create a branch off of a parent branch
parent, err := neon.NewBranch(ctx, "parent", &neon.BranchArgs{
ProjectId: exampleProject.ID(),
})
if err != nil {
return err
}
_, err = neon.NewBranch(ctx, "child", &neon.BranchArgs{
ProjectId: exampleProject.ID(),
ParentId: parent.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,
});
//## create a protected branch
var exampleIndex_branchBranch = new Neon.Branch("exampleIndex/branchBranch", new()
{
ProjectId = exampleProject.Id,
Protected = "yes",
});
//## create a branch off of a parent branch
var parent = new Neon.Branch("parent", new()
{
ProjectId = exampleProject.Id,
});
var child = new Neon.Branch("child", new()
{
ProjectId = exampleProject.Id,
ParentId = parent.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 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());
//## create a protected branch
var exampleIndex_branchBranch = new Branch("exampleIndex/branchBranch", BranchArgs.builder()
.projectId(exampleProject.id())
.protected_("yes")
.build());
//## create a branch off of a parent branch
var parent = new Branch("parent", BranchArgs.builder()
.projectId(exampleProject.id())
.build());
var child = new Branch("child", BranchArgs.builder()
.projectId(exampleProject.id())
.parentId(parent.id())
.build());
}
}
resources:
exampleProject:
type: neon:Project
exampleBranch:
type: neon:Branch
properties:
projectId: ${exampleProject.id}
### create a protected branch
exampleIndex/branchBranch:
type: neon:Branch
properties:
projectId: ${exampleProject.id}
protected: yes
### create a branch off of a parent branch
parent:
type: neon:Branch
properties:
projectId: ${exampleProject.id}
child:
type: neon:Branch
properties:
projectId: ${exampleProject.id}
parentId: ${parent.id}
Create Branch Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Branch(name: string, args: BranchArgs, opts?: CustomResourceOptions);
@overload
def Branch(resource_name: str,
args: BranchArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Branch(resource_name: str,
opts: Optional[ResourceOptions] = None,
project_id: Optional[str] = None,
name: Optional[str] = None,
parent_id: Optional[str] = None,
parent_lsn: Optional[str] = None,
parent_timestamp: Optional[float] = None,
protected: Optional[str] = None)
func NewBranch(ctx *Context, name string, args BranchArgs, opts ...ResourceOption) (*Branch, error)
public Branch(string name, BranchArgs args, CustomResourceOptions? opts = null)
public Branch(String name, BranchArgs args)
public Branch(String name, BranchArgs args, CustomResourceOptions options)
type: neon:Branch
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 BranchArgs
- 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 BranchArgs
- 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 BranchArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args BranchArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args BranchArgs
- 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 branchResource = new Neon.Branch("branchResource", new()
{
ProjectId = "string",
Name = "string",
ParentId = "string",
ParentLsn = "string",
ParentTimestamp = 0,
Protected = "string",
});
example, err := neon.NewBranch(ctx, "branchResource", &neon.BranchArgs{
ProjectId: pulumi.String("string"),
Name: pulumi.String("string"),
ParentId: pulumi.String("string"),
ParentLsn: pulumi.String("string"),
ParentTimestamp: pulumi.Float64(0),
Protected: pulumi.String("string"),
})
var branchResource = new Branch("branchResource", BranchArgs.builder()
.projectId("string")
.name("string")
.parentId("string")
.parentLsn("string")
.parentTimestamp(0.0)
.protected_("string")
.build());
branch_resource = neon.Branch("branchResource",
project_id="string",
name="string",
parent_id="string",
parent_lsn="string",
parent_timestamp=0,
protected="string")
const branchResource = new neon.Branch("branchResource", {
projectId: "string",
name: "string",
parentId: "string",
parentLsn: "string",
parentTimestamp: 0,
"protected": "string",
});
type: neon:Branch
properties:
name: string
parentId: string
parentLsn: string
parentTimestamp: 0
projectId: string
protected: string
Branch 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 Branch resource accepts the following input properties:
- Project
Id string - Project ID.
- Name string
- Branch name.
- Parent
Id string - ID of the branch to check out.
- Parent
Lsn string - Log Sequence Number (LSN) horizon for the data to be present in the new branch. See details: https://neon.tech/docs/reference/glossary/#lsn
- Parent
Timestamp double - Timestamp horizon for the data to be present in the new branch. Note: it's defined as Unix epoch.'
- Protected string
- Set to 'yes' to activate, 'no' to deactivate explicitly, and omit to keep the default value. Set whether the branch is protected.
- Project
Id string - Project ID.
- Name string
- Branch name.
- Parent
Id string - ID of the branch to check out.
- Parent
Lsn string - Log Sequence Number (LSN) horizon for the data to be present in the new branch. See details: https://neon.tech/docs/reference/glossary/#lsn
- Parent
Timestamp float64 - Timestamp horizon for the data to be present in the new branch. Note: it's defined as Unix epoch.'
- Protected string
- Set to 'yes' to activate, 'no' to deactivate explicitly, and omit to keep the default value. Set whether the branch is protected.
- project
Id String - Project ID.
- name String
- Branch name.
- parent
Id String - ID of the branch to check out.
- parent
Lsn String - Log Sequence Number (LSN) horizon for the data to be present in the new branch. See details: https://neon.tech/docs/reference/glossary/#lsn
- parent
Timestamp Double - Timestamp horizon for the data to be present in the new branch. Note: it's defined as Unix epoch.'
- protected_ String
- Set to 'yes' to activate, 'no' to deactivate explicitly, and omit to keep the default value. Set whether the branch is protected.
- project
Id string - Project ID.
- name string
- Branch name.
- parent
Id string - ID of the branch to check out.
- parent
Lsn string - Log Sequence Number (LSN) horizon for the data to be present in the new branch. See details: https://neon.tech/docs/reference/glossary/#lsn
- parent
Timestamp number - Timestamp horizon for the data to be present in the new branch. Note: it's defined as Unix epoch.'
- protected string
- Set to 'yes' to activate, 'no' to deactivate explicitly, and omit to keep the default value. Set whether the branch is protected.
- project_
id str - Project ID.
- name str
- Branch name.
- parent_
id str - ID of the branch to check out.
- parent_
lsn str - Log Sequence Number (LSN) horizon for the data to be present in the new branch. See details: https://neon.tech/docs/reference/glossary/#lsn
- parent_
timestamp float - Timestamp horizon for the data to be present in the new branch. Note: it's defined as Unix epoch.'
- protected str
- Set to 'yes' to activate, 'no' to deactivate explicitly, and omit to keep the default value. Set whether the branch is protected.
- project
Id String - Project ID.
- name String
- Branch name.
- parent
Id String - ID of the branch to check out.
- parent
Lsn String - Log Sequence Number (LSN) horizon for the data to be present in the new branch. See details: https://neon.tech/docs/reference/glossary/#lsn
- parent
Timestamp Number - Timestamp horizon for the data to be present in the new branch. Note: it's defined as Unix epoch.'
- protected String
- Set to 'yes' to activate, 'no' to deactivate explicitly, and omit to keep the default value. Set whether the branch is protected.
Outputs
All input properties are implicitly available as output properties. Additionally, the Branch resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Logical
Size double - Branch logical size in MB.
- Id string
- The provider-assigned unique ID for this managed resource.
- Logical
Size float64 - Branch logical size in MB.
- id String
- The provider-assigned unique ID for this managed resource.
- logical
Size Double - Branch logical size in MB.
- id string
- The provider-assigned unique ID for this managed resource.
- logical
Size number - Branch logical size in MB.
- id str
- The provider-assigned unique ID for this managed resource.
- logical_
size float - Branch logical size in MB.
- id String
- The provider-assigned unique ID for this managed resource.
- logical
Size Number - Branch logical size in MB.
Look up Existing Branch Resource
Get an existing Branch 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?: BranchState, opts?: CustomResourceOptions): Branch
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
logical_size: Optional[float] = None,
name: Optional[str] = None,
parent_id: Optional[str] = None,
parent_lsn: Optional[str] = None,
parent_timestamp: Optional[float] = None,
project_id: Optional[str] = None,
protected: Optional[str] = None) -> Branch
func GetBranch(ctx *Context, name string, id IDInput, state *BranchState, opts ...ResourceOption) (*Branch, error)
public static Branch Get(string name, Input<string> id, BranchState? state, CustomResourceOptions? opts = null)
public static Branch get(String name, Output<String> id, BranchState state, CustomResourceOptions options)
resources: _: type: neon:Branch 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.
- Logical
Size double - Branch logical size in MB.
- Name string
- Branch name.
- Parent
Id string - ID of the branch to check out.
- Parent
Lsn string - Log Sequence Number (LSN) horizon for the data to be present in the new branch. See details: https://neon.tech/docs/reference/glossary/#lsn
- Parent
Timestamp double - Timestamp horizon for the data to be present in the new branch. Note: it's defined as Unix epoch.'
- Project
Id string - Project ID.
- Protected string
- Set to 'yes' to activate, 'no' to deactivate explicitly, and omit to keep the default value. Set whether the branch is protected.
- Logical
Size float64 - Branch logical size in MB.
- Name string
- Branch name.
- Parent
Id string - ID of the branch to check out.
- Parent
Lsn string - Log Sequence Number (LSN) horizon for the data to be present in the new branch. See details: https://neon.tech/docs/reference/glossary/#lsn
- Parent
Timestamp float64 - Timestamp horizon for the data to be present in the new branch. Note: it's defined as Unix epoch.'
- Project
Id string - Project ID.
- Protected string
- Set to 'yes' to activate, 'no' to deactivate explicitly, and omit to keep the default value. Set whether the branch is protected.
- logical
Size Double - Branch logical size in MB.
- name String
- Branch name.
- parent
Id String - ID of the branch to check out.
- parent
Lsn String - Log Sequence Number (LSN) horizon for the data to be present in the new branch. See details: https://neon.tech/docs/reference/glossary/#lsn
- parent
Timestamp Double - Timestamp horizon for the data to be present in the new branch. Note: it's defined as Unix epoch.'
- project
Id String - Project ID.
- protected_ String
- Set to 'yes' to activate, 'no' to deactivate explicitly, and omit to keep the default value. Set whether the branch is protected.
- logical
Size number - Branch logical size in MB.
- name string
- Branch name.
- parent
Id string - ID of the branch to check out.
- parent
Lsn string - Log Sequence Number (LSN) horizon for the data to be present in the new branch. See details: https://neon.tech/docs/reference/glossary/#lsn
- parent
Timestamp number - Timestamp horizon for the data to be present in the new branch. Note: it's defined as Unix epoch.'
- project
Id string - Project ID.
- protected string
- Set to 'yes' to activate, 'no' to deactivate explicitly, and omit to keep the default value. Set whether the branch is protected.
- logical_
size float - Branch logical size in MB.
- name str
- Branch name.
- parent_
id str - ID of the branch to check out.
- parent_
lsn str - Log Sequence Number (LSN) horizon for the data to be present in the new branch. See details: https://neon.tech/docs/reference/glossary/#lsn
- parent_
timestamp float - Timestamp horizon for the data to be present in the new branch. Note: it's defined as Unix epoch.'
- project_
id str - Project ID.
- protected str
- Set to 'yes' to activate, 'no' to deactivate explicitly, and omit to keep the default value. Set whether the branch is protected.
- logical
Size Number - Branch logical size in MB.
- name String
- Branch name.
- parent
Id String - ID of the branch to check out.
- parent
Lsn String - Log Sequence Number (LSN) horizon for the data to be present in the new branch. See details: https://neon.tech/docs/reference/glossary/#lsn
- parent
Timestamp Number - Timestamp horizon for the data to be present in the new branch. Note: it's defined as Unix epoch.'
- project
Id String - Project ID.
- protected String
- Set to 'yes' to activate, 'no' to deactivate explicitly, and omit to keep the default value. Set whether the branch is protected.
Import
The Neon Branch can be imported to the terraform state by its identifier.
Import using the import block:
For example:
hcl
import {
to = neon_branch.example
id = “br-snowy-mountain-a5jkb18i”
}
Import using the command pulumi import
:
commandline
$ pulumi import neon:index/branch:Branch example br-snowy-mountain-a5jkb18i
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.