2014-11-26 14:42:59 +01:00
|
|
|
package aws
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
|
|
|
|
2015-06-03 20:36:57 +02:00
|
|
|
"github.com/aws/aws-sdk-go/aws"
|
|
|
|
"github.com/aws/aws-sdk-go/aws/awserr"
|
|
|
|
"github.com/aws/aws-sdk-go/service/ec2"
|
2014-11-26 14:42:59 +01:00
|
|
|
"github.com/hashicorp/terraform/helper/resource"
|
2015-04-16 22:02:04 +02:00
|
|
|
"github.com/hashicorp/terraform/terraform"
|
2014-11-26 14:42:59 +01:00
|
|
|
)
|
|
|
|
|
2015-04-13 18:14:21 +02:00
|
|
|
func TestAccAWSNetworkAcl_EgressAndIngressRules(t *testing.T) {
|
2015-08-17 20:27:16 +02:00
|
|
|
var networkAcl ec2.NetworkAcl
|
2014-11-30 12:40:54 +01:00
|
|
|
|
2014-12-01 09:49:05 +01:00
|
|
|
resource.Test(t, resource.TestCase{
|
2016-04-21 02:10:01 +02:00
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
IDRefreshName: "aws_network_acl.bar",
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckAWSNetworkAclDestroy,
|
2014-12-01 09:49:05 +01:00
|
|
|
Steps: []resource.TestStep{
|
2017-03-14 11:39:39 +01:00
|
|
|
{
|
2014-12-01 09:49:05 +01:00
|
|
|
Config: testAccAWSNetworkAclEgressNIngressConfig,
|
2017-03-14 11:39:39 +01:00
|
|
|
Check: resource.ComposeAggregateTestCheckFunc(
|
2014-12-01 09:49:05 +01:00
|
|
|
testAccCheckAWSNetworkAclExists("aws_network_acl.bar", &networkAcl),
|
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.bar", "ingress.1871939009.protocol", "6"),
|
2014-12-01 09:49:05 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.bar", "ingress.1871939009.rule_no", "1"),
|
2014-12-01 09:49:05 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.bar", "ingress.1871939009.from_port", "80"),
|
2014-12-01 09:49:05 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.bar", "ingress.1871939009.to_port", "80"),
|
2014-12-01 09:49:05 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.bar", "ingress.1871939009.action", "allow"),
|
2014-12-01 09:49:05 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.bar", "ingress.1871939009.cidr_block", "10.3.0.0/18"),
|
2014-12-01 09:49:05 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.bar", "egress.3111164687.protocol", "6"),
|
2014-12-01 09:49:05 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.bar", "egress.3111164687.rule_no", "2"),
|
2014-12-01 09:49:05 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.bar", "egress.3111164687.from_port", "443"),
|
2014-12-01 09:49:05 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.bar", "egress.3111164687.to_port", "443"),
|
2014-12-01 09:49:05 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.bar", "egress.3111164687.cidr_block", "10.3.0.0/18"),
|
2014-12-01 09:49:05 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.bar", "egress.3111164687.action", "allow"),
|
2014-12-01 09:49:05 +01:00
|
|
|
),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
2014-11-26 14:42:59 +01:00
|
|
|
}
|
|
|
|
|
2015-05-15 17:58:59 +02:00
|
|
|
func TestAccAWSNetworkAcl_OnlyIngressRules_basic(t *testing.T) {
|
2015-08-17 20:27:16 +02:00
|
|
|
var networkAcl ec2.NetworkAcl
|
2014-11-30 12:40:54 +01:00
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
2016-04-21 02:10:01 +02:00
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
IDRefreshName: "aws_network_acl.foos",
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckAWSNetworkAclDestroy,
|
2014-11-30 12:40:54 +01:00
|
|
|
Steps: []resource.TestStep{
|
2017-03-14 11:39:39 +01:00
|
|
|
{
|
2014-11-30 12:40:54 +01:00
|
|
|
Config: testAccAWSNetworkAclIngressConfig,
|
2017-03-14 11:39:39 +01:00
|
|
|
Check: resource.ComposeAggregateTestCheckFunc(
|
2014-12-01 09:49:05 +01:00
|
|
|
testAccCheckAWSNetworkAclExists("aws_network_acl.foos", &networkAcl),
|
2014-12-03 08:53:18 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.4245812720.protocol", "6"),
|
2014-12-03 08:53:18 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.4245812720.rule_no", "2"),
|
2014-12-03 08:53:18 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.4245812720.from_port", "443"),
|
2014-12-03 08:53:18 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.4245812720.to_port", "443"),
|
2014-12-03 08:53:18 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.4245812720.action", "deny"),
|
2014-12-03 08:53:18 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.4245812720.cidr_block", "10.2.0.0/18"),
|
2014-12-03 08:53:18 +01:00
|
|
|
),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2015-05-15 17:58:59 +02:00
|
|
|
func TestAccAWSNetworkAcl_OnlyIngressRules_update(t *testing.T) {
|
2015-08-17 20:27:16 +02:00
|
|
|
var networkAcl ec2.NetworkAcl
|
2014-12-03 08:53:18 +01:00
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
2016-04-21 02:10:01 +02:00
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
IDRefreshName: "aws_network_acl.foos",
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckAWSNetworkAclDestroy,
|
2014-12-03 08:53:18 +01:00
|
|
|
Steps: []resource.TestStep{
|
2017-03-14 11:39:39 +01:00
|
|
|
{
|
2014-12-03 08:53:18 +01:00
|
|
|
Config: testAccAWSNetworkAclIngressConfig,
|
2017-03-14 11:39:39 +01:00
|
|
|
Check: resource.ComposeAggregateTestCheckFunc(
|
2014-12-03 08:53:18 +01:00
|
|
|
testAccCheckAWSNetworkAclExists("aws_network_acl.foos", &networkAcl),
|
|
|
|
testIngressRuleLength(&networkAcl, 2),
|
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.401088754.protocol", "6"),
|
2014-12-03 08:53:18 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.401088754.rule_no", "1"),
|
2014-12-03 08:53:18 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.401088754.from_port", "0"),
|
2014-12-03 08:53:18 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.401088754.to_port", "22"),
|
2014-12-03 08:53:18 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.401088754.action", "deny"),
|
2014-12-03 08:53:18 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.4245812720.cidr_block", "10.2.0.0/18"),
|
2014-12-03 08:53:18 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.4245812720.from_port", "443"),
|
2014-12-03 08:53:18 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.4245812720.rule_no", "2"),
|
2014-12-03 08:53:18 +01:00
|
|
|
),
|
|
|
|
},
|
2017-03-14 11:39:39 +01:00
|
|
|
{
|
2014-12-03 08:53:18 +01:00
|
|
|
Config: testAccAWSNetworkAclIngressConfigChange,
|
2017-03-14 11:39:39 +01:00
|
|
|
Check: resource.ComposeAggregateTestCheckFunc(
|
2014-12-03 08:53:18 +01:00
|
|
|
testAccCheckAWSNetworkAclExists("aws_network_acl.foos", &networkAcl),
|
|
|
|
testIngressRuleLength(&networkAcl, 1),
|
2014-12-01 09:49:05 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.401088754.protocol", "6"),
|
2014-12-01 09:49:05 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.401088754.rule_no", "1"),
|
2014-12-01 09:49:05 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.401088754.from_port", "0"),
|
2014-12-01 09:49:05 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.401088754.to_port", "22"),
|
2014-12-01 09:49:05 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.401088754.action", "deny"),
|
2014-12-01 09:49:05 +01:00
|
|
|
resource.TestCheckResourceAttr(
|
2017-03-14 11:39:39 +01:00
|
|
|
"aws_network_acl.foos", "ingress.401088754.cidr_block", "10.2.0.0/18"),
|
2014-11-30 12:40:54 +01:00
|
|
|
),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2015-04-13 18:14:21 +02:00
|
|
|
func TestAccAWSNetworkAcl_OnlyEgressRules(t *testing.T) {
|
2015-08-17 20:27:16 +02:00
|
|
|
var networkAcl ec2.NetworkAcl
|
2014-11-26 14:42:59 +01:00
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
2016-04-21 02:10:01 +02:00
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
IDRefreshName: "aws_network_acl.bond",
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckAWSNetworkAclDestroy,
|
2014-11-26 14:42:59 +01:00
|
|
|
Steps: []resource.TestStep{
|
2017-03-14 11:39:39 +01:00
|
|
|
{
|
2014-11-30 12:40:54 +01:00
|
|
|
Config: testAccAWSNetworkAclEgressConfig,
|
2014-11-26 14:42:59 +01:00
|
|
|
Check: resource.ComposeTestCheckFunc(
|
2014-12-01 09:49:05 +01:00
|
|
|
testAccCheckAWSNetworkAclExists("aws_network_acl.bond", &networkAcl),
|
2015-05-12 21:58:10 +02:00
|
|
|
testAccCheckTags(&networkAcl.Tags, "foo", "bar"),
|
2014-11-26 14:42:59 +01:00
|
|
|
),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2015-03-11 16:40:32 +01:00
|
|
|
func TestAccAWSNetworkAcl_SubnetChange(t *testing.T) {
|
2014-12-03 08:53:18 +01:00
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
2016-04-21 02:10:01 +02:00
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
IDRefreshName: "aws_network_acl.bar",
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckAWSNetworkAclDestroy,
|
2014-12-03 08:53:18 +01:00
|
|
|
Steps: []resource.TestStep{
|
2017-03-14 11:39:39 +01:00
|
|
|
{
|
2014-12-03 08:53:18 +01:00
|
|
|
Config: testAccAWSNetworkAclSubnetConfig,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckSubnetIsAssociatedWithAcl("aws_network_acl.bar", "aws_subnet.old"),
|
|
|
|
),
|
|
|
|
},
|
2017-03-14 11:39:39 +01:00
|
|
|
{
|
2014-12-03 08:53:18 +01:00
|
|
|
Config: testAccAWSNetworkAclSubnetConfigChange,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckSubnetIsNotAssociatedWithAcl("aws_network_acl.bar", "aws_subnet.old"),
|
|
|
|
testAccCheckSubnetIsAssociatedWithAcl("aws_network_acl.bar", "aws_subnet.new"),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-05-12 20:24:32 +02:00
|
|
|
func TestAccAWSNetworkAcl_Subnets(t *testing.T) {
|
2015-08-17 20:27:16 +02:00
|
|
|
var networkAcl ec2.NetworkAcl
|
2015-05-15 03:57:07 +02:00
|
|
|
|
2015-08-17 20:27:16 +02:00
|
|
|
checkACLSubnets := func(acl *ec2.NetworkAcl, count int) resource.TestCheckFunc {
|
2015-05-15 03:57:07 +02:00
|
|
|
return func(*terraform.State) (err error) {
|
|
|
|
if count != len(acl.Associations) {
|
|
|
|
return fmt.Errorf("ACL association count does not match, expected %d, got %d", count, len(acl.Associations))
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-12 20:24:32 +02:00
|
|
|
resource.Test(t, resource.TestCase{
|
2016-04-21 02:10:01 +02:00
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
IDRefreshName: "aws_network_acl.bar",
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckAWSNetworkAclDestroy,
|
2015-05-12 20:24:32 +02:00
|
|
|
Steps: []resource.TestStep{
|
2017-03-14 11:39:39 +01:00
|
|
|
{
|
2015-05-12 20:24:32 +02:00
|
|
|
Config: testAccAWSNetworkAclSubnet_SubnetIds,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
2015-05-15 03:57:07 +02:00
|
|
|
testAccCheckAWSNetworkAclExists("aws_network_acl.bar", &networkAcl),
|
2015-05-12 20:24:32 +02:00
|
|
|
testAccCheckSubnetIsAssociatedWithAcl("aws_network_acl.bar", "aws_subnet.one"),
|
|
|
|
testAccCheckSubnetIsAssociatedWithAcl("aws_network_acl.bar", "aws_subnet.two"),
|
2015-05-15 03:57:07 +02:00
|
|
|
checkACLSubnets(&networkAcl, 2),
|
2015-05-12 20:24:32 +02:00
|
|
|
),
|
|
|
|
},
|
2015-05-13 05:23:55 +02:00
|
|
|
|
2017-03-14 11:39:39 +01:00
|
|
|
{
|
2015-05-13 05:23:55 +02:00
|
|
|
Config: testAccAWSNetworkAclSubnet_SubnetIdsUpdate,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
2015-05-15 03:57:07 +02:00
|
|
|
testAccCheckAWSNetworkAclExists("aws_network_acl.bar", &networkAcl),
|
2015-05-13 05:23:55 +02:00
|
|
|
testAccCheckSubnetIsAssociatedWithAcl("aws_network_acl.bar", "aws_subnet.one"),
|
|
|
|
testAccCheckSubnetIsAssociatedWithAcl("aws_network_acl.bar", "aws_subnet.three"),
|
|
|
|
testAccCheckSubnetIsAssociatedWithAcl("aws_network_acl.bar", "aws_subnet.four"),
|
2015-05-15 03:57:07 +02:00
|
|
|
checkACLSubnets(&networkAcl, 3),
|
2015-05-13 05:23:55 +02:00
|
|
|
),
|
|
|
|
},
|
2015-05-12 20:24:32 +02:00
|
|
|
},
|
|
|
|
})
|
2016-09-22 18:47:15 +02:00
|
|
|
}
|
|
|
|
|
2017-03-14 11:39:39 +01:00
|
|
|
func TestAccAWSNetworkAcl_ipv6Rules(t *testing.T) {
|
|
|
|
var networkAcl ec2.NetworkAcl
|
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
IDRefreshName: "aws_network_acl.foos",
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckAWSNetworkAclDestroy,
|
|
|
|
Steps: []resource.TestStep{
|
|
|
|
{
|
|
|
|
Config: testAccAWSNetworkAclIpv6Config,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckAWSNetworkAclExists("aws_network_acl.foos", &networkAcl),
|
|
|
|
resource.TestCheckResourceAttr(
|
|
|
|
"aws_network_acl.foos", "ingress.1976110835.protocol", "6"),
|
|
|
|
resource.TestCheckResourceAttr(
|
|
|
|
"aws_network_acl.foos", "ingress.1976110835.rule_no", "1"),
|
|
|
|
resource.TestCheckResourceAttr(
|
|
|
|
"aws_network_acl.foos", "ingress.1976110835.from_port", "0"),
|
|
|
|
resource.TestCheckResourceAttr(
|
|
|
|
"aws_network_acl.foos", "ingress.1976110835.to_port", "22"),
|
|
|
|
resource.TestCheckResourceAttr(
|
|
|
|
"aws_network_acl.foos", "ingress.1976110835.action", "allow"),
|
|
|
|
resource.TestCheckResourceAttr(
|
|
|
|
"aws_network_acl.foos", "ingress.1976110835.ipv6_cidr_block", "::/0"),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2016-09-22 18:47:15 +02:00
|
|
|
func TestAccAWSNetworkAcl_espProtocol(t *testing.T) {
|
2016-09-22 20:30:32 +02:00
|
|
|
var networkAcl ec2.NetworkAcl
|
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
IDRefreshName: "aws_network_acl.testesp",
|
|
|
|
Providers: testAccProviders,
|
|
|
|
CheckDestroy: testAccCheckAWSNetworkAclDestroy,
|
|
|
|
Steps: []resource.TestStep{
|
2017-03-14 11:39:39 +01:00
|
|
|
{
|
2016-09-22 20:30:32 +02:00
|
|
|
Config: testAccAWSNetworkAclEsp,
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
testAccCheckAWSNetworkAclExists("aws_network_acl.testesp", &networkAcl),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
2015-05-12 20:24:32 +02:00
|
|
|
}
|
|
|
|
|
2014-11-26 14:42:59 +01:00
|
|
|
func testAccCheckAWSNetworkAclDestroy(s *terraform.State) error {
|
2015-03-13 15:42:50 +01:00
|
|
|
conn := testAccProvider.Meta().(*AWSClient).ec2conn
|
2014-11-26 14:42:59 +01:00
|
|
|
|
|
|
|
for _, rs := range s.RootModule().Resources {
|
|
|
|
if rs.Type != "aws_network" {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
// Retrieve the network acl
|
2015-08-17 20:27:16 +02:00
|
|
|
resp, err := conn.DescribeNetworkAcls(&ec2.DescribeNetworkAclsInput{
|
|
|
|
NetworkAclIds: []*string{aws.String(rs.Primary.ID)},
|
2015-03-11 21:01:07 +01:00
|
|
|
})
|
2014-11-26 14:42:59 +01:00
|
|
|
if err == nil {
|
2015-08-17 20:27:16 +02:00
|
|
|
if len(resp.NetworkAcls) > 0 && *resp.NetworkAcls[0].NetworkAclId == rs.Primary.ID {
|
2014-11-26 14:42:59 +01:00
|
|
|
return fmt.Errorf("Network Acl (%s) still exists.", rs.Primary.ID)
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2015-05-20 13:21:23 +02:00
|
|
|
ec2err, ok := err.(awserr.Error)
|
2014-11-26 14:42:59 +01:00
|
|
|
if !ok {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
// Confirm error code is what we want
|
2015-05-20 13:21:23 +02:00
|
|
|
if ec2err.Code() != "InvalidNetworkAclID.NotFound" {
|
2014-11-26 14:42:59 +01:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2015-08-17 20:27:16 +02:00
|
|
|
func testAccCheckAWSNetworkAclExists(n string, networkAcl *ec2.NetworkAcl) resource.TestCheckFunc {
|
2014-11-26 14:42:59 +01:00
|
|
|
return func(s *terraform.State) error {
|
|
|
|
rs, ok := s.RootModule().Resources[n]
|
|
|
|
if !ok {
|
|
|
|
return fmt.Errorf("Not found: %s", n)
|
|
|
|
}
|
|
|
|
|
|
|
|
if rs.Primary.ID == "" {
|
|
|
|
return fmt.Errorf("No Security Group is set")
|
|
|
|
}
|
2015-03-13 15:42:50 +01:00
|
|
|
conn := testAccProvider.Meta().(*AWSClient).ec2conn
|
2014-11-26 14:42:59 +01:00
|
|
|
|
2015-08-17 20:27:16 +02:00
|
|
|
resp, err := conn.DescribeNetworkAcls(&ec2.DescribeNetworkAclsInput{
|
|
|
|
NetworkAclIds: []*string{aws.String(rs.Primary.ID)},
|
2015-03-11 21:01:07 +01:00
|
|
|
})
|
2014-11-26 14:42:59 +01:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2015-08-17 20:27:16 +02:00
|
|
|
if len(resp.NetworkAcls) > 0 && *resp.NetworkAcls[0].NetworkAclId == rs.Primary.ID {
|
|
|
|
*networkAcl = *resp.NetworkAcls[0]
|
2014-11-26 14:42:59 +01:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return fmt.Errorf("Network Acls not found")
|
|
|
|
}
|
|
|
|
}
|
2014-12-01 09:49:05 +01:00
|
|
|
|
2015-08-17 20:27:16 +02:00
|
|
|
func testIngressRuleLength(networkAcl *ec2.NetworkAcl, length int) resource.TestCheckFunc {
|
2014-12-12 13:25:44 +01:00
|
|
|
return func(s *terraform.State) error {
|
2015-08-17 20:27:16 +02:00
|
|
|
var ingressEntries []*ec2.NetworkAclEntry
|
2015-03-11 21:01:07 +01:00
|
|
|
for _, e := range networkAcl.Entries {
|
|
|
|
if *e.Egress == false {
|
2014-12-03 08:53:18 +01:00
|
|
|
ingressEntries = append(ingressEntries, e)
|
2014-12-12 13:25:44 +01:00
|
|
|
}
|
2014-12-03 08:53:18 +01:00
|
|
|
}
|
2014-12-12 13:25:44 +01:00
|
|
|
// There is always a default rule (ALL Traffic ... DENY)
|
2015-09-11 20:56:20 +02:00
|
|
|
// so we have to increase the length by 1
|
2014-12-12 13:25:44 +01:00
|
|
|
if len(ingressEntries) != length+1 {
|
|
|
|
return fmt.Errorf("Invalid number of ingress entries found; count = %d", len(ingressEntries))
|
2014-12-03 08:53:18 +01:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func testAccCheckSubnetIsAssociatedWithAcl(acl string, sub string) resource.TestCheckFunc {
|
2014-12-03 08:34:28 +01:00
|
|
|
return func(s *terraform.State) error {
|
2014-12-03 08:53:18 +01:00
|
|
|
networkAcl := s.RootModule().Resources[acl]
|
|
|
|
subnet := s.RootModule().Resources[sub]
|
2014-12-03 08:34:28 +01:00
|
|
|
|
2015-03-13 15:42:50 +01:00
|
|
|
conn := testAccProvider.Meta().(*AWSClient).ec2conn
|
2015-08-17 20:27:16 +02:00
|
|
|
resp, err := conn.DescribeNetworkAcls(&ec2.DescribeNetworkAclsInput{
|
|
|
|
NetworkAclIds: []*string{aws.String(networkAcl.Primary.ID)},
|
2015-04-16 22:02:04 +02:00
|
|
|
Filters: []*ec2.Filter{
|
2017-03-14 11:39:39 +01:00
|
|
|
{
|
2015-03-11 21:01:07 +01:00
|
|
|
Name: aws.String("association.subnet-id"),
|
2015-04-16 22:02:04 +02:00
|
|
|
Values: []*string{aws.String(subnet.Primary.ID)},
|
2015-03-11 21:01:07 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
2014-12-03 08:34:28 +01:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2015-08-17 20:27:16 +02:00
|
|
|
if len(resp.NetworkAcls) > 0 {
|
2014-12-03 08:34:28 +01:00
|
|
|
return nil
|
2014-12-03 08:53:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return fmt.Errorf("Network Acl %s is not associated with subnet %s", acl, sub)
|
2014-12-03 08:34:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-03 08:53:18 +01:00
|
|
|
func testAccCheckSubnetIsNotAssociatedWithAcl(acl string, subnet string) resource.TestCheckFunc {
|
|
|
|
return func(s *terraform.State) error {
|
|
|
|
networkAcl := s.RootModule().Resources[acl]
|
|
|
|
subnet := s.RootModule().Resources[subnet]
|
|
|
|
|
2015-03-13 15:42:50 +01:00
|
|
|
conn := testAccProvider.Meta().(*AWSClient).ec2conn
|
2015-08-17 20:27:16 +02:00
|
|
|
resp, err := conn.DescribeNetworkAcls(&ec2.DescribeNetworkAclsInput{
|
|
|
|
NetworkAclIds: []*string{aws.String(networkAcl.Primary.ID)},
|
2015-04-16 22:02:04 +02:00
|
|
|
Filters: []*ec2.Filter{
|
2017-03-14 11:39:39 +01:00
|
|
|
{
|
2015-03-11 21:01:07 +01:00
|
|
|
Name: aws.String("association.subnet-id"),
|
2015-04-16 22:02:04 +02:00
|
|
|
Values: []*string{aws.String(subnet.Primary.ID)},
|
2015-03-11 21:01:07 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
2014-12-03 08:53:18 +01:00
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2015-08-17 20:27:16 +02:00
|
|
|
if len(resp.NetworkAcls) > 0 {
|
2014-12-03 08:53:18 +01:00
|
|
|
return fmt.Errorf("Network Acl %s is still associated with subnet %s", acl, subnet)
|
|
|
|
}
|
|
|
|
return nil
|
2014-12-01 09:49:05 +01:00
|
|
|
}
|
|
|
|
}
|
2014-12-03 08:53:18 +01:00
|
|
|
|
2017-03-14 11:39:39 +01:00
|
|
|
const testAccAWSNetworkAclIpv6Config = `
|
|
|
|
resource "aws_vpc" "foo" {
|
|
|
|
cidr_block = "10.1.0.0/16"
|
|
|
|
tags {
|
|
|
|
Name = "TestAccAWSNetworkAcl_ipv6Rules"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
resource "aws_subnet" "blob" {
|
|
|
|
cidr_block = "10.1.1.0/24"
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
map_public_ip_on_launch = true
|
|
|
|
}
|
|
|
|
resource "aws_network_acl" "foos" {
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
ingress = {
|
|
|
|
protocol = "tcp"
|
|
|
|
rule_no = 1
|
|
|
|
action = "allow"
|
|
|
|
ipv6_cidr_block = "::/0"
|
|
|
|
from_port = 0
|
|
|
|
to_port = 22
|
|
|
|
}
|
|
|
|
|
|
|
|
subnet_ids = ["${aws_subnet.blob.id}"]
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
2014-12-12 13:25:44 +01:00
|
|
|
const testAccAWSNetworkAclIngressConfig = `
|
|
|
|
resource "aws_vpc" "foo" {
|
|
|
|
cidr_block = "10.1.0.0/16"
|
2016-04-05 17:18:03 +02:00
|
|
|
tags {
|
|
|
|
Name = "TestAccAWSNetworkAcl_OnlyIngressRules"
|
|
|
|
}
|
2014-12-12 13:25:44 +01:00
|
|
|
}
|
|
|
|
resource "aws_subnet" "blob" {
|
|
|
|
cidr_block = "10.1.1.0/24"
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
map_public_ip_on_launch = true
|
|
|
|
}
|
|
|
|
resource "aws_network_acl" "foos" {
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
ingress = {
|
|
|
|
protocol = "tcp"
|
|
|
|
rule_no = 1
|
|
|
|
action = "deny"
|
2015-05-07 05:43:28 +02:00
|
|
|
cidr_block = "10.2.0.0/18"
|
2014-12-12 13:25:44 +01:00
|
|
|
from_port = 0
|
|
|
|
to_port = 22
|
|
|
|
}
|
|
|
|
ingress = {
|
|
|
|
protocol = "tcp"
|
|
|
|
rule_no = 2
|
|
|
|
action = "deny"
|
2015-05-07 05:43:28 +02:00
|
|
|
cidr_block = "10.2.0.0/18"
|
2014-12-12 13:25:44 +01:00
|
|
|
from_port = 443
|
|
|
|
to_port = 443
|
|
|
|
}
|
2016-04-21 02:16:37 +02:00
|
|
|
|
|
|
|
subnet_ids = ["${aws_subnet.blob.id}"]
|
2014-12-12 13:25:44 +01:00
|
|
|
}
|
|
|
|
`
|
|
|
|
const testAccAWSNetworkAclIngressConfigChange = `
|
|
|
|
resource "aws_vpc" "foo" {
|
|
|
|
cidr_block = "10.1.0.0/16"
|
2016-04-05 17:18:03 +02:00
|
|
|
tags {
|
|
|
|
Name = "TestAccAWSNetworkAcl_OnlyIngressRules"
|
|
|
|
}
|
2014-12-12 13:25:44 +01:00
|
|
|
}
|
|
|
|
resource "aws_subnet" "blob" {
|
|
|
|
cidr_block = "10.1.1.0/24"
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
map_public_ip_on_launch = true
|
|
|
|
}
|
|
|
|
resource "aws_network_acl" "foos" {
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
ingress = {
|
|
|
|
protocol = "tcp"
|
|
|
|
rule_no = 1
|
|
|
|
action = "deny"
|
2015-05-07 05:43:28 +02:00
|
|
|
cidr_block = "10.2.0.0/18"
|
2014-12-12 23:21:20 +01:00
|
|
|
from_port = 0
|
|
|
|
to_port = 22
|
2014-12-12 13:25:44 +01:00
|
|
|
}
|
2016-04-21 02:16:37 +02:00
|
|
|
subnet_ids = ["${aws_subnet.blob.id}"]
|
2014-12-12 13:25:44 +01:00
|
|
|
}
|
|
|
|
`
|
2014-12-01 09:49:05 +01:00
|
|
|
|
|
|
|
const testAccAWSNetworkAclEgressConfig = `
|
|
|
|
resource "aws_vpc" "foo" {
|
|
|
|
cidr_block = "10.2.0.0/16"
|
2016-04-05 17:18:03 +02:00
|
|
|
tags {
|
|
|
|
Name = "TestAccAWSNetworkAcl_OnlyEgressRules"
|
|
|
|
}
|
2014-12-01 09:49:05 +01:00
|
|
|
}
|
|
|
|
resource "aws_subnet" "blob" {
|
|
|
|
cidr_block = "10.2.0.0/24"
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
map_public_ip_on_launch = true
|
|
|
|
}
|
|
|
|
resource "aws_network_acl" "bond" {
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
egress = {
|
|
|
|
protocol = "tcp"
|
|
|
|
rule_no = 2
|
|
|
|
action = "allow"
|
2015-05-07 05:43:28 +02:00
|
|
|
cidr_block = "10.2.0.0/18"
|
2014-12-01 09:49:05 +01:00
|
|
|
from_port = 443
|
|
|
|
to_port = 443
|
|
|
|
}
|
|
|
|
|
2015-05-07 05:43:28 +02:00
|
|
|
egress = {
|
|
|
|
protocol = "-1"
|
|
|
|
rule_no = 4
|
|
|
|
action = "allow"
|
|
|
|
cidr_block = "0.0.0.0/0"
|
|
|
|
from_port = 0
|
|
|
|
to_port = 0
|
|
|
|
}
|
|
|
|
|
2014-12-01 09:49:05 +01:00
|
|
|
egress = {
|
|
|
|
protocol = "tcp"
|
|
|
|
rule_no = 1
|
|
|
|
action = "allow"
|
2015-05-07 05:43:28 +02:00
|
|
|
cidr_block = "10.2.0.0/18"
|
2014-12-01 09:49:05 +01:00
|
|
|
from_port = 80
|
|
|
|
to_port = 80
|
|
|
|
}
|
|
|
|
|
|
|
|
egress = {
|
|
|
|
protocol = "tcp"
|
|
|
|
rule_no = 3
|
|
|
|
action = "allow"
|
2015-05-07 05:43:28 +02:00
|
|
|
cidr_block = "10.2.0.0/18"
|
2014-12-01 09:49:05 +01:00
|
|
|
from_port = 22
|
|
|
|
to_port = 22
|
|
|
|
}
|
2014-12-10 11:59:00 +01:00
|
|
|
|
|
|
|
tags {
|
|
|
|
foo = "bar"
|
|
|
|
}
|
2014-12-01 09:49:05 +01:00
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
const testAccAWSNetworkAclEgressNIngressConfig = `
|
|
|
|
resource "aws_vpc" "foo" {
|
|
|
|
cidr_block = "10.3.0.0/16"
|
2016-04-05 17:18:03 +02:00
|
|
|
tags {
|
|
|
|
Name = "TestAccAWSNetworkAcl_EgressAndIngressRules"
|
|
|
|
}
|
2014-12-01 09:49:05 +01:00
|
|
|
}
|
|
|
|
resource "aws_subnet" "blob" {
|
|
|
|
cidr_block = "10.3.0.0/24"
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
map_public_ip_on_launch = true
|
|
|
|
}
|
|
|
|
resource "aws_network_acl" "bar" {
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
egress = {
|
|
|
|
protocol = "tcp"
|
|
|
|
rule_no = 2
|
|
|
|
action = "allow"
|
2015-05-07 05:43:28 +02:00
|
|
|
cidr_block = "10.3.0.0/18"
|
2014-12-01 09:49:05 +01:00
|
|
|
from_port = 443
|
|
|
|
to_port = 443
|
|
|
|
}
|
|
|
|
|
|
|
|
ingress = {
|
|
|
|
protocol = "tcp"
|
|
|
|
rule_no = 1
|
|
|
|
action = "allow"
|
2015-05-07 05:43:28 +02:00
|
|
|
cidr_block = "10.3.0.0/18"
|
2014-12-01 09:49:05 +01:00
|
|
|
from_port = 80
|
|
|
|
to_port = 80
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|
2014-12-03 08:53:18 +01:00
|
|
|
const testAccAWSNetworkAclSubnetConfig = `
|
|
|
|
resource "aws_vpc" "foo" {
|
|
|
|
cidr_block = "10.1.0.0/16"
|
2016-04-05 17:18:03 +02:00
|
|
|
tags {
|
|
|
|
Name = "TestAccAWSNetworkAcl_SubnetChange"
|
|
|
|
}
|
2014-12-03 08:53:18 +01:00
|
|
|
}
|
|
|
|
resource "aws_subnet" "old" {
|
|
|
|
cidr_block = "10.1.111.0/24"
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
map_public_ip_on_launch = true
|
|
|
|
}
|
|
|
|
resource "aws_subnet" "new" {
|
|
|
|
cidr_block = "10.1.1.0/24"
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
map_public_ip_on_launch = true
|
|
|
|
}
|
|
|
|
resource "aws_network_acl" "roll" {
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
2016-04-21 02:16:37 +02:00
|
|
|
subnet_ids = ["${aws_subnet.new.id}"]
|
2014-12-03 08:53:18 +01:00
|
|
|
}
|
|
|
|
resource "aws_network_acl" "bar" {
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
2016-04-21 02:16:37 +02:00
|
|
|
subnet_ids = ["${aws_subnet.old.id}"]
|
2014-12-03 08:53:18 +01:00
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
const testAccAWSNetworkAclSubnetConfigChange = `
|
|
|
|
resource "aws_vpc" "foo" {
|
|
|
|
cidr_block = "10.1.0.0/16"
|
2016-04-05 17:18:03 +02:00
|
|
|
tags {
|
|
|
|
Name = "TestAccAWSNetworkAcl_SubnetChange"
|
|
|
|
}
|
2014-12-03 08:53:18 +01:00
|
|
|
}
|
|
|
|
resource "aws_subnet" "old" {
|
|
|
|
cidr_block = "10.1.111.0/24"
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
map_public_ip_on_launch = true
|
|
|
|
}
|
|
|
|
resource "aws_subnet" "new" {
|
|
|
|
cidr_block = "10.1.1.0/24"
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
map_public_ip_on_launch = true
|
|
|
|
}
|
|
|
|
resource "aws_network_acl" "bar" {
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
2016-04-21 02:16:37 +02:00
|
|
|
subnet_ids = ["${aws_subnet.new.id}"]
|
2014-12-03 08:53:18 +01:00
|
|
|
}
|
|
|
|
`
|
2015-05-12 20:24:32 +02:00
|
|
|
|
|
|
|
const testAccAWSNetworkAclSubnet_SubnetIds = `
|
|
|
|
resource "aws_vpc" "foo" {
|
|
|
|
cidr_block = "10.1.0.0/16"
|
|
|
|
tags {
|
2016-04-05 17:18:03 +02:00
|
|
|
Name = "TestAccAWSNetworkAcl_Subnets"
|
2015-05-12 20:24:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
resource "aws_subnet" "one" {
|
|
|
|
cidr_block = "10.1.111.0/24"
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
2016-04-05 17:18:03 +02:00
|
|
|
tags {
|
|
|
|
Name = "acl-subnets-test"
|
|
|
|
}
|
2015-05-12 20:24:32 +02:00
|
|
|
}
|
|
|
|
resource "aws_subnet" "two" {
|
|
|
|
cidr_block = "10.1.1.0/24"
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
2016-04-05 17:18:03 +02:00
|
|
|
tags {
|
|
|
|
Name = "acl-subnets-test"
|
|
|
|
}
|
2015-05-12 20:24:32 +02:00
|
|
|
}
|
|
|
|
resource "aws_network_acl" "bar" {
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
subnet_ids = ["${aws_subnet.one.id}", "${aws_subnet.two.id}"]
|
2016-04-05 17:18:03 +02:00
|
|
|
tags {
|
|
|
|
Name = "acl-subnets-test"
|
|
|
|
}
|
2015-05-12 20:24:32 +02:00
|
|
|
}
|
|
|
|
`
|
2015-05-13 05:23:55 +02:00
|
|
|
|
|
|
|
const testAccAWSNetworkAclSubnet_SubnetIdsUpdate = `
|
|
|
|
resource "aws_vpc" "foo" {
|
|
|
|
cidr_block = "10.1.0.0/16"
|
|
|
|
tags {
|
2016-04-05 17:18:03 +02:00
|
|
|
Name = "TestAccAWSNetworkAcl_Subnets"
|
2015-05-13 05:23:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
resource "aws_subnet" "one" {
|
|
|
|
cidr_block = "10.1.111.0/24"
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
2016-04-05 17:18:03 +02:00
|
|
|
tags {
|
|
|
|
Name = "acl-subnets-test"
|
|
|
|
}
|
2015-05-13 05:23:55 +02:00
|
|
|
}
|
|
|
|
resource "aws_subnet" "two" {
|
|
|
|
cidr_block = "10.1.1.0/24"
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
2016-04-05 17:18:03 +02:00
|
|
|
tags {
|
|
|
|
Name = "acl-subnets-test"
|
|
|
|
}
|
2015-05-13 05:23:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_subnet" "three" {
|
|
|
|
cidr_block = "10.1.222.0/24"
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
2016-04-05 17:18:03 +02:00
|
|
|
tags {
|
|
|
|
Name = "acl-subnets-test"
|
|
|
|
}
|
2015-05-13 05:23:55 +02:00
|
|
|
}
|
|
|
|
resource "aws_subnet" "four" {
|
|
|
|
cidr_block = "10.1.4.0/24"
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
2016-04-05 17:18:03 +02:00
|
|
|
tags {
|
|
|
|
Name = "acl-subnets-test"
|
|
|
|
}
|
2015-05-13 05:23:55 +02:00
|
|
|
}
|
|
|
|
resource "aws_network_acl" "bar" {
|
|
|
|
vpc_id = "${aws_vpc.foo.id}"
|
|
|
|
subnet_ids = [
|
2016-04-21 02:10:01 +02:00
|
|
|
"${aws_subnet.one.id}",
|
2015-05-13 05:23:55 +02:00
|
|
|
"${aws_subnet.three.id}",
|
|
|
|
"${aws_subnet.four.id}",
|
|
|
|
]
|
2016-04-05 17:18:03 +02:00
|
|
|
tags {
|
|
|
|
Name = "acl-subnets-test"
|
|
|
|
}
|
2015-05-13 05:23:55 +02:00
|
|
|
}
|
|
|
|
`
|
2016-09-22 18:47:15 +02:00
|
|
|
|
|
|
|
const testAccAWSNetworkAclEsp = `
|
|
|
|
resource "aws_vpc" "testespvpc" {
|
|
|
|
cidr_block = "10.1.0.0/16"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_network_acl" "testesp" {
|
|
|
|
vpc_id = "${aws_vpc.testespvpc.id}"
|
|
|
|
|
|
|
|
egress {
|
|
|
|
protocol = "esp"
|
|
|
|
rule_no = 5
|
|
|
|
action = "allow"
|
|
|
|
cidr_block = "10.3.0.0/18"
|
|
|
|
from_port = 0
|
|
|
|
to_port = 0
|
|
|
|
}
|
|
|
|
|
|
|
|
tags {
|
|
|
|
Name = "test_esp"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|