Skip to content

azurermAutomationSchedule

Manages a Automation Schedule.

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: "tfex-automation-account",
  }
);
const azurermAutomationAccountExample =
  new azurerm.automationAccount.AutomationAccount(this, "example_1", {
    location: azurermResourceGroupExample.location,
    name: "tfex-automation-account",
    resource_group_name: azurermResourceGroupExample.name,
    sku_name: "Basic",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermAutomationAccountExample.overrideLogicalId("example");
const azurermAutomationScheduleExample =
  new azurerm.automationSchedule.AutomationSchedule(this, "example_2", {
    automation_account_name: azurermAutomationAccountExample.name,
    description: "This is an example schedule",
    frequency: "Week",
    interval: 1,
    name: "tfex-automation-schedule",
    resource_group_name: azurermResourceGroupExample.name,
    start_time: "2014-04-15T18:00:15+02:00",
    timezone: "Australia/Perth",
    week_days: ["Friday"],
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermAutomationScheduleExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the Schedule. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the resource group in which the Schedule is created. Changing this forces a new resource to be created.

  • automationAccountName - (Required) The name of the automation account in which the Schedule is created. Changing this forces a new resource to be created.

  • frequency - (Required) The frequency of the schedule. - can be either oneTime, day, hour, week, or month.

  • description - (Optional) A description for this Schedule.

  • interval - (Optional) The number of frequencys between runs. Only valid when frequency is day, hour, week, or month and defaults to 1.

  • startTime - (Optional) Start time of the schedule. Must be at least five minutes in the future. Defaults to seven minutes in the future from the time the resource is created.

  • expiryTime - (Optional) The end time of the schedule.

  • timezone - (Optional) The timezone of the start time. Defaults to utc. For possible values see: https://docs.microsoft.com/en-us/rest/api/maps/timezone/gettimezoneenumwindows

  • weekDays - (Optional) List of days of the week that the job should execute on. Only valid when frequency is week. Possible values are monday, tuesday, wednesday, thursday, friday, saturday and sunday.

  • monthDays - (Optional) List of days of the month that the job should execute on. Must be between 1 and 31. 1 for last day of the month. Only valid when frequency is month.

  • monthlyOccurrence - (Optional) List of monthlyOccurrence blocks as defined below to specifies occurrences of days within a month. Only valid when frequency is month. The monthlyOccurrence block supports fields documented below.


The monthlyOccurrence block supports:

  • day - (Required) Day of the occurrence. Must be one of monday, tuesday, wednesday, thursday, friday, saturday, sunday.

  • occurrence - (Required) Occurrence of the week within the month. Must be between 1 and 5. 1 for last week within the month.

Attributes Reference

The following attributes are exported:

  • id - The Automation Schedule ID.

Timeouts

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

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

Import

Automation Schedule can be imported using the resourceId, e.g.

terraform import azurerm_automation_schedule.schedule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Automation/automationAccounts/account1/schedules/schedule1