Open Lucero7919 opened 1 year ago
Mhh weird, it works :
azurerm_automation_module.automation_account_module_resourcegraph: Still creating... [2m30s elapsed]
azurerm_automation_module.automation_account_module_connectedmachine: Still creating... [2m30s elapsed]
azurerm_automation_module.automation_account_module_resourcegraph: Creation complete after 2m36s [id=/subscriptions/---/resourceGroups/baseInfra-UpdateManagement-rg2/providers/Microsoft.Automation/automationAccounts/automationAccount-01/modules/Az.ResourceGraph]
azurerm_automation_module.automation_account_module_connectedmachine: Creation complete after 2m36s [id=/subscriptions/---/resourceGroups/baseInfra-UpdateManagement-rg2/providers/Microsoft.Automation/automationAccounts/automationAccount-01/modules/Az.ConnectedMachine]
Apply complete! Resources: 15 added, 0 changed, 0 destroyed.
Can you share the issue you had ?
So, I actually had the same issue with the Az.Accounts part too. In the automation account, Az.Accounts module was version 2.6.0 and runtime 5.1. When I saw that Az.ResourceGraph was failing, I checked manually, and Az.ResourceGraph wouldn't allow me to select "import" because of this message.
"This module has dependencies that are not present in this account. All dependencies must be present before this module can be imported. Dependencies: Az.Accounts (≥ 2.9.1)"
I then added Az.Accounts with runtime 7.1 and a later version of Az.Accounts and that allowed me to manually import Az.ResourceGraph RT 7.1. However, when running the runbooks, it failed with "import-module Az.ResourceGraph" no such module found.
I also noticed that in the marketplace modules, the links to the PoSH gallery for both modules is different. Although the ones listed in your resources do work.
In any case, this was the error for Az.ResourceGraph in the TF output
azurerm_automation_module.automation_account_module_resourcegraph: Still creating... [1m40s elapsed]
azurerm_automation_module.automation_account_module_resourcegraph: Still creating... [1m50s elapsed]
╷
│ Error: waiting for Module: (Name "Az.ResourceGraph" / Automation Account Name "automationAccount-01" / Resource Group "RG") to finish provisioning: Orchestrator.Shared.AsyncModuleImport.ModuleImportException: Failure processing module import runbook while getting module content. Error: End of Central Directory record could not be found..
│ at Orchestrator.Activities.GetModuleContentActivity.ExecuteInternal(CodeActivityContext context, String contentUri, String contentHashAlgorithm, String contentHashValue, String contentVersion, String moduleName, ModuleLanguage moduleLanguage)
│ at Orchestrator.Activities.GetModuleContentActivity.Execute(CodeActivityContext context)
│ at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
│ at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Lastly, when trying to run the Az.Accounts resource block, that threw an error stating the module was already present and needed to be imported to state.
Error: A resource with the ID "/subscriptions/xxxxx-xxxxx-xxxxx/resourceGroups/RG/providers/Microsoft.Automation/automationAccounts/automationAccount-01/modules/Az.Accounts" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for "azurerm_automation_module" for more information.
In Terraform build, Az.ResourceGraph Module URI (URL) is incorrect.
Listed as:
uri = "https://www.powershellgallery.com/api/v2/package/az.resourcegraph/0.13.0"
Should be:
uri = "https://www.powershellgallery.com/packages/Az.ResourceGraph/0.13.0"