Lock
Manages a Management Lock which is scoped to a Subscription, Resource Group or Resource.
Example Usage
Subscription Level Lock)
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var current = Output.Create(Azure.Core.GetSubscription.InvokeAsync());
var subscription_level = new Azure.Management.Lock("subscription-level", new Azure.Management.LockArgs
{
Scope = current.Apply(current => current.Id),
LockLevel = "CanNotDelete",
Notes = "Items can't be deleted in this subscription!",
});
}
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/management"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
current, err := core.GetSubscription(ctx, nil, nil)
if err != nil {
return err
}
_, err = management.NewLock(ctx, "subscription-level", &management.LockArgs{
Scope: pulumi.String(current.Id),
LockLevel: pulumi.String("CanNotDelete"),
Notes: pulumi.String("Items can't be deleted in this subscription!"),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_azure as azure
current = azure.core.get_subscription()
subscription_level = azure.management.Lock("subscription-level",
scope=current.id,
lock_level="CanNotDelete",
notes="Items can't be deleted in this subscription!")import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const current = azure.core.getSubscription({});
const subscription_level = new azure.management.Lock("subscription-level", {
scope: current.then(current => current.id),
lockLevel: "CanNotDelete",
notes: "Items can't be deleted in this subscription!",
});Resource Level Lock)
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
{
Location = "West Europe",
});
var examplePublicIp = new Azure.Network.PublicIp("examplePublicIp", new Azure.Network.PublicIpArgs
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
AllocationMethod = "Static",
IdleTimeoutInMinutes = 30,
});
var public_ip = new Azure.Management.Lock("public-ip", new Azure.Management.LockArgs
{
Scope = examplePublicIp.Id,
LockLevel = "CanNotDelete",
Notes = "Locked because it's needed by a third-party",
});
}
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/management"
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/network"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
examplePublicIp, err := network.NewPublicIp(ctx, "examplePublicIp", &network.PublicIpArgs{
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.Name,
AllocationMethod: pulumi.String("Static"),
IdleTimeoutInMinutes: pulumi.Int(30),
})
if err != nil {
return err
}
_, err = management.NewLock(ctx, "public-ip", &management.LockArgs{
Scope: examplePublicIp.ID(),
LockLevel: pulumi.String("CanNotDelete"),
Notes: pulumi.String("Locked because it's needed by a third-party"),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_public_ip = azure.network.PublicIp("examplePublicIp",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
allocation_method="Static",
idle_timeout_in_minutes=30)
public_ip = azure.management.Lock("public-ip",
scope=example_public_ip.id,
lock_level="CanNotDelete",
notes="Locked because it's needed by a third-party")import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const examplePublicIp = new azure.network.PublicIp("examplePublicIp", {
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
allocationMethod: "Static",
idleTimeoutInMinutes: 30,
});
const public_ip = new azure.management.Lock("public-ip", {
scope: examplePublicIp.id,
lockLevel: "CanNotDelete",
notes: "Locked because it's needed by a third-party",
});Create a Lock Resource
new Lock(name: string, args: LockArgs, opts?: CustomResourceOptions);def Lock(resource_name, opts=None, lock_level=None, name=None, notes=None, scope=None, __props__=None);public Lock(string name, LockArgs args, CustomResourceOptions? opts = null)- 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.
- opts ResourceOptions
- A bag of options that control this 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.
Lock Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Lock resource accepts the following input properties:
- Lock
Level string Specifies the Level to be used for this Lock. Possible values are
CanNotDeleteandReadOnly. Changing this forces a new resource to be created.- Scope string
Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.
- Name string
Specifies the name of the Management Lock. Changing this forces a new resource to be created.
- Notes string
Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.
- Lock
Level string Specifies the Level to be used for this Lock. Possible values are
CanNotDeleteandReadOnly. Changing this forces a new resource to be created.- Scope string
Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.
- Name string
Specifies the name of the Management Lock. Changing this forces a new resource to be created.
- Notes string
Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.
- lock
Level string Specifies the Level to be used for this Lock. Possible values are
CanNotDeleteandReadOnly. Changing this forces a new resource to be created.- scope string
Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.
- name string
Specifies the name of the Management Lock. Changing this forces a new resource to be created.
- notes string
Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.
- lock_
level str Specifies the Level to be used for this Lock. Possible values are
CanNotDeleteandReadOnly. Changing this forces a new resource to be created.- scope str
Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.
- name str
Specifies the name of the Management Lock. Changing this forces a new resource to be created.
- notes str
Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.
Outputs
All input properties are implicitly available as output properties. Additionally, the Lock resource produces the following output properties:
Look up an 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): Lockstatic get(resource_name, id, opts=None, lock_level=None, name=None, notes=None, scope=None, __props__=None);public static Lock Get(string name, Input<string> id, LockState? state, CustomResourceOptions? opts = null)- 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.
The following state arguments are supported:
- Lock
Level string Specifies the Level to be used for this Lock. Possible values are
CanNotDeleteandReadOnly. Changing this forces a new resource to be created.- Name string
Specifies the name of the Management Lock. Changing this forces a new resource to be created.
- Notes string
Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.
- Scope string
Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.
- Lock
Level string Specifies the Level to be used for this Lock. Possible values are
CanNotDeleteandReadOnly. Changing this forces a new resource to be created.- Name string
Specifies the name of the Management Lock. Changing this forces a new resource to be created.
- Notes string
Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.
- Scope string
Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.
- lock
Level string Specifies the Level to be used for this Lock. Possible values are
CanNotDeleteandReadOnly. Changing this forces a new resource to be created.- name string
Specifies the name of the Management Lock. Changing this forces a new resource to be created.
- notes string
Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.
- scope string
Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.
- lock_
level str Specifies the Level to be used for this Lock. Possible values are
CanNotDeleteandReadOnly. Changing this forces a new resource to be created.- name str
Specifies the name of the Management Lock. Changing this forces a new resource to be created.
- notes str
Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.
- scope str
Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.
Package Details
- Repository
- https://github.com/pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.