Query Metadata from Openstack
Closed this issue · 1 comments
Hi,
I am writing the metadata info while launching instances using terraform on Openstack. For Ex, if i launch 3 instances, master_count will be 3. But I am not sure how can i get this info from Openstack.
metadata {
master_count = "${count.index+1}"
myid = "${count.index+1}"
cluster_name= "jenkins_mesos_master"
}
How can I query the metadata similar to the below method used in google?
echo "getting metadata"
MASTERCOUNT=curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/mastercount"
CLUSTERNAME=curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/clustername"
MYID=curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/myid"
until terraform supports math functions, we need to do this here
((MYID+=1))
Thanks,
Govind
I'm not really familiar with OpenStack but you might be able to find an answer here: https://wiki.openstack.org/wiki/MetadataSearchAPI