#!/bin/bash

VM_COUNT=3
IMAGE_FLAVOR=m1.small
PUBLIC_NET_ID=$(openstack network show public1 | awk '/ id /{print $4}')
DEMO_NET_ID=$(openstack network show demo-net | awk '/ id /{print $4}')
DEMO_SUBNET_ID=$(openstack subnet show demo-subnet | awk '/ id /{print $4}')

echo "Public net id is $PUBLIC_NET_ID"
echo "Demo net id is $DEMO_NET_ID"
echo "Demo subnet id is $DEMO_SUBNET_ID"

openstack stack create --parameter vm_count=$VM_COUNT \
                       --parameter image_flavor=$IMAGE_FLAVOR \
                       --parameter public_net_id=$PUBLIC_NET_ID \
                       --parameter demo_net_id=$DEMO_NET_ID \
                       --parameter demo_subnet_id=$DEMO_SUBNET_ID \
                       -t steak-rg.yaml steak