Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vpc/security_group: Fix complex dependency violations #26553

Merged
merged 11 commits into from
Aug 31, 2022
Prev Previous commit
Next Next commit
vpc/security_group: Remove deadcode
  • Loading branch information
YakDriver committed Aug 31, 2022
commit abf8846988c01a3baf30f10a9e75092185dc0495
5 changes: 5 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -19,6 +19,11 @@ ifneq ($(origin SWEEPERS), undefined)
SWEEPARGS = -sweep-run='$(SWEEPERS)'
endif

ifeq ($(PKG_NAME), internal/service/vpc)
PKG_NAME = internal/service/ec2
TEST = ./$(PKG_NAME)/...
endif

default: build

build: fmtcheck
24 changes: 0 additions & 24 deletions internal/service/ec2/vpc_security_group_test.go
Original file line number Diff line number Diff line change
@@ -2,8 +2,6 @@ package ec2_test

import (
"fmt"
"log"
"os"
"reflect"
"regexp"
"strconv"
@@ -2441,28 +2439,6 @@ func testAccCheckSecurityGroupRuleLimit(n string, v *int) resource.TestCheckFunc
}
}

// testAccSecurityGroupRulesPerGroupLimitFromEnv returns security group rules per group limit
// Currently this information is not available from any EC2 or Trusted Advisor API
// Prefers the EC2_SECURITY_GROUP_RULES_PER_GROUP_LIMIT environment variable or defaults to 50
func testAccSecurityGroupRulesPerGroupLimitFromEnv() int {
const defaultLimit = 50
const envVar = "EC2_SECURITY_GROUP_RULES_PER_GROUP_LIMIT"

envLimitStr := os.Getenv(envVar)
if envLimitStr == "" {
return defaultLimit
}
envLimitInt, err := strconv.Atoi(envLimitStr)
if err != nil {
log.Printf("[WARN] Error converting %q environment variable value %q to integer: %s", envVar, envLimitStr, err)
return defaultLimit
}
if envLimitInt <= 50 {
return defaultLimit
}
return envLimitInt
}

func testAccCheckSecurityGroupRuleCount(group *ec2.SecurityGroup, expectedIngressCount, expectedEgressCount int) resource.TestCheckFunc {
return func(s *terraform.State) error {
id := aws.StringValue(group.GroupId)