@@ -117,14 +117,15 @@ func handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyRespo
117117
118118 // discover subnets by tag
119119 subnetTags := strings .Split (os .Getenv ("SUBNET_TAGS" ), "," )
120-
121120 const tagParts = 2
122121 filters := []types.Filter {}
122+
123123 for _ , tag := range subnetTags {
124124 parts := strings .SplitN (tag , "=" , tagParts )
125125 if len (parts ) != tagParts {
126126 continue
127127 }
128+
128129 filters = append (filters , types.Filter {
129130 Name : aws .String ("tag:" + parts [0 ]),
130131 Values : []string {parts [1 ]},
@@ -146,14 +147,15 @@ func handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyRespo
146147 subnetID := * subnetResult .Subnets [0 ].SubnetId
147148
148149 // discover security groups by tag
150+ filters = []types.Filter {}
149151 sgTags := strings .Split (os .Getenv ("SECURITY_GROUP_TAGS" ), "," )
150152
151- filters = []types.Filter {}
152153 for _ , tag := range sgTags {
153154 parts := strings .SplitN (tag , "=" , tagParts )
154- if len (parts ) != 2 {
155+ if len (parts ) != tagParts {
155156 continue
156157 }
158+
157159 filters = append (filters , types.Filter {
158160 Name : aws .String ("tag:" + parts [0 ]),
159161 Values : []string {parts [1 ]},
0 commit comments