I am trying to set up an Instance using an Instance Template in the GCP Deployment Manager. It works fine but upon adding startup-script in metadata, it doesn't.
This is the code (and script) I am trying to run:
gcloud compute instances create my-instance --source-instance-template my-it --zone=northamerica-northeast1-a --network=my-network --subnet=my-subnet --no-address --metadata=startup-script='sudo /opt/scripts/startup.sh #! /bin/bash sudo htpasswd -c -B -b /etc/nginx/.htpasswd test test'
Here, the following part comes from the instance template itself and I am trying to add in the latter.
sudo /opt/scripts/startup.sh
Any help appreciated, thanks!