Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New resouce/feature. Link a azurerm schedule with a runbook #1955

Closed
jcmaasb opened this issue Sep 20, 2018 · 13 comments · Fixed by #3386
Closed

New resouce/feature. Link a azurerm schedule with a runbook #1955

jcmaasb opened this issue Sep 20, 2018 · 13 comments · Fixed by #3386
Labels
new-resource service/automation upstream/microsoft Indicates that there's an upstream issue blocking this issue/PR
Milestone

Comments

@jcmaasb
Copy link

jcmaasb commented Sep 20, 2018

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Hi team,
This request comes from the following thread #1711

From powershell it is possible to link runbooks with a schedule created in an automation account, as suggested @holmesb.
With terraform I can not find any resource that can do it.

To be able to close the minimum cycle of possibilities that an automation account allows, I think it is necessary to have this resource available,

  • Create automation account
  • Create runbooks
  • Create schedule
  • Create link between runbook and schedule
  • To future, others features
@jcmaasb

This comment has been minimized.

@ernstae

This comment has been minimized.

@tom-dudley
Copy link
Contributor

tom-dudley commented Feb 17, 2019

I've had a go at fleshing out the required resource.

New or Affected Resource(s)

  • azurerm_automation_job_schedule

Potential Terraform Configuration

resource "azurerm_automation_job_schedule" "example" {
    name = "${azurerm_automation_schedule.my_schedule.name}"
    runbook = "${azurerm_automation_runbook.my_runbook.name}"
    parameters {
        foo = "bar"
        baz = "thing"      
    }
}
  • parameters is optional and could potentially be called runbook_parameters
  • jobScheduleId could be an attribute of the resource.

@brunoscota
Copy link

brunoscota commented May 1, 2019

Subscribed to get to know when will be available. Very useful feature.

@draggeta
Copy link
Contributor

draggeta commented May 6, 2019

Opened a PR to add this resource as I'm needing this (and a few other automation resources) myself.

@odee30

This comment has been minimized.

@Matasiete

This comment has been minimized.

@katbyte
Copy link
Collaborator

katbyte commented May 23, 2019

@odee30 @ @Matasiete this is currently blocked on an upstream issue with the API

@katbyte katbyte added this to the Blocked milestone May 23, 2019
@katbyte katbyte added the upstream/microsoft Indicates that there's an upstream issue blocking this issue/PR label May 23, 2019
@odee30
Copy link

odee30 commented May 27, 2019

That's a shame. Thanks for checking it out @katbyte

@pranavdesai1900
Copy link

As a workaround, I have used "azurerm_template_deployment" resource to implement this functionality, here is a code that works completely fine for me:

resource "random_uuid" "test" { }

resource "azurerm_template_deployment" "template_deployment" {
  name                = "DeploymentTemplateName"
  resource_group_name = "${data.azurerm_resource_group.example.name}"
  deployment_mode     = "Incremental"
  template_body = <<DEPLOY
{
  "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "resources": [
    {
      "type": "Microsoft.Automation/automationAccounts/jobSchedules",
      "apiVersion": "2015-10-31",
      "name": "${azurerm_automation_account.example.name}/${random_uuid.test.result}",      
      "properties": {
          "runbook": {
              "name": "${azurerm_automation_runbook.example.name}"
          },
          "schedule": {
              "name": "${azurerm_automation_schedule.hour.name}"
          }
      }
    }
  ]
}
DEPLOY
}

Do let me know if this helps!
Cheers!

@kajahno
Copy link

kajahno commented Aug 7, 2019

In addition to what @pranavdesai1900 has posted, if it happens that you get an error like this one:

    <title>404 - File or directory not found.</title> <style type="text/css">  </style>   

Server Error

404 - File or directory not found.

The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.

Is probably because you want to use a fancy name for the resource. This Azure API really likes this form (with the uuid):

"name": "${azurerm_automation_account.example.name}/${random_uuid.test.result}",

@katbyte katbyte modified the milestones: Blocked, v1.36.0 Oct 28, 2019
@ghost
Copy link

ghost commented Oct 29, 2019

This has been released in version 1.36.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 1.36.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Nov 27, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Nov 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-resource service/automation upstream/microsoft Indicates that there's an upstream issue blocking this issue/PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.