Skip to content

azurermAutomationWebhook

Manages an Automation Runbook's Webhook.

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 azurermAutomationAccountExample =
  new azurerm.automationAccount.AutomationAccount(this, "example_1", {
    location: azurermResourceGroupExample.location,
    name: "account1",
    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 azurermAutomationRunbookExample =
  new azurerm.automationRunbook.AutomationRunbook(this, "example_2", {
    automation_account_name: azurermAutomationAccountExample.name,
    description: "This is an example runbook",
    location: azurermResourceGroupExample.location,
    log_progress: "true",
    log_verbose: "true",
    name: "Get-AzureVMTutorial",
    publish_content_link: [
      {
        uri: "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/c4935ffb69246a6058eb24f54640f53f69d3ac9f/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1",
      },
    ],
    resource_group_name: azurermResourceGroupExample.name,
    runbook_type: "PowerShellWorkflow",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermAutomationRunbookExample.overrideLogicalId("example");
const azurermAutomationWebhookExample =
  new azurerm.automationWebhook.AutomationWebhook(this, "example_3", {
    automation_account_name: azurermAutomationAccountExample.name,
    enabled: true,
    expiry_time: "2021-12-31T00:00:00Z",
    name: "TestRunbook_webhook",
    parameters: [
      {
        input: "parameter",
      },
    ],
    resource_group_name: azurermResourceGroupExample.name,
    runbook_name: azurermAutomationRunbookExample.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.*/
azurermAutomationWebhookExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

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

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

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

  • expiryTime - (Required) Timestamp when the webhook expires. Changing this forces a new resource to be created.

  • enabled - (Optional) Controls if Webhook is enabled. Defaults to true.

  • runbookName - (Required) Name of the Automation Runbook to execute by Webhook.

  • runOnWorkerGroup - (Optional) Name of the hybrid worker group the Webhook job will run on.

  • parameters - (Optional) Map of input parameters passed to runbook.

  • uri - (Optional) URI to initiate the webhook. Can be generated using Generate URI API. By default, new URI is generated on each new resource creation. Changing this forces a new resource to be created.

Attributes Reference

The following attributes are exported:

  • id - The Automation Webhook ID.

  • uri - (Optional) (Sensitive) Generated URI for this Webhook. Changing this forces a new resource to be created.

Timeouts

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

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

Import

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

terraform import azurerm_automation_webhook.TestRunbook_webhook /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Automation/automationAccounts/account1/webHooks/TestRunbook_webhook