1. Packages
  2. Azure Classic
  3. API Docs
  4. devtest
  5. Policy

We recommend using Azure Native.

Azure Classic v5.70.0 published on Wednesday, Mar 27, 2024 by Pulumi

azure.devtest.Policy

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.70.0 published on Wednesday, Mar 27, 2024 by Pulumi

    Manages a Policy within a Dev Test Policy Set.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = new azure.core.ResourceGroup("example", {
        name: "example-resources",
        location: "West Europe",
    });
    const exampleLab = new azure.devtest.Lab("example", {
        name: "example-devtestlab",
        location: example.location,
        resourceGroupName: example.name,
        tags: {
            Sydney: "Australia",
        },
    });
    const examplePolicy = new azure.devtest.Policy("example", {
        name: "LabVmCount",
        policySetName: "default",
        labName: exampleLab.name,
        resourceGroupName: example.name,
        factData: "",
        threshold: "999",
        evaluatorType: "MaxValuePolicy",
        tags: {
            Acceptance: "Test",
        },
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.core.ResourceGroup("example",
        name="example-resources",
        location="West Europe")
    example_lab = azure.devtest.Lab("example",
        name="example-devtestlab",
        location=example.location,
        resource_group_name=example.name,
        tags={
            "Sydney": "Australia",
        })
    example_policy = azure.devtest.Policy("example",
        name="LabVmCount",
        policy_set_name="default",
        lab_name=example_lab.name,
        resource_group_name=example.name,
        fact_data="",
        threshold="999",
        evaluator_type="MaxValuePolicy",
        tags={
            "Acceptance": "Test",
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/devtest"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
    			Name:     pulumi.String("example-resources"),
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleLab, err := devtest.NewLab(ctx, "example", &devtest.LabArgs{
    			Name:              pulumi.String("example-devtestlab"),
    			Location:          example.Location,
    			ResourceGroupName: example.Name,
    			Tags: pulumi.StringMap{
    				"Sydney": pulumi.String("Australia"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = devtest.NewPolicy(ctx, "example", &devtest.PolicyArgs{
    			Name:              pulumi.String("LabVmCount"),
    			PolicySetName:     pulumi.String("default"),
    			LabName:           exampleLab.Name,
    			ResourceGroupName: example.Name,
    			FactData:          pulumi.String(""),
    			Threshold:         pulumi.String("999"),
    			EvaluatorType:     pulumi.String("MaxValuePolicy"),
    			Tags: pulumi.StringMap{
    				"Acceptance": pulumi.String("Test"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Azure.Core.ResourceGroup("example", new()
        {
            Name = "example-resources",
            Location = "West Europe",
        });
    
        var exampleLab = new Azure.DevTest.Lab("example", new()
        {
            Name = "example-devtestlab",
            Location = example.Location,
            ResourceGroupName = example.Name,
            Tags = 
            {
                { "Sydney", "Australia" },
            },
        });
    
        var examplePolicy = new Azure.DevTest.Policy("example", new()
        {
            Name = "LabVmCount",
            PolicySetName = "default",
            LabName = exampleLab.Name,
            ResourceGroupName = example.Name,
            FactData = "",
            Threshold = "999",
            EvaluatorType = "MaxValuePolicy",
            Tags = 
            {
                { "Acceptance", "Test" },
            },
        });
    
    });
    
    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.devtest.Lab;
    import com.pulumi.azure.devtest.LabArgs;
    import com.pulumi.azure.devtest.Policy;
    import com.pulumi.azure.devtest.PolicyArgs;
    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()        
                .name("example-resources")
                .location("West Europe")
                .build());
    
            var exampleLab = new Lab("exampleLab", LabArgs.builder()        
                .name("example-devtestlab")
                .location(example.location())
                .resourceGroupName(example.name())
                .tags(Map.of("Sydney", "Australia"))
                .build());
    
            var examplePolicy = new Policy("examplePolicy", PolicyArgs.builder()        
                .name("LabVmCount")
                .policySetName("default")
                .labName(exampleLab.name())
                .resourceGroupName(example.name())
                .factData("")
                .threshold("999")
                .evaluatorType("MaxValuePolicy")
                .tags(Map.of("Acceptance", "Test"))
                .build());
    
        }
    }
    
    resources:
      example:
        type: azure:core:ResourceGroup
        properties:
          name: example-resources
          location: West Europe
      exampleLab:
        type: azure:devtest:Lab
        name: example
        properties:
          name: example-devtestlab
          location: ${example.location}
          resourceGroupName: ${example.name}
          tags:
            Sydney: Australia
      examplePolicy:
        type: azure:devtest:Policy
        name: example
        properties:
          name: LabVmCount
          policySetName: default
          labName: ${exampleLab.name}
          resourceGroupName: ${example.name}
          factData:
          threshold: '999'
          evaluatorType: MaxValuePolicy
          tags:
            Acceptance: Test
    

    Create Policy Resource

    new Policy(name: string, args: PolicyArgs, opts?: CustomResourceOptions);
    @overload
    def Policy(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               description: Optional[str] = None,
               evaluator_type: Optional[str] = None,
               fact_data: Optional[str] = None,
               lab_name: Optional[str] = None,
               name: Optional[str] = None,
               policy_set_name: Optional[str] = None,
               resource_group_name: Optional[str] = None,
               tags: Optional[Mapping[str, str]] = None,
               threshold: Optional[str] = None)
    @overload
    def Policy(resource_name: str,
               args: PolicyArgs,
               opts: Optional[ResourceOptions] = None)
    func NewPolicy(ctx *Context, name string, args PolicyArgs, opts ...ResourceOption) (*Policy, error)
    public Policy(string name, PolicyArgs args, CustomResourceOptions? opts = null)
    public Policy(String name, PolicyArgs args)
    public Policy(String name, PolicyArgs args, CustomResourceOptions options)
    
    type: azure:devtest:Policy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args PolicyArgs
    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 PolicyArgs
    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 PolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Policy Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Policy resource accepts the following input properties:

    EvaluatorType string
    The Evaluation Type used for this Policy. Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy'. Changing this forces a new resource to be created.
    LabName string
    Specifies the name of the Dev Test Lab in which the Policy should be created. Changing this forces a new resource to be created.
    PolicySetName string
    Specifies the name of the Policy Set within the Dev Test Lab where this policy should be created. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
    Threshold string
    The Threshold for this Policy.
    Description string
    A description for the Policy.
    FactData string
    The Fact Data for this Policy.
    Name string
    Specifies the name of the Dev Test Policy. Possible values are GalleryImage, LabPremiumVmCount, LabTargetCost, LabVmCount, LabVmSize, UserOwnedLabPremiumVmCount, UserOwnedLabVmCount and UserOwnedLabVmCountInSubnet. Changing this forces a new resource to be created.
    Tags Dictionary<string, string>
    A mapping of tags to assign to the resource.
    EvaluatorType string
    The Evaluation Type used for this Policy. Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy'. Changing this forces a new resource to be created.
    LabName string
    Specifies the name of the Dev Test Lab in which the Policy should be created. Changing this forces a new resource to be created.
    PolicySetName string
    Specifies the name of the Policy Set within the Dev Test Lab where this policy should be created. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
    Threshold string
    The Threshold for this Policy.
    Description string
    A description for the Policy.
    FactData string
    The Fact Data for this Policy.
    Name string
    Specifies the name of the Dev Test Policy. Possible values are GalleryImage, LabPremiumVmCount, LabTargetCost, LabVmCount, LabVmSize, UserOwnedLabPremiumVmCount, UserOwnedLabVmCount and UserOwnedLabVmCountInSubnet. Changing this forces a new resource to be created.
    Tags map[string]string
    A mapping of tags to assign to the resource.
    evaluatorType String
    The Evaluation Type used for this Policy. Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy'. Changing this forces a new resource to be created.
    labName String
    Specifies the name of the Dev Test Lab in which the Policy should be created. Changing this forces a new resource to be created.
    policySetName String
    Specifies the name of the Policy Set within the Dev Test Lab where this policy should be created. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
    threshold String
    The Threshold for this Policy.
    description String
    A description for the Policy.
    factData String
    The Fact Data for this Policy.
    name String
    Specifies the name of the Dev Test Policy. Possible values are GalleryImage, LabPremiumVmCount, LabTargetCost, LabVmCount, LabVmSize, UserOwnedLabPremiumVmCount, UserOwnedLabVmCount and UserOwnedLabVmCountInSubnet. Changing this forces a new resource to be created.
    tags Map<String,String>
    A mapping of tags to assign to the resource.
    evaluatorType string
    The Evaluation Type used for this Policy. Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy'. Changing this forces a new resource to be created.
    labName string
    Specifies the name of the Dev Test Lab in which the Policy should be created. Changing this forces a new resource to be created.
    policySetName string
    Specifies the name of the Policy Set within the Dev Test Lab where this policy should be created. Changing this forces a new resource to be created.
    resourceGroupName string
    The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
    threshold string
    The Threshold for this Policy.
    description string
    A description for the Policy.
    factData string
    The Fact Data for this Policy.
    name string
    Specifies the name of the Dev Test Policy. Possible values are GalleryImage, LabPremiumVmCount, LabTargetCost, LabVmCount, LabVmSize, UserOwnedLabPremiumVmCount, UserOwnedLabVmCount and UserOwnedLabVmCountInSubnet. Changing this forces a new resource to be created.
    tags {[key: string]: string}
    A mapping of tags to assign to the resource.
    evaluator_type str
    The Evaluation Type used for this Policy. Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy'. Changing this forces a new resource to be created.
    lab_name str
    Specifies the name of the Dev Test Lab in which the Policy should be created. Changing this forces a new resource to be created.
    policy_set_name str
    Specifies the name of the Policy Set within the Dev Test Lab where this policy should be created. Changing this forces a new resource to be created.
    resource_group_name str
    The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
    threshold str
    The Threshold for this Policy.
    description str
    A description for the Policy.
    fact_data str
    The Fact Data for this Policy.
    name str
    Specifies the name of the Dev Test Policy. Possible values are GalleryImage, LabPremiumVmCount, LabTargetCost, LabVmCount, LabVmSize, UserOwnedLabPremiumVmCount, UserOwnedLabVmCount and UserOwnedLabVmCountInSubnet. Changing this forces a new resource to be created.
    tags Mapping[str, str]
    A mapping of tags to assign to the resource.
    evaluatorType String
    The Evaluation Type used for this Policy. Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy'. Changing this forces a new resource to be created.
    labName String
    Specifies the name of the Dev Test Lab in which the Policy should be created. Changing this forces a new resource to be created.
    policySetName String
    Specifies the name of the Policy Set within the Dev Test Lab where this policy should be created. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
    threshold String
    The Threshold for this Policy.
    description String
    A description for the Policy.
    factData String
    The Fact Data for this Policy.
    name String
    Specifies the name of the Dev Test Policy. Possible values are GalleryImage, LabPremiumVmCount, LabTargetCost, LabVmCount, LabVmSize, UserOwnedLabPremiumVmCount, UserOwnedLabVmCount and UserOwnedLabVmCountInSubnet. Changing this forces a new resource to be created.
    tags Map<String>
    A mapping of tags to assign to the resource.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Policy Resource

    Get an existing Policy 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?: PolicyState, opts?: CustomResourceOptions): Policy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            evaluator_type: Optional[str] = None,
            fact_data: Optional[str] = None,
            lab_name: Optional[str] = None,
            name: Optional[str] = None,
            policy_set_name: Optional[str] = None,
            resource_group_name: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            threshold: Optional[str] = None) -> Policy
    func GetPolicy(ctx *Context, name string, id IDInput, state *PolicyState, opts ...ResourceOption) (*Policy, error)
    public static Policy Get(string name, Input<string> id, PolicyState? state, CustomResourceOptions? opts = null)
    public static Policy get(String name, Output<String> id, PolicyState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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:
    Description string
    A description for the Policy.
    EvaluatorType string
    The Evaluation Type used for this Policy. Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy'. Changing this forces a new resource to be created.
    FactData string
    The Fact Data for this Policy.
    LabName string
    Specifies the name of the Dev Test Lab in which the Policy should be created. Changing this forces a new resource to be created.
    Name string
    Specifies the name of the Dev Test Policy. Possible values are GalleryImage, LabPremiumVmCount, LabTargetCost, LabVmCount, LabVmSize, UserOwnedLabPremiumVmCount, UserOwnedLabVmCount and UserOwnedLabVmCountInSubnet. Changing this forces a new resource to be created.
    PolicySetName string
    Specifies the name of the Policy Set within the Dev Test Lab where this policy should be created. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
    Tags Dictionary<string, string>
    A mapping of tags to assign to the resource.
    Threshold string
    The Threshold for this Policy.
    Description string
    A description for the Policy.
    EvaluatorType string
    The Evaluation Type used for this Policy. Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy'. Changing this forces a new resource to be created.
    FactData string
    The Fact Data for this Policy.
    LabName string
    Specifies the name of the Dev Test Lab in which the Policy should be created. Changing this forces a new resource to be created.
    Name string
    Specifies the name of the Dev Test Policy. Possible values are GalleryImage, LabPremiumVmCount, LabTargetCost, LabVmCount, LabVmSize, UserOwnedLabPremiumVmCount, UserOwnedLabVmCount and UserOwnedLabVmCountInSubnet. Changing this forces a new resource to be created.
    PolicySetName string
    Specifies the name of the Policy Set within the Dev Test Lab where this policy should be created. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
    Tags map[string]string
    A mapping of tags to assign to the resource.
    Threshold string
    The Threshold for this Policy.
    description String
    A description for the Policy.
    evaluatorType String
    The Evaluation Type used for this Policy. Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy'. Changing this forces a new resource to be created.
    factData String
    The Fact Data for this Policy.
    labName String
    Specifies the name of the Dev Test Lab in which the Policy should be created. Changing this forces a new resource to be created.
    name String
    Specifies the name of the Dev Test Policy. Possible values are GalleryImage, LabPremiumVmCount, LabTargetCost, LabVmCount, LabVmSize, UserOwnedLabPremiumVmCount, UserOwnedLabVmCount and UserOwnedLabVmCountInSubnet. Changing this forces a new resource to be created.
    policySetName String
    Specifies the name of the Policy Set within the Dev Test Lab where this policy should be created. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
    tags Map<String,String>
    A mapping of tags to assign to the resource.
    threshold String
    The Threshold for this Policy.
    description string
    A description for the Policy.
    evaluatorType string
    The Evaluation Type used for this Policy. Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy'. Changing this forces a new resource to be created.
    factData string
    The Fact Data for this Policy.
    labName string
    Specifies the name of the Dev Test Lab in which the Policy should be created. Changing this forces a new resource to be created.
    name string
    Specifies the name of the Dev Test Policy. Possible values are GalleryImage, LabPremiumVmCount, LabTargetCost, LabVmCount, LabVmSize, UserOwnedLabPremiumVmCount, UserOwnedLabVmCount and UserOwnedLabVmCountInSubnet. Changing this forces a new resource to be created.
    policySetName string
    Specifies the name of the Policy Set within the Dev Test Lab where this policy should be created. Changing this forces a new resource to be created.
    resourceGroupName string
    The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
    tags {[key: string]: string}
    A mapping of tags to assign to the resource.
    threshold string
    The Threshold for this Policy.
    description str
    A description for the Policy.
    evaluator_type str
    The Evaluation Type used for this Policy. Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy'. Changing this forces a new resource to be created.
    fact_data str
    The Fact Data for this Policy.
    lab_name str
    Specifies the name of the Dev Test Lab in which the Policy should be created. Changing this forces a new resource to be created.
    name str
    Specifies the name of the Dev Test Policy. Possible values are GalleryImage, LabPremiumVmCount, LabTargetCost, LabVmCount, LabVmSize, UserOwnedLabPremiumVmCount, UserOwnedLabVmCount and UserOwnedLabVmCountInSubnet. Changing this forces a new resource to be created.
    policy_set_name str
    Specifies the name of the Policy Set within the Dev Test Lab where this policy should be created. Changing this forces a new resource to be created.
    resource_group_name str
    The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
    tags Mapping[str, str]
    A mapping of tags to assign to the resource.
    threshold str
    The Threshold for this Policy.
    description String
    A description for the Policy.
    evaluatorType String
    The Evaluation Type used for this Policy. Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy'. Changing this forces a new resource to be created.
    factData String
    The Fact Data for this Policy.
    labName String
    Specifies the name of the Dev Test Lab in which the Policy should be created. Changing this forces a new resource to be created.
    name String
    Specifies the name of the Dev Test Policy. Possible values are GalleryImage, LabPremiumVmCount, LabTargetCost, LabVmCount, LabVmSize, UserOwnedLabPremiumVmCount, UserOwnedLabVmCount and UserOwnedLabVmCountInSubnet. Changing this forces a new resource to be created.
    policySetName String
    Specifies the name of the Policy Set within the Dev Test Lab where this policy should be created. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.
    tags Map<String>
    A mapping of tags to assign to the resource.
    threshold String
    The Threshold for this Policy.

    Import

    Dev Test Policies can be imported using the resource id, e.g.

    $ pulumi import azure:devtest/policy:Policy policy1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/policySets/default/policies/policy1
    

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.70.0 published on Wednesday, Mar 27, 2024 by Pulumi