This commit is contained in:
r_takaishi 2017-05-09 19:04:12 +09:00
parent 7ec662b243
commit 848176588c
1 changed files with 260 additions and 0 deletions

View File

@ -85,6 +85,115 @@ func TestAccNetworkingV2SecGroupRule_timeout(t *testing.T) {
})
}
func TestAccNetworkingV2SecGroupRule_vrrp(t *testing.T) {
var secgroup_1 groups.SecGroup
var secgroup_rule_ah rules.SecGroupRule
var secgroup_rule_dccp rules.SecGroupRule
var secgroup_rule_egp rules.SecGroupRule
var secgroup_rule_esp rules.SecGroupRule
var secgroup_rule_gre rules.SecGroupRule
var secgroup_rule_igmp rules.SecGroupRule
var secgroup_rule_ipv6_encap rules.SecGroupRule
var secgroup_rule_ipv6_frag rules.SecGroupRule
var secgroup_rule_ipv6_icmp rules.SecGroupRule
var secgroup_rule_ipv6_nonxt rules.SecGroupRule
var secgroup_rule_ipv6_opts rules.SecGroupRule
var secgroup_rule_ipv6_route rules.SecGroupRule
var secgroup_rule_ospf rules.SecGroupRule
var secgroup_rule_pgm rules.SecGroupRule
var secgroup_rule_rsvp rules.SecGroupRule
var secgroup_rule_sctp rules.SecGroupRule
var secgroup_rule_udplite rules.SecGroupRule
var secgroup_rule_vrrp rules.SecGroupRule
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckNetworkingV2SecGroupRuleDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccNetworkingV2SecGroupRule_vrrp,
Check: resource.ComposeTestCheckFunc(
testAccCheckNetworkingV2SecGroupExists(
"openstack_networking_secgroup_v2.secgroup_1", &secgroup_1),
testAccCheckNetworkingV2SecGroupRuleExists(
"openstack_networking_secgroup_rule_v2.secgroup_rule_ah", &secgroup_rule_ah),
testAccCheckNetworkingV2SecGroupRuleExists(
"openstack_networking_secgroup_rule_v2.secgroup_rule_dccp", &secgroup_rule_dccp),
testAccCheckNetworkingV2SecGroupRuleExists(
"openstack_networking_secgroup_rule_v2.secgroup_rule_egp", &secgroup_rule_egp),
testAccCheckNetworkingV2SecGroupRuleExists(
"openstack_networking_secgroup_rule_v2.secgroup_rule_esp", &secgroup_rule_esp),
testAccCheckNetworkingV2SecGroupRuleExists(
"openstack_networking_secgroup_rule_v2.secgroup_rule_gre", &secgroup_rule_gre),
testAccCheckNetworkingV2SecGroupRuleExists(
"openstack_networking_secgroup_rule_v2.secgroup_rule_igmp", &secgroup_rule_igmp),
testAccCheckNetworkingV2SecGroupRuleExists(
"openstack_networking_secgroup_rule_v2.secgroup_rule_ipv6_encap", &secgroup_rule_ipv6_encap),
testAccCheckNetworkingV2SecGroupRuleExists(
"openstack_networking_secgroup_rule_v2.secgroup_rule_ipv6_frag", &secgroup_rule_ipv6_frag),
testAccCheckNetworkingV2SecGroupRuleExists(
"openstack_networking_secgroup_rule_v2.secgroup_rule_ipv6_icmp", &secgroup_rule_ipv6_icmp),
testAccCheckNetworkingV2SecGroupRuleExists(
"openstack_networking_secgroup_rule_v2.secgroup_rule_ipv6_nonxt", &secgroup_rule_ipv6_nonxt),
testAccCheckNetworkingV2SecGroupRuleExists(
"openstack_networking_secgroup_rule_v2.secgroup_rule_ipv6_opts", &secgroup_rule_ipv6_opts),
testAccCheckNetworkingV2SecGroupRuleExists(
"openstack_networking_secgroup_rule_v2.secgroup_rule_ipv6_route", &secgroup_rule_ipv6_route),
testAccCheckNetworkingV2SecGroupRuleExists(
"openstack_networking_secgroup_rule_v2.secgroup_rule_ospf", &secgroup_rule_ospf),
testAccCheckNetworkingV2SecGroupRuleExists(
"openstack_networking_secgroup_rule_v2.secgroup_rule_pgm", &secgroup_rule_pgm),
testAccCheckNetworkingV2SecGroupRuleExists(
"openstack_networking_secgroup_rule_v2.secgroup_rule_rsvp", &secgroup_rule_rsvp),
testAccCheckNetworkingV2SecGroupRuleExists(
"openstack_networking_secgroup_rule_v2.secgroup_rule_sctp", &secgroup_rule_sctp),
testAccCheckNetworkingV2SecGroupRuleExists(
"openstack_networking_secgroup_rule_v2.secgroup_rule_udplite", &secgroup_rule_udplite),
testAccCheckNetworkingV2SecGroupRuleExists(
"openstack_networking_secgroup_rule_v2.secgroup_rule_vrrp", &secgroup_rule_vrrp),
resource.TestCheckResourceAttr(
"openstack_networking_secgroup_rule_v2.secgroup_rule_ah", "protocol", "ah"),
resource.TestCheckResourceAttr(
"openstack_networking_secgroup_rule_v2.secgroup_rule_dccp", "protocol", "dccp"),
resource.TestCheckResourceAttr(
"openstack_networking_secgroup_rule_v2.secgroup_rule_egp", "protocol", "egp"),
resource.TestCheckResourceAttr(
"openstack_networking_secgroup_rule_v2.secgroup_rule_esp", "protocol", "esp"),
resource.TestCheckResourceAttr(
"openstack_networking_secgroup_rule_v2.secgroup_rule_gre", "protocol", "gre"),
resource.TestCheckResourceAttr(
"openstack_networking_secgroup_rule_v2.secgroup_rule_igmp", "protocol", "igmp"),
resource.TestCheckResourceAttr(
"openstack_networking_secgroup_rule_v2.secgroup_rule_ipv6_encap", "protocol", "ipv6-encap"),
resource.TestCheckResourceAttr(
"openstack_networking_secgroup_rule_v2.secgroup_rule_ipv6_frag", "protocol", "ipv6-frag"),
resource.TestCheckResourceAttr(
"openstack_networking_secgroup_rule_v2.secgroup_rule_ipv6_icmp", "protocol", "ipv6-icmp"),
resource.TestCheckResourceAttr(
"openstack_networking_secgroup_rule_v2.secgroup_rule_ipv6_nonxt", "protocol", "ipv6-nonxt"),
resource.TestCheckResourceAttr(
"openstack_networking_secgroup_rule_v2.secgroup_rule_ipv6_opts", "protocol", "ipv6-opts"),
resource.TestCheckResourceAttr(
"openstack_networking_secgroup_rule_v2.secgroup_rule_ipv6_route", "protocol", "ipv6-route"),
resource.TestCheckResourceAttr(
"openstack_networking_secgroup_rule_v2.secgroup_rule_ospf", "protocol", "ospf"),
resource.TestCheckResourceAttr(
"openstack_networking_secgroup_rule_v2.secgroup_rule_pgm", "protocol", "pgm"),
resource.TestCheckResourceAttr(
"openstack_networking_secgroup_rule_v2.secgroup_rule_rsvp", "protocol", "rsvp"),
resource.TestCheckResourceAttr(
"openstack_networking_secgroup_rule_v2.secgroup_rule_sctp", "protocol", "sctp"),
resource.TestCheckResourceAttr(
"openstack_networking_secgroup_rule_v2.secgroup_rule_udplite", "protocol", "udplite"),
resource.TestCheckResourceAttr(
"openstack_networking_secgroup_rule_v2.secgroup_rule_vrrp", "protocol", "vrrp"),
),
},
},
})
}
func testAccCheckNetworkingV2SecGroupRuleDestroy(s *terraform.State) error {
config := testAccProvider.Meta().(*Config)
networkingClient, err := config.networkingV2Client(OS_REGION_NAME)
@ -226,3 +335,154 @@ resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_2" {
}
}
`
const testAccNetworkingV2SecGroupRule_vrrp = `
resource "openstack_networking_secgroup_v2" "secgroup_1" {
name = "secgroup_1"
description = "terraform security group rule acceptance test"
}
resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_ah" {
direction = "ingress"
ethertype = "IPv4"
protocol = "ah"
remote_ip_prefix = "0.0.0.0/0"
security_group_id = "${openstack_networking_secgroup_v2.secgroup_1.id}"
}
resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_dccp" {
direction = "ingress"
ethertype = "IPv4"
protocol = "dccp"
remote_ip_prefix = "0.0.0.0/0"
security_group_id = "${openstack_networking_secgroup_v2.secgroup_1.id}"
}
resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_egp" {
direction = "ingress"
ethertype = "IPv4"
protocol = "egp"
remote_ip_prefix = "0.0.0.0/0"
security_group_id = "${openstack_networking_secgroup_v2.secgroup_1.id}"
}
resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_esp" {
direction = "ingress"
ethertype = "IPv4"
protocol = "esp"
remote_ip_prefix = "0.0.0.0/0"
security_group_id = "${openstack_networking_secgroup_v2.secgroup_1.id}"
}
resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_gre" {
direction = "ingress"
ethertype = "IPv4"
protocol = "gre"
remote_ip_prefix = "0.0.0.0/0"
security_group_id = "${openstack_networking_secgroup_v2.secgroup_1.id}"
}
resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_igmp" {
direction = "ingress"
ethertype = "IPv4"
protocol = "igmp"
remote_ip_prefix = "0.0.0.0/0"
security_group_id = "${openstack_networking_secgroup_v2.secgroup_1.id}"
}
resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_ipv6_encap" {
direction = "ingress"
ethertype = "IPv6"
protocol = "ipv6-encap"
remote_ip_prefix = "::/0"
security_group_id = "${openstack_networking_secgroup_v2.secgroup_1.id}"
}
resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_ipv6_frag" {
direction = "ingress"
ethertype = "IPv6"
protocol = "ipv6-frag"
remote_ip_prefix = "::/0"
security_group_id = "${openstack_networking_secgroup_v2.secgroup_1.id}"
}
resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_ipv6_icmp" {
direction = "ingress"
ethertype = "IPv6"
protocol = "ipv6-icmp"
remote_ip_prefix = "::/0"
security_group_id = "${openstack_networking_secgroup_v2.secgroup_1.id}"
}
resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_ipv6_nonxt" {
direction = "ingress"
ethertype = "IPv6"
protocol = "ipv6-nonxt"
remote_ip_prefix = "::/0"
security_group_id = "${openstack_networking_secgroup_v2.secgroup_1.id}"
}
resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_ipv6_opts" {
direction = "ingress"
ethertype = "IPv6"
protocol = "ipv6-opts"
remote_ip_prefix = "::/0"
security_group_id = "${openstack_networking_secgroup_v2.secgroup_1.id}"
}
resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_ipv6_route" {
direction = "ingress"
ethertype = "IPv6"
protocol = "ipv6-route"
remote_ip_prefix = "::/0"
security_group_id = "${openstack_networking_secgroup_v2.secgroup_1.id}"
}
resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_ospf" {
direction = "ingress"
ethertype = "IPv4"
protocol = "ospf"
remote_ip_prefix = "0.0.0.0/0"
security_group_id = "${openstack_networking_secgroup_v2.secgroup_1.id}"
}
resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_pgm" {
direction = "ingress"
ethertype = "IPv4"
protocol = "pgm"
remote_ip_prefix = "0.0.0.0/0"
security_group_id = "${openstack_networking_secgroup_v2.secgroup_1.id}"
}
resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_rsvp" {
direction = "ingress"
ethertype = "IPv4"
protocol = "rsvp"
remote_ip_prefix = "0.0.0.0/0"
security_group_id = "${openstack_networking_secgroup_v2.secgroup_1.id}"
}
resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_sctp" {
direction = "ingress"
ethertype = "IPv4"
protocol = "sctp"
remote_ip_prefix = "0.0.0.0/0"
security_group_id = "${openstack_networking_secgroup_v2.secgroup_1.id}"
}
resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_udplite" {
direction = "ingress"
ethertype = "IPv4"
protocol = "udplite"
remote_ip_prefix = "0.0.0.0/0"
security_group_id = "${openstack_networking_secgroup_v2.secgroup_1.id}"
}
resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_vrrp" {
direction = "ingress"
ethertype = "IPv4"
protocol = "vrrp"
remote_ip_prefix = "0.0.0.0/0"
security_group_id = "${openstack_networking_secgroup_v2.secgroup_1.id}"
}
`