Skip to content

azurermNetappSnapshotPolicy

Manages a NetApp Snapshot Policy.

NetApp Snapshot Policy 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: "East US",
    name: "resource-group-01",
  }
);
const azurermNetappAccountExample = new azurerm.netappAccount.NetappAccount(
  this,
  "example_1",
  {
    location: azurermResourceGroupExample.location,
    name: "netappaccount-01",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermNetappAccountExample.overrideLogicalId("example");
const azurermNetappSnapshotPolicyExample =
  new azurerm.netappSnapshotPolicy.NetappSnapshotPolicy(this, "example_2", {
    account_name: azurermNetappAccountExample.name,
    daily_schedule: [
      {
        hour: 20,
        minute: 15,
        snapshots_to_keep: 2,
      },
    ],
    enabled: true,
    hourly_schedule: [
      {
        minute: 15,
        snapshots_to_keep: 4,
      },
    ],
    location: azurermResourceGroupExample.location,
    monthly_schedule: [
      {
        days_of_month: [1, 15, 20, 30],
        hour: 5,
        minute: 45,
        snapshots_to_keep: 1,
      },
    ],
    name: "snapshotpolicy-01",
    resource_group_name: azurermResourceGroupExample.name,
    weekly_schedule: [
      {
        days_of_week: ["Monday", "Friday"],
        hour: 23,
        minute: 0,
        snapshots_to_keep: 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.*/
azurermNetappSnapshotPolicyExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

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

  • resourceGroupName - (Required) The name of the resource group where the NetApp Snapshot Policy should be created. Changing this forces a new resource to be created.

  • location - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

  • accountName - (Required) The name of the NetApp Account in which the NetApp Snapshot Policy should be created. Changing this forces a new resource to be created.

  • enabled - (Required) Defines that the NetApp Snapshot Policy is enabled or not.

  • hourlySchedule - (Optional) Sets an hourly snapshot schedule. See details in below hourlySchedule block.

  • dailySchedule - (Optional) Sets a daily snapshot schedule. See details in below dailySchedule block.

  • weeklySchedule - (Optional) Sets a weekly snapshot schedule. See details in below weeklySchedule block.

  • monthlySchedule - (Optional) Sets a monthly snapshot schedule. See details in below monthlySchedule block.

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


An hourlySchedule block supports the following:

  • snapshotsToKeep - (Required) How many hourly snapshots to keep, valid range is from 0 to 255.

  • minute - (Required) Minute of the hour that the snapshots will be created, valid range is from 0 to 59.


A dailySchedule block supports the following:

  • snapshotsToKeep - (Required) How many hourly snapshots to keep, valid range is from 0 to 255.

  • hour - (Required) Hour of the day that the snapshots will be created, valid range is from 0 to 23.

  • minute - (Required) Minute of the hour that the snapshots will be created, valid range is from 0 to 59.


A weeklySchedule block supports the following:

  • snapshotsToKeep - (Required) How many hourly snapshots to keep, valid range is from 0 to 255.

  • daysOfWeek - (Required) List of the week days using English names when the snapshots will be created.

  • hour - (Required) Hour of the day that the snapshots will be created, valid range is from 0 to 23.

  • minute - (Required) Minute of the hour that the snapshots will be created, valid range is from 0 to 59.


A monthlySchedule block supports the following:

  • snapshotsToKeep - (Required) How many hourly snapshots to keep, valid range is from 0 to 255.

  • daysOfMonth - (Required) List of the days of the month when the snapshots will be created, valid range is from 1 to 30.

  • hour - (Required) Hour of the day that the snapshots will be created, valid range is from 0 to 23.

  • minute - (Required) Minute of the hour that the snapshots will be created, valid range is from 0 to 59.


Attributes Reference

The following attributes are exported:

  • id - The ID of the NetApp Snapshot.

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

  • resourceGroupName - (Required) The name of the resource group where the NetApp Snapshot Policy should be created.

  • location - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

  • accountName - (Required) The name of the NetApp Account in which the NetApp Snapshot Policy was created. Changing this forces a new resource to be created.

  • enabled - (Required) Defines that the NetApp Snapshot Policy is enabled or not.

  • hourlySchedule - (Optional) Hourly snapshot schedule.

  • dailySchedule - (Optional) Daily snapshot schedule.

  • weeklySchedule - (Optional) Weekly snapshot schedule.

  • monthlySchedule - (Optional) Monthly snapshot schedule.

Timeouts

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

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

Import

NetApp Snapshot Policy can be imported using the resourceId, e.g.

terraform import azurerm_netapp_snapshot_policy.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.NetApp/netAppAccounts/account1/snapshotPolicies/snapshotpolicy1