Azure Ubuntu VM custom_data issue - Terraform

Hello Experts,

We are trying to create Azure ubuntu VM through Tf. One of the issue we encountered the custom_data we pass as part of the build doesnt get executed. There is nothing gets logged in cloud-init. no file gets loaded in /var/lib/cloud/instance/scripts folder.

has anyone faced similar issues?

Hi @thahif.86

The first two things that come to mind are:

  1. Ensure you are using an image that has cloud-init support and are ‘cloud init ready’: Overview of cloud-init support for Linux VMs in Azure - Azure Virtual Machines | Microsoft Learn
  2. Ensure that the data you are passing in via the custom-data attribute is base-64 encoded.

Are you able to provide a minimal reproducible example so we can see what resources you are using and what attributes you are setting with what values? This would help people to reproduce your issue and help troubleshoot.