Skip to content

azurermDevTestPolicy

Manages a Policy within a Dev Test Policy Set.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermDevTestLabExample = new azurerm.devTestLab.DevTestLab(
  this,
  "example_1",
  {
    location: azurermResourceGroupExample.location,
    name: "example-devtestlab",
    resource_group_name: azurermResourceGroupExample.name,
    tags: {
      Sydney: "Australia",
    },
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermDevTestLabExample.overrideLogicalId("example");
const azurermDevTestPolicyExample = new azurerm.devTestPolicy.DevTestPolicy(
  this,
  "example_2",
  {
    evaluator_type: "MaxValuePolicy",
    fact_data: "",
    lab_name: azurermDevTestLabExample.name,
    name: "LabVmCount",
    policy_set_name: "default",
    resource_group_name: azurermResourceGroupExample.name,
    tags: {
      Acceptance: "Test",
    },
    threshold: "999",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermDevTestPolicyExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) 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 - (Required) 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.

  • labName - (Required) Specifies the name of the Dev Test Lab in which the Policy should be created. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the resource group in which the Dev Test Lab resource exists. Changing this forces a new resource to be created.

  • description - (Optional) A description for the Policy.

  • evaluatorType - (Required) The Evaluation Type used for this Policy. Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy'. Changing this forces a new resource to be created.

  • threshold - (Required) The Threshold for this Policy.

  • factData - (Optional) The Fact Data for this Policy.

  • tags - (Optional) A mapping of tags to assign to the resource.

Attributes Reference

The following attributes are exported:

  • id - The ID of the Dev Test Policy.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the DevTest Policy.
  • update - (Defaults to 30 minutes) Used when updating the DevTest Policy.
  • read - (Defaults to 5 minutes) Used when retrieving the DevTest Policy.
  • delete - (Defaults to 30 minutes) Used when deleting the DevTest Policy.

Import

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

terraform import azurerm_dev_test_policy.policy1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DevTestLab/labs/lab1/policySets/default/policies/policy1