1. Packages
  2. Linode Provider
  3. API Docs
  4. Lock
Linode v5.6.0 published on Wednesday, Dec 24, 2025 by Pulumi
linode logo
Linode v5.6.0 published on Wednesday, Dec 24, 2025 by Pulumi

    Early Access Locks are in Early Access and may not be available to all users.

    Important Only unrestricted users can create and delete locks. Restricted users cannot manage locks even if they have read/write permissions for the resource.

    Manages a Linode Lock which prevents accidental deletion and modification of resources. Locks protect against deletion, rebuild operations, and service transfers. The cannot_delete_with_subresources lock type also protects subresources such as disks, configs, interfaces, and IP addresses.

    For more information, see the Linode APIv4 docs (TBD).

    Note Only one lock can exist per resource at a time. You cannot have both cannot_delete and cannot_delete_with_subresources locks on the same resource simultaneously.

    Example Usage

    Create a basic lock that prevents a Linode from being deleted:

    import * as pulumi from "@pulumi/pulumi";
    import * as linode from "@pulumi/linode";
    
    const my_inst = new linode.Instance("my-inst", {
        label: "my-inst",
        region: "us-east",
        type: "g6-nanode-1",
    });
    const my_lock = new linode.Lock("my-lock", {
        entityId: my_inst.id,
        entityType: "linode",
        lockType: "cannot_delete",
    });
    
    import pulumi
    import pulumi_linode as linode
    
    my_inst = linode.Instance("my-inst",
        label="my-inst",
        region="us-east",
        type="g6-nanode-1")
    my_lock = linode.Lock("my-lock",
        entity_id=my_inst.id,
        entity_type="linode",
        lock_type="cannot_delete")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-linode/sdk/v5/go/linode"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		my_inst, err := linode.NewInstance(ctx, "my-inst", &linode.InstanceArgs{
    			Label:  pulumi.String("my-inst"),
    			Region: pulumi.String("us-east"),
    			Type:   pulumi.String("g6-nanode-1"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = linode.NewLock(ctx, "my-lock", &linode.LockArgs{
    			EntityId:   my_inst.ID(),
    			EntityType: pulumi.String("linode"),
    			LockType:   pulumi.String("cannot_delete"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Linode = Pulumi.Linode;
    
    return await Deployment.RunAsync(() => 
    {
        var my_inst = new Linode.Instance("my-inst", new()
        {
            Label = "my-inst",
            Region = "us-east",
            Type = "g6-nanode-1",
        });
    
        var my_lock = new Linode.Lock("my-lock", new()
        {
            EntityId = my_inst.Id,
            EntityType = "linode",
            LockType = "cannot_delete",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.linode.Instance;
    import com.pulumi.linode.InstanceArgs;
    import com.pulumi.linode.Lock;
    import com.pulumi.linode.LockArgs;
    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 my_inst = new Instance("my-inst", InstanceArgs.builder()
                .label("my-inst")
                .region("us-east")
                .type("g6-nanode-1")
                .build());
    
            var my_lock = new Lock("my-lock", LockArgs.builder()
                .entityId(my_inst.id())
                .entityType("linode")
                .lockType("cannot_delete")
                .build());
    
        }
    }
    
    resources:
      my-lock:
        type: linode:Lock
        properties:
          entityId: ${["my-inst"].id}
          entityType: linode
          lockType: cannot_delete
      my-inst:
        type: linode:Instance
        properties:
          label: my-inst
          region: us-east
          type: g6-nanode-1
    

    Create a lock that prevents a Linode and its subresources (disks, configs, etc.) from being deleted:

    import * as pulumi from "@pulumi/pulumi";
    import * as linode from "@pulumi/linode";
    
    const my_inst = new linode.Instance("my-inst", {
        label: "my-inst",
        region: "us-east",
        type: "g6-nanode-1",
    });
    const my_lock = new linode.Lock("my-lock", {
        entityId: my_inst.id,
        entityType: "linode",
        lockType: "cannot_delete_with_subresources",
    });
    
    import pulumi
    import pulumi_linode as linode
    
    my_inst = linode.Instance("my-inst",
        label="my-inst",
        region="us-east",
        type="g6-nanode-1")
    my_lock = linode.Lock("my-lock",
        entity_id=my_inst.id,
        entity_type="linode",
        lock_type="cannot_delete_with_subresources")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-linode/sdk/v5/go/linode"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		my_inst, err := linode.NewInstance(ctx, "my-inst", &linode.InstanceArgs{
    			Label:  pulumi.String("my-inst"),
    			Region: pulumi.String("us-east"),
    			Type:   pulumi.String("g6-nanode-1"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = linode.NewLock(ctx, "my-lock", &linode.LockArgs{
    			EntityId:   my_inst.ID(),
    			EntityType: pulumi.String("linode"),
    			LockType:   pulumi.String("cannot_delete_with_subresources"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Linode = Pulumi.Linode;
    
    return await Deployment.RunAsync(() => 
    {
        var my_inst = new Linode.Instance("my-inst", new()
        {
            Label = "my-inst",
            Region = "us-east",
            Type = "g6-nanode-1",
        });
    
        var my_lock = new Linode.Lock("my-lock", new()
        {
            EntityId = my_inst.Id,
            EntityType = "linode",
            LockType = "cannot_delete_with_subresources",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.linode.Instance;
    import com.pulumi.linode.InstanceArgs;
    import com.pulumi.linode.Lock;
    import com.pulumi.linode.LockArgs;
    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 my_inst = new Instance("my-inst", InstanceArgs.builder()
                .label("my-inst")
                .region("us-east")
                .type("g6-nanode-1")
                .build());
    
            var my_lock = new Lock("my-lock", LockArgs.builder()
                .entityId(my_inst.id())
                .entityType("linode")
                .lockType("cannot_delete_with_subresources")
                .build());
    
        }
    }
    
    resources:
      my-lock:
        type: linode:Lock
        properties:
          entityId: ${["my-inst"].id}
          entityType: linode
          lockType: cannot_delete_with_subresources
      my-inst:
        type: linode:Instance
        properties:
          label: my-inst
          region: us-east
          type: g6-nanode-1
    

    Create Lock Resource

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

    Constructor syntax

    new Lock(name: string, args: LockArgs, opts?: CustomResourceOptions);
    @overload
    def Lock(resource_name: str,
             args: LockArgs,
             opts: Optional[ResourceOptions] = None)
    
    @overload
    def Lock(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             entity_id: Optional[int] = None,
             entity_type: Optional[str] = None,
             lock_type: Optional[str] = None)
    func NewLock(ctx *Context, name string, args LockArgs, opts ...ResourceOption) (*Lock, error)
    public Lock(string name, LockArgs args, CustomResourceOptions? opts = null)
    public Lock(String name, LockArgs args)
    public Lock(String name, LockArgs args, CustomResourceOptions options)
    
    type: linode:Lock
    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 LockArgs
    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 LockArgs
    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 LockArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args LockArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args LockArgs
    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 lockResource = new Linode.Lock("lockResource", new()
    {
        EntityId = 0,
        EntityType = "string",
        LockType = "string",
    });
    
    example, err := linode.NewLock(ctx, "lockResource", &linode.LockArgs{
    	EntityId:   pulumi.Int(0),
    	EntityType: pulumi.String("string"),
    	LockType:   pulumi.String("string"),
    })
    
    var lockResource = new Lock("lockResource", LockArgs.builder()
        .entityId(0)
        .entityType("string")
        .lockType("string")
        .build());
    
    lock_resource = linode.Lock("lockResource",
        entity_id=0,
        entity_type="string",
        lock_type="string")
    
    const lockResource = new linode.Lock("lockResource", {
        entityId: 0,
        entityType: "string",
        lockType: "string",
    });
    
    type: linode:Lock
    properties:
        entityId: 0
        entityType: string
        lockType: string
    

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

    EntityId int
    The ID of the entity to lock.
    EntityType string
    The type of the entity to lock. Currently only linode is supported. Note: Linodes that are part of an LKE cluster cannot be locked.
    LockType string
    The type of lock to apply. Only one lock type can exist per resource at a time. Valid values are:
    EntityId int
    The ID of the entity to lock.
    EntityType string
    The type of the entity to lock. Currently only linode is supported. Note: Linodes that are part of an LKE cluster cannot be locked.
    LockType string
    The type of lock to apply. Only one lock type can exist per resource at a time. Valid values are:
    entityId Integer
    The ID of the entity to lock.
    entityType String
    The type of the entity to lock. Currently only linode is supported. Note: Linodes that are part of an LKE cluster cannot be locked.
    lockType String
    The type of lock to apply. Only one lock type can exist per resource at a time. Valid values are:
    entityId number
    The ID of the entity to lock.
    entityType string
    The type of the entity to lock. Currently only linode is supported. Note: Linodes that are part of an LKE cluster cannot be locked.
    lockType string
    The type of lock to apply. Only one lock type can exist per resource at a time. Valid values are:
    entity_id int
    The ID of the entity to lock.
    entity_type str
    The type of the entity to lock. Currently only linode is supported. Note: Linodes that are part of an LKE cluster cannot be locked.
    lock_type str
    The type of lock to apply. Only one lock type can exist per resource at a time. Valid values are:
    entityId Number
    The ID of the entity to lock.
    entityType String
    The type of the entity to lock. Currently only linode is supported. Note: Linodes that are part of an LKE cluster cannot be locked.
    lockType String
    The type of lock to apply. Only one lock type can exist per resource at a time. Valid values are:

    Outputs

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

    EntityLabel string
    The label of the locked entity.
    EntityUrl string
    The URL of the locked entity.
    Id string
    The provider-assigned unique ID for this managed resource.
    EntityLabel string
    The label of the locked entity.
    EntityUrl string
    The URL of the locked entity.
    Id string
    The provider-assigned unique ID for this managed resource.
    entityLabel String
    The label of the locked entity.
    entityUrl String
    The URL of the locked entity.
    id String
    The provider-assigned unique ID for this managed resource.
    entityLabel string
    The label of the locked entity.
    entityUrl string
    The URL of the locked entity.
    id string
    The provider-assigned unique ID for this managed resource.
    entity_label str
    The label of the locked entity.
    entity_url str
    The URL of the locked entity.
    id str
    The provider-assigned unique ID for this managed resource.
    entityLabel String
    The label of the locked entity.
    entityUrl String
    The URL of the locked entity.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Lock Resource

    Get an existing Lock 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?: LockState, opts?: CustomResourceOptions): Lock
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            entity_id: Optional[int] = None,
            entity_label: Optional[str] = None,
            entity_type: Optional[str] = None,
            entity_url: Optional[str] = None,
            lock_type: Optional[str] = None) -> Lock
    func GetLock(ctx *Context, name string, id IDInput, state *LockState, opts ...ResourceOption) (*Lock, error)
    public static Lock Get(string name, Input<string> id, LockState? state, CustomResourceOptions? opts = null)
    public static Lock get(String name, Output<String> id, LockState state, CustomResourceOptions options)
    resources:  _:    type: linode:Lock    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:
    EntityId int
    The ID of the entity to lock.
    EntityLabel string
    The label of the locked entity.
    EntityType string
    The type of the entity to lock. Currently only linode is supported. Note: Linodes that are part of an LKE cluster cannot be locked.
    EntityUrl string
    The URL of the locked entity.
    LockType string
    The type of lock to apply. Only one lock type can exist per resource at a time. Valid values are:
    EntityId int
    The ID of the entity to lock.
    EntityLabel string
    The label of the locked entity.
    EntityType string
    The type of the entity to lock. Currently only linode is supported. Note: Linodes that are part of an LKE cluster cannot be locked.
    EntityUrl string
    The URL of the locked entity.
    LockType string
    The type of lock to apply. Only one lock type can exist per resource at a time. Valid values are:
    entityId Integer
    The ID of the entity to lock.
    entityLabel String
    The label of the locked entity.
    entityType String
    The type of the entity to lock. Currently only linode is supported. Note: Linodes that are part of an LKE cluster cannot be locked.
    entityUrl String
    The URL of the locked entity.
    lockType String
    The type of lock to apply. Only one lock type can exist per resource at a time. Valid values are:
    entityId number
    The ID of the entity to lock.
    entityLabel string
    The label of the locked entity.
    entityType string
    The type of the entity to lock. Currently only linode is supported. Note: Linodes that are part of an LKE cluster cannot be locked.
    entityUrl string
    The URL of the locked entity.
    lockType string
    The type of lock to apply. Only one lock type can exist per resource at a time. Valid values are:
    entity_id int
    The ID of the entity to lock.
    entity_label str
    The label of the locked entity.
    entity_type str
    The type of the entity to lock. Currently only linode is supported. Note: Linodes that are part of an LKE cluster cannot be locked.
    entity_url str
    The URL of the locked entity.
    lock_type str
    The type of lock to apply. Only one lock type can exist per resource at a time. Valid values are:
    entityId Number
    The ID of the entity to lock.
    entityLabel String
    The label of the locked entity.
    entityType String
    The type of the entity to lock. Currently only linode is supported. Note: Linodes that are part of an LKE cluster cannot be locked.
    entityUrl String
    The URL of the locked entity.
    lockType String
    The type of lock to apply. Only one lock type can exist per resource at a time. Valid values are:

    Import

    Locks can be imported using the Lock’s ID, e.g.

    $ pulumi import linode:index/lock:Lock my-lock 1234567
    

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

    Package Details

    Repository
    Linode pulumi/pulumi-linode
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the linode Terraform Provider.
    linode logo
    Linode v5.6.0 published on Wednesday, Dec 24, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate