Sha256: 7f3e8af328de752ad2a19ca57d308ad6f0b64bd914337d8e1a027917640b4ee8

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 KB

Contents

#!/usr/bin/env bash

org="<%= cloud_gov_organization %>"

usage="
$0: Set egress rules for given space

Usage:
  $0 -h
  $0 -s <SPACE NAME> [-o <ORG NAME>] [-p] [-t]

Options:
-h: show help and exit
-s <SPACE NAME>: configure the space to act on. Required
-o <ORG NAME>: configure the organization to act on. Default: $org
-p: Add the public egress rules
-t: Add the trusted egress rules

Notes:
* If -p or -t are not passed, the related security groups will be removed, if they were present
"

set -e

space=""
public=false
trusted=false

while getopts ":hs:o:pt" opt; do
  case "$opt" in
    s)
      space=${OPTARG}
      ;;
    o)
      org=${OPTARG}
      ;;
    p)
      public=true
      ;;
    t)
      trusted=true
      ;;
    h)
      echo "$usage"
      exit 0
      ;;
  esac
done

if [[ $space = "" ]]; then
  echo "$usage"
  exit 1
fi

if [[ $public = true ]]; then
  cf bind-security-group public_networks_egress $org --space $space
else
  cf unbind-security-group public_networks_egress $org $space
fi

if [[ $trusted = true ]]; then
  cf bind-security-group trusted_local_networks_egress $org --space $space
else
  cf unbind-security-group trusted_local_networks_egress $org $space
fi

echo "Done"

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails_template_18f-0.8.0 lib/generators/rails_template18f/terraform/templates/terraform/set_space_egress.sh.tt
rails_template_18f-0.7.2 lib/generators/rails_template18f/terraform/templates/terraform/set_space_egress.sh.tt
rails_template_18f-0.7.1 lib/generators/rails_template18f/terraform/templates/terraform/set_space_egress.sh.tt
rails_template_18f-0.7.0 lib/generators/rails_template18f/terraform/templates/terraform/set_space_egress.sh.tt
rails_template_18f-0.6.0 lib/generators/rails_template18f/terraform/templates/terraform/set_space_egress.sh.tt
rails_template_18f-0.5.3 lib/generators/rails_template18f/terraform/templates/terraform/set_space_egress.sh.tt