Skip to content

azurermSubscriptionPolicyExemption

Manages a Subscription Policy Exemption.

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 dataAzurermPolicySetDefinitionExample =
  new azurerm.dataAzurermPolicySetDefinition.DataAzurermPolicySetDefinition(
    this,
    "example",
    {
      display_name: "Audit machines with insecure password security settings",
    }
  );
const dataAzurermSubscriptionExample =
  new azurerm.dataAzurermSubscription.DataAzurermSubscription(
    this,
    "example_1",
    {}
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
dataAzurermSubscriptionExample.overrideLogicalId("example");
const azurermSubscriptionPolicyAssignmentExample =
  new azurerm.subscriptionPolicyAssignment.SubscriptionPolicyAssignment(
    this,
    "example_2",
    {
      identity: [
        {
          type: "SystemAssigned",
        },
      ],
      location: "westus",
      name: "exampleAssignment",
      policy_definition_id: dataAzurermPolicySetDefinitionExample.id,
      subscription_id: dataAzurermSubscriptionExample.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSubscriptionPolicyAssignmentExample.overrideLogicalId("example");
const azurermSubscriptionPolicyExemptionExample =
  new azurerm.subscriptionPolicyExemption.SubscriptionPolicyExemption(
    this,
    "example_3",
    {
      exemption_category: "Mitigated",
      name: "exampleExemption",
      policy_assignment_id: azurermSubscriptionPolicyAssignmentExample.id,
      subscription_id: dataAzurermSubscriptionExample.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSubscriptionPolicyExemptionExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the Policy Exemption. Changing this forces a new resource to be created.

  • subscriptionId - (Required) The Subscription ID where the Policy Exemption should be applied. Changing this forces a new resource to be created.

  • exemptionCategory - (Required) The category of this policy exemption. Possible values are waiver and mitigated.

  • policyAssignmentId - (Required) The ID of the Policy Assignment to be exempted at the specified Scope. Changing this forces a new resource to be created.

  • description - (Optional) A description to use for this Policy Exemption.

  • displayName - (Optional) A friendly display name to use for this Policy Exemption.

  • expiresOn - (Optional) The expiration date and time in UTC ISO 8601 format of this policy exemption.

  • policyDefinitionReferenceIds - (Optional) The policy definition reference ID list when the associated policy assignment is an assignment of a policy set definition.

  • metadata - (Optional) The metadata for this policy exemption. This is a JSON string representing additional metadata that should be stored with the policy exemption.

Attributes Reference

The following attributes are exported:

  • id - The Policy Exemption id.

Timeouts

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

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

Import

Policy Exemptions can be imported using the resourceId, e.g.

terraform import azurerm_subscription_policy_exemption.exemption1 /subscriptions/00000000-0000-0000-000000000000/providers/Microsoft.Authorization/policyExemptions/exemption1