Policy

Manages a Policy within a Dev Test Policy Set.

Example Usage

using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
        {
            Location = "West US",
        });
        var exampleLab = new Azure.DevTest.Lab("exampleLab", new Azure.DevTest.LabArgs
        {
            Location = exampleResourceGroup.Location,
            ResourceGroupName = exampleResourceGroup.Name,
            Tags = 
            {
                { "Sydney", "Australia" },
            },
        });
        var examplePolicy = new Azure.DevTest.Policy("examplePolicy", new Azure.DevTest.PolicyArgs
        {
            PolicySetName = "default",
            LabName = exampleLab.Name,
            ResourceGroupName = exampleResourceGroup.Name,
            FactData = "",
            Threshold = "999",
            EvaluatorType = "MaxValuePolicy",
            Tags = 
            {
                { "Acceptance", "Test" },
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
    "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/devtest"
    "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 US"),
        })
        if err != nil {
            return err
        }
        exampleLab, err := devtest.NewLab(ctx, "exampleLab", &devtest.LabArgs{
            Location:          exampleResourceGroup.Location,
            ResourceGroupName: exampleResourceGroup.Name,
            Tags: pulumi.Map{
                "Sydney": pulumi.String("Australia"),
            },
        })
        if err != nil {
            return err
        }
        _, err = devtest.NewPolicy(ctx, "examplePolicy", &devtest.PolicyArgs{
            PolicySetName:     pulumi.String("default"),
            LabName:           exampleLab.Name,
            ResourceGroupName: exampleResourceGroup.Name,
            FactData:          pulumi.String(""),
            Threshold:         pulumi.String("999"),
            EvaluatorType:     pulumi.String("MaxValuePolicy"),
            Tags: pulumi.Map{
                "Acceptance": pulumi.String("Test"),
            },
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_azure as azure

example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West US")
example_lab = azure.devtest.Lab("exampleLab",
    location=example_resource_group.location,
    resource_group_name=example_resource_group.name,
    tags={
        "Sydney": "Australia",
    })
example_policy = azure.devtest.Policy("examplePolicy",
    policy_set_name="default",
    lab_name=example_lab.name,
    resource_group_name=example_resource_group.name,
    fact_data="",
    threshold="999",
    evaluator_type="MaxValuePolicy",
    tags={
        "Acceptance": "Test",
    })
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West US"});
const exampleLab = new azure.devtest.Lab("exampleLab", {
    location: exampleResourceGroup.location,
    resourceGroupName: exampleResourceGroup.name,
    tags: {
        Sydney: "Australia",
    },
});
const examplePolicy = new azure.devtest.Policy("examplePolicy", {
    policySetName: "default",
    labName: exampleLab.name,
    resourceGroupName: exampleResourceGroup.name,
    factData: "",
    threshold: "999",
    evaluatorType: "MaxValuePolicy",
    tags: {
        Acceptance: "Test",
    },
});

Create a Policy Resource

new Policy(name: string, args: PolicyArgs, opts?: CustomResourceOptions);
def Policy(resource_name, opts=None, description=None, evaluator_type=None, fact_data=None, lab_name=None, name=None, policy_set_name=None, resource_group_name=None, tags=None, threshold=None, __props__=None);
func NewPolicy(ctx *Context, name string, args PolicyArgs, opts ...ResourceOption) (*Policy, error)
public Policy(string name, PolicyArgs args, CustomResourceOptions? opts = null)
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.
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 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.

Policy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model 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 {[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 Dict[str, str]

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 str
The provider-assigned unique ID for this managed resource.

Look up an 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
static get(resource_name, id, opts=None, description=None, evaluator_type=None, fact_data=None, lab_name=None, name=None, policy_set_name=None, resource_group_name=None, tags=None, threshold=None, __props__=None);
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)
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:

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 {[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 Dict[str, str]

A mapping of tags to assign to the resource.

threshold str

The Threshold for this Policy.

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.