Issue creating linux VM using Kali Linux custom image

Trying to create a Kali Linux VM from Terraform. I started by importing the VM resource from another account, and when trying to deploy it to a new subscription, I receive the following error:

After trying to find a solution online, I noticed another issue that seemed relevant, however I couldn’t understand why I would have to import the Kali-linux provider from the marketplace into my machine.

Here is the relevant code section that includes my deployment of the machine, along with the azurerm_marketplace_agreement I attempted to import.

Any help on what I’m doing wrong would be greatly appreciated! Thanks.

Hi @sean-custer,
first of all I’d use the later resource azurerm_linux_virtual_machine (https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/linux_virtual_machine), if provider version allows.

Within this check the plan section.
This looks comparable: vh-wowza/vm_base.tf at cf5d4899486f9aed2c52bd52399653006794276d · hmcts/vh-wowza · GitHub

Hi @tbugfinder, thanks for reaching out.

I gave those a shot, and heres the output I got:

Here are the changes I made to the code:

I’m thinking that the values I chose for the kali linux publisher and name are wrong, although I couldn’t find any documentation.

Try this:

You should be able to query the details with az cli. You might also have to accept the terms within the console.

Thanks for replying. After some troubleshooting, I was able to make some progress.
I ran the following commands to accept the image terms from the Marketplace:
#Imports the module to use next command
Import-Module AzureRM.MarketplaceOrdering

Connect-AzureRmAccount

#Accepts the kali-linux offer
Get-AzureRmMarketplaceTerms -Publisher “kali-linux” -Product “kali-linux” -Name “kali-linux” | Set-AzureRmMarketplaceTerms -Accept

However, I ran into this issue afterwards, telling me that I don’t need the ‘plan’ parameter included in my VM resource: