title: Google GKE startup script not workin for GKE Node
body: <p>I am adding a startup script to my GKE nodes using terraform</p>
  <pre><code>provider &quot;google&quot; {
    project = var.project
    region  = var.region
    zone    = var.zone
    credentials = &quot;google-key.json&quot;
  }
  
  
  terraform {
    backend &quot;gcs&quot; {
      bucket = &quot;tf-state-bucket-devenv&quot;
      prefix = &quot;terraform&quot;
      credentials = &quot;google-key.json&quot;
     }
  }
  
  resource &quot;google_container_cluster&quot; &quot;primary&quot; {
    name     = var.kube-clustername
    location = var.zone
    remove_default_node_pool = true
    initial_node_count       = 1
  
    master_auth {
      username = &quot;&quot;
      password = &quot;&quot;
  
      client_certificate_config {
        issue_client_certificate = false
      }
    }
  }
  
  resource &quot;google_container_node_pool&quot; &quot;primary_preemptible_nodes&quot; {
    name       = var.kube-poolname
    location   = var.zone
    cluster    = google_container_cluster.primary.name
    node_count = var.kube-nodecount
  
    node_config {
      preemptible  = var.kube-preemptible
      machine_type = &quot;n1-standard-1&quot;
      disk_size_gb = 10
      disk_type = &quot;pd-standard&quot;
  
  
      metadata = {
        disable-legacy-endpoints = &quot;true&quot;,
        startup_script = &quot;cd /mnt/stateful_partition/home &amp;&amp; echo hi &gt; test.txt&quot;
      }
  
      oauth_scopes = [
        &quot;https://www.googleapis.com/auth/logging.write&quot;,
        &quot;https://www.googleapis.com/auth/monitoring&quot;,
      ]
    }
  }
  </code></pre>
  <p>When i go into the GCP interface, select the node and view the metadata I can see the key/value is there</p>
  <pre><code>metadata_startup_script 
  #!/bin/bash sudo su &amp;&amp; cd /mnt/stateful_partition/home &amp;&amp; echo hi &gt; test.txt
  </code></pre>
  <p>However when running the below command on the node -</p>
  <p>sudo google_metadata_script_runner --script-type startup -
  -debug</p>
  <p>I got the below -</p>
  <pre><code>startup-script: INFO Starting startup scripts.
  startup-script: INFO No startup scripts found in metadata.
  startup-script: INFO Finished running startup scripts.
  </code></pre>
  <p>Does anyone know why this script is not working/showing up? - Is it because its a GKE node and google dont let you edit these, I cant actually find anything on their documentation where they specifically say that.</p>