Skip to content

Commit

Permalink
fix: remove acl and sg validation rule (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
argeiger committed Nov 19, 2022
1 parent 2c3fa6a commit c604a85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 40 deletions.
8 changes: 4 additions & 4 deletions module-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
],
"pos": {
"filename": "variables.tf",
"line": 398
"line": 362
}
},
"security_group_rules": {
Expand All @@ -221,7 +221,7 @@
],
"pos": {
"filename": "variables.tf",
"line": 314
"line": 296
}
},
"subnets": {
Expand Down Expand Up @@ -259,7 +259,7 @@
],
"pos": {
"filename": "variables.tf",
"line": 251
"line": 233
}
},
"tags": {
Expand Down Expand Up @@ -312,7 +312,7 @@
],
"pos": {
"filename": "variables.tf",
"line": 225
"line": 207
}
}
},
Expand Down
36 changes: 0 additions & 36 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -159,24 +159,6 @@ variable "network_acls" {
}
]

validation {
error_message = "ACL rules can only have one of `icmp`, `udp`, or `tcp`."
condition = length(distinct(
# Get flat list of results
flatten([
# Check through rules
for rule in flatten([var.network_acls[*].rules]) :
# Return true if there is more than one of `icmp`, `udp`, or `tcp`
true if length(
[
for type in ["tcp", "udp", "icmp"] :
true if rule[type] != null
]
) > 1
])
)) == 0 # Checks for length. If all fields all correct, array will be empty
}

validation {
error_message = "ACL rule actions can only be `allow` or `deny`."
condition = length(distinct(
Expand Down Expand Up @@ -344,24 +326,6 @@ variable "security_group_rules" {
})
)

validation {
error_message = "Security group rules can only have one of `icmp`, `udp`, or `tcp`."
condition = (var.security_group_rules == null || length(var.security_group_rules) == 0) ? true : length(distinct(
# Get flat list of results
flatten([
# Check through rules
for rule in var.security_group_rules :
# Return true if there is more than one of `icmp`, `udp`, or `tcp`
true if length(
[
for type in ["tcp", "udp", "icmp"] :
true if rule[type] != null
]
) > 1
])
)) == 0 # Checks for length. If all fields all correct, array will be empty
}

validation {
error_message = "Security group rule direction can only be `inbound` or `outbound`."
condition = (var.security_group_rules == null || length(var.security_group_rules) == 0) ? true : length(distinct(
Expand Down

0 comments on commit c604a85

Please sign in to comment.