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

azurerm_automation_runbook doesn't create python runbook. #1602

Closed
mmclane opened this issue Jul 18, 2018 · 17 comments
Closed

azurerm_automation_runbook doesn't create python runbook. #1602

mmclane opened this issue Jul 18, 2018 · 17 comments
Labels
enhancement service/automation upstream/microsoft Indicates that there's an upstream issue blocking this issue/PR

Comments

@mmclane
Copy link

mmclane commented Jul 18, 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

Terraform Version

Terraform v0.11.7

  • provider.azurerm v1.8.0
  • provider.template v1.0.0

Affected Resource(s)

  • azurerm_automation_runbook

Terraform Configuration Files

resource "azurerm_automation_runbook" "runbook" {
  name                = "test-kitchen-cleanup"
  location            = "${azurerm_resource_group.autorg.location}"
  resource_group_name = "${azurerm_resource_group.autorg.name}"
  account_name        = "${azurerm_automation_account.account.name}"
  log_verbose         = "true"
  log_progress        = "true"
  description         = "Hello World script, just to get things created"
  runbook_type        = "Script"

  publish_content_link {
    uri = "${azurerm_storage_blob.script.url}"
  }
}

Expected Behavior

  • Creates a runbook in the specified automation account
  • The runbook created is of type Python 2 Runbook

Actual Behavior

  • Creates the runbook and reports success.
  • The resulting runbook is actually a PowerShell Workflow Runbook.
  • TF state file show the following:
azurerm_automation_runbook.runbook:
  id = /subscriptions/8efe2bb2-0b97-4186-8c1e-c75e6c772a98/resourceGroups/test-kitchen-cleanup-preprod/providers/Microsoft.Automation/automationAccounts/test-kitchen-cleanup-preprod/runbooks/test-kitchen-cleanup
  account_name = test-kitchen-cleanup-preprod
  description = Hello World script, just to get things created
  location = eastus2
  log_progress = true
  log_verbose = true
  name = test-kitchen-cleanup
  publish_content_link.# = 1
  publish_content_link.0.hash.# = 0
  publish_content_link.0.uri = https://crtoutilityusepreprod.blob.core.windows.net/scripts/test-kitchen-cleanup.ps1
  publish_content_link.0.version =
  resource_group_name = test-kitchen-cleanup-preprod
  runbook_type = Script
  tags.% = 0

Important Factoids

The documentation is vague on if TF supports creating python based runbooks. It says the following:
runbook_type - (Required) The type of the runbook - can be either Graph, GraphPowerShell, GraphPowerShellWorkflow, PowerShellWorkflow, PowerShell or Script.

I would assume that Script is a python runbook since the valid types of runbooks are:

  • Powershell
  • Python 2 (preview)
  • Graphical
  • PowerShell Workflow
  • Graphical PowerShell Workflow
@mmclane
Copy link
Author

mmclane commented Jul 18, 2018

I just noticed that it shows the content link being a ps1 file. I can confirm that it doesn't matter if its a py file, it still doesn't set the runbook type correctly.

@tombuildsstuff
Copy link
Contributor

tombuildsstuff commented Jul 18, 2018

Upstream issue: Azure/azure-sdk-for-go#2256

@hdost
Copy link

hdost commented Jul 19, 2018

For reference, sounds like the problem might start with Azure/azure-rest-api-specs#3457

@mmclane
Copy link
Author

mmclane commented Jul 20, 2018

If this is going to be an enhancement that relies on upstream work, I suggest that you clarify in the documentation what the script type is and that python runbooks are not yet supported.

@claudiouzelac
Copy link

Bump on this issue. I'd love to use this feature. If it isn't coming (last update was 7/20/2018), can you update the documentation please?

@ffais
Copy link

ffais commented Jul 14, 2020

Any news ?

@JukkaUusisalo
Copy link

Anything?

@michaelmcmillan
Copy link

Does anyone have an idea of where it breaks down? We want to use Python for our Runbooks, but it doesn't seem like it's possible atm.

@jcbagtas
Copy link

I can't believe I hit a terraform limit that is 2 years old. lol
Is there any news about this?

@ghost
Copy link

ghost commented Jan 22, 2021

It has been 2 years and Azure is just not doing its job!

@JamesStanley
Copy link

JamesStanley commented Mar 5, 2021

I have just hit this problem too.

If you use the API directly (even the 2015 version) specifying the runbook type as "Python3" works..........image

(Anyone testing will need to update the URI to something valid for it to succeed.)

However even the latest version of the API specs still dont list Python as an option...https://github.com/Azure/azure-rest-api-specs/blob/782bab9c34014092f48de95874a71e7ecd1a9bba/specification/automation/resource-manager/Microsoft.Automation/stable/2019-06-01/runbook.json#L1154

@favoretti favoretti added the upstream/microsoft Indicates that there's an upstream issue blocking this issue/PR label Aug 18, 2021
@lumy
Copy link

lumy commented Sep 1, 2021

Any news on this ? from what i understood it is possible if you hit directly the api, will terraform manage this sooner or later ?

@corticalstack
Copy link

Any update on AzureRM provider support for Python runbooks? Thanks

@chnusti
Copy link

chnusti commented Feb 17, 2022

I reached out Microsoft support regarding this issue and tried to explain the discrepancy between implementation and documentation.
the engineer was pretty much sure the api supports type python3 even though not written in the docs.
moreover I also provide him this github issue regarding this problem.

They will get back to me soon.

@DuneganS
Copy link

Hello,

Is there any type of update on this issue from any source? It still seems to be an issue with azurerm 3.19.1

I've zipped and attached the basic testing that I did. Running

terraform init
terraform validate

Gives this result

PS E:\NetShare\_coding\terraform\azure> terraform.exe init

Initializing the backend...

Initializing provider plugins...
- Finding latest version of hashicorp/local...
- Finding hashicorp/azurerm versions matching "~> 3.19.1"...
- Installing hashicorp/local v2.2.3...
- Installed hashicorp/local v2.2.3 (signed by HashiCorp)
- Installing hashicorp/azurerm v3.19.1...
- Installed hashicorp/azurerm v3.19.1 (signed by HashiCorp)

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
PS E:\NetShare\_coding\terraform\azure> terraform.exe validate
╷
│ Error: expected runbook_type to be one of [Graph GraphPowerShell GraphPowerShellWorkflow PowerShell PowerShellWorkflow Script], got Python3
│ 
│   with azurerm_automation_runbook.azure_automation_runbook_001,
│   on main.tf line 37, in resource "azurerm_automation_runbook" "azure_automation_runbook_001":
│   37:   runbook_type            = "Python3"

gh-1602.zip

@catriona-m
Copy link
Member

It looks like this has now been resolved by #18921 so this can be closed now. Thanks!

@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement service/automation upstream/microsoft Indicates that there's an upstream issue blocking this issue/PR
Projects
None yet
Development

No branches or pull requests