Metadata_startup_script not running when TF is launch from azure pipeline

I have a Terraform code that is running perfectly fine on my local computer, the issue happens ONLY when I run it from an Azure Pipeline.

My TF code creates several GCP VM Instances using google_compute_instance, each instace use the metadata and metadata_startup_script to upload the public key and run an initial script respectively, but for some unknown reason ONLY the metadata_startup_script is NOT running when TF is launch from an Azure Pipine, everything else runs fine.

The TF Plan recognizes the initial-script content and mention it will be apply, but at the end is being skip during the TF Apply phase.
I have tried to using it on different ways (as int he code below) but none of the options is executed.

    data "template_file" "admin" {
      template = file("initial-setup.sh")
      vars = {
        password = "${random_password.admin_password.result}"
        prefix = "${var.prefix}"
      }
    }

Call inside google_compute_instance --->
    metadata_startup_script = "${data.template_file.admin.rendered}"
    metadata_startup_script = file("C:/Program Files/Terraform/initial-setup.sh")
    metadata_startup_script = "useradd -m -s /bin/bash 'admin';echo 'admin:password@54w21@123@@' | chpasswd"

None of the options above run when TF is launch from an Azure Pipeline, only from local computer. It is possible to force this? or could be an issue with the agent pool missing something ?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.