#===============================================================================
#
#【スタックでセキュリティグループを作成するサンプル】
#
# ○スタック作成パターン
# SG_test_A:テンプレート上に ルール設定無し
# SG_test_B:テンプレート上に egress のルールを1つ設定
# SG_test_C:テンプレート上に ingress のルールを1つ設定
# SG_test_D:テンプレート上に egress のルールを1つ設定(SG_test_Bと同じ)
#
# ○留意事項
# スタックで上記4つのセキュリティグループを作成した後、
# スタックを更新する
#
#===============================================================================
heat_template_version: 2013-05-23
description: Security Group Create
resources:
SG_test_A:
type: OS::Neutron::SecurityGroup
properties:
name: SG_test_A
rules:
# ■スタック作成後の SG_test_A の作成状況
#
# ルールがまったく無い場合、以下のようにデフォルトの egressルールが作成される
#
# 上記のルール設定により、SG_test_A は、スタック作成完了時には以下のように作成される
# ┌─────┬───────┬──────┬─────┬──────┐
# │方向 │Ethernetタイプ│IPプロトコル│ポート範囲│接続先 │
# ├─────┼───────┼──────┼─────┼──────┤
# │egress │IPv6 │(空) │- │(空) │
# │egress │IPv4 │(空) │- │(空) │
# └─────┴───────┴──────┴─────┴──────┘
SG_test_B:
type: OS::Neutron::SecurityGroup
properties:
name: SG_test_B
rules:
- {direction: egress, ethertype: IPv4, port_range_min: 22, port_range_max: 22, protocol: tcp, remote_ip_prefix: 0.0.0.0/0 }
# ■スタック作成後の SG_test_B の作成状況
#
# egressのルールが1つでもあれば、デフォルトの egressルールは作成されない
#
# 上記のルール設定により、SG_test_B は、スタック作成完了時には以下のように作成される
# ┌─────┬───────┬──────┬─────┬──────┐
# │方向 │Ethernetタイプ│IPプロトコル│ポート範囲│接続先 │
# ├─────┼───────┼──────┼─────┼──────┤
# │egress │IPv4 │tcp │22 │0.0.0.0/0 │
# └─────┴───────┴──────┴─────┴──────┘
SG_test_C:
type: OS::Neutron::SecurityGroup
properties:
name: SG_test_C
rules:
- {direction: ingress, ethertype: IPv4, port_range_min: 22, port_range_max: 22, protocol: tcp, remote_ip_prefix: 0.0.0.0/0 }
# ■スタック作成後の SG_test_C の作成状況
#
# egressが1つもない場合も、デフォルトの egressルールが作成される
#
# 上記のルール設定により、SG_test_C は、スタック作成完了時には以下のように作成される
# ┌─────┬───────┬──────┬─────┬──────┐
# │方向 │Ethernetタイプ│IPプロトコル│ポート範囲│接続先 │
# ├─────┼───────┼──────┼─────┼──────┤
# │egress │IPv6 │(空) │- │(空) │
# │egress │IPv4 │(空) │- │(空) │
# │ingress │IPv4 │tcp │22 │0.0.0.0/0 │
# └─────┴───────┴──────┴─────┴──────┘
SG_test_D:
type: OS::Neutron::SecurityGroup
properties:
name: SG_test_D
rules:
- {direction: egress, ethertype: IPv4, port_range_min: 22, port_range_max: 22, protocol: tcp, remote_ip_prefix: 0.0.0.0/0 }
# ■スタック作成後の SG_test_D の作成状況
#
# egressのルールが1つでもあれば、デフォルトの egressルールは作成されない
#
# 上記のルール設定により、SG_test_D は、スタック作成完了時には以下のように作成される
# ┌─────┬───────┬──────┬─────┬──────┐
# │方向 │Ethernetタイプ│IPプロトコル│ポート範囲│接続先 │
# ├─────┼───────┼──────┼─────┼──────┤
# │egress │IPv4 │tcp │22 │0.0.0.0/0 │
# └─────┴───────┴──────┴─────┴──────┘