Skip to content

azurermAutomationSourceControl

Manages an Automation Source Control.

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.*/
new azurerm.automationSourceControl.AutomationSourceControl(this, "example", {
  automation_account_id: "${azurerm_automation_account.test.id}",
  branch: "main",
  folder_path: "runbook",
  name: "example",
  repository_url: "https://github.com/foo/bat.git",
  security: [
    {
      token: "ghp_xxx",
      token_type: "PersonalAccessToken",
    },
  ],
  source_control_type: "GitHub",
});

Arguments Reference

The following arguments are supported:

  • name - (Required) The name which should be used for this Automation Source Control. Changing this forces a new Automation Source Control to be created.

  • automationAccountId - (Required) The ID of Automation Account to manage this Source Control. Changing this forces a new Automation Source Control to be created.

  • folderPath - (Required) The folder path of the source control. This Path must be relative.

  • repositoryUrl - (Required) The Repository URL of the source control.

  • security - (Required) A security block as defined below.

  • sourceControlType - (Required) The source type of Source Control, possible vaules are vsoGit, vsoTfvc and gitHub, and the value is case sensitive.


  • automaticSync - (Optional) Whether auto async the Source Control.

  • branch - (Optional) Specify the repo branch of the Source Control. Empty value is valid only for vsoTfvc.

  • description - (Optional) A short description of the Source Control.

  • publishRunbookEnabled - (Optional) Whether auto publish the Source Control. Defaults to true.


A security block supports the following:

  • token - (Required) The access token of specified repo.

  • tokenType - (Required) Specify the token type, possible values are personalAccessToken and oauth.

  • refreshToken - (Optional) The refresh token of specified rpeo.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Automation Source Control.

Timeouts

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

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

Import

Automations can be imported using the resourceId, e.g.

terraform import azurerm_automation_source_control.example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Automation/automationAccounts/account1/sourceControls/sc1