ManangementLockArgs

data class ManangementLockArgs constructor(val lockLevel: Output<String>? = null, val name: Output<String>? = null, val notes: Output<String>? = null, val scope: Output<String>? = null) : ConvertibleToJava<ManangementLockArgs>

Manages a Management Lock which is scoped to a Subscription, Resource Group or Resource.

Example Usage

Subscription Level Lock)

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.CoreFunctions;
import com.pulumi.azure.core.inputs.GetSubscriptionArgs;
import com.pulumi.azure.management.Lock;
import com.pulumi.azure.management.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) {
final var current = CoreFunctions.getSubscription();
var subscription_level = new Lock("subscription-level", LockArgs.builder()
.scope(current.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
.lockLevel("CanNotDelete")
.notes("Items can't be deleted in this subscription!")
.build());
}
}

Resource Group Level Lock)

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.management.Lock;
import com.pulumi.azure.management.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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var resource_group_level = new Lock("resource-group-level", LockArgs.builder()
.scope(example.id())
.lockLevel("ReadOnly")
.notes("This Resource Group is Read-Only")
.build());
}
}

Resource Level Lock)

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.network.PublicIp;
import com.pulumi.azure.network.PublicIpArgs;
import com.pulumi.azure.management.Lock;
import com.pulumi.azure.management.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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var examplePublicIp = new PublicIp("examplePublicIp", PublicIpArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.allocationMethod("Static")
.idleTimeoutInMinutes(30)
.build());
var public_ip = new Lock("public-ip", LockArgs.builder()
.scope(examplePublicIp.id())
.lockLevel("CanNotDelete")
.notes("Locked because it's needed by a third-party")
.build());
}
}

Import

Management Locks can be imported using the resource id, e.g.

$ pulumi import azure:managementresource/manangementLock:ManangementLock lock1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Authorization/locks/lock1

Constructors

Link copied to clipboard
fun ManangementLockArgs(lockLevel: Output<String>? = null, name: Output<String>? = null, notes: Output<String>? = null, scope: Output<String>? = null)

Functions

Link copied to clipboard
open override fun toJava(): ManangementLockArgs

Properties

Link copied to clipboard
val lockLevel: Output<String>? = null

Specifies the Level to be used for this Lock. Possible values are CanNotDelete and ReadOnly. Changing this forces a new resource to be created.

Link copied to clipboard
val name: Output<String>? = null

Specifies the name of the Management Lock. Changing this forces a new resource to be created.

Link copied to clipboard
val notes: Output<String>? = null

Specifies some notes about the lock. Maximum of 512 characters. Changing this forces a new resource to be created.

Link copied to clipboard
val scope: Output<String>? = null

Specifies the scope at which the Management Lock should be created. Changing this forces a new resource to be created.