Executing Terraform script from Azure Automation

Hi All,

I have created the resource group and storage account in azure portal using terraform and azure devops. I am also storing the terraform.state in a separate storage account.

I have a requirement to delete the resources created based on the scheduled date and i am using azure automation runbook to delete the resource group created. Instead i want to call the terraform destroy command to destory the resources created.

I would like to know

  1. is there any way i can run the terraform script automatically based on the schedule date and time?
  2. Can i use the azure automation runbook to trigger the terraform script to destroy the resources created?
  3. Is there any option to run the terraform scripts from PowerShell so that i can use Runbook to execute the terraform so intern the terraform script/commands would be executed.

I have come across the terraform import but would like to know how i can execute the terraform import automatically based on the schedule date & time?

Thanks & Regards,
Sreenivas Kaushik

I suppose no terraform in Automation accounts by default. probably nothing stops you to do a wget and download it to some temp sandbox folder, create tf files, get authentication from variables.