Skip to content

Commit 210b713

Browse files
committed
chore: changing the name of the fields from inbound_rules -> inbound
1 parent b40427d commit 210b713

File tree

6 files changed

+25
-25
lines changed

6 files changed

+25
-25
lines changed

examples/nacls/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module "vpc" {
2626

2727
nacl_rules = {
2828
private = {
29-
inbound_rules = [
29+
inbound = [
3030
{
3131
cidr_block = "10.100.0.0/24"
3232
from_port = 22
@@ -36,7 +36,7 @@ module "vpc" {
3636
rule_number = 50
3737
}
3838
]
39-
outbound_rules = [
39+
outbound = [
4040
{
4141
cidr_block = "10.100.0.0/24"
4242
from_port = 22

main.tf

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ module "nacls" {
2222
for_each = var.nacl_rules
2323
source = "./modules/nacls"
2424

25-
inbound_rules = var.nacl_rules[each.key].inbound_rules
26-
name = each.key
27-
outbound_rules = var.nacl_rules[each.key].outbound_rules
28-
subnet_count = var.availability_zones
29-
subnet_ids = local.all_subnets_by_name[each.key].ids
30-
tags = local.tags
31-
vpc_id = module.vpc.vpc_attributes.id
25+
inbound = var.nacl_rules[each.key].inbound
26+
name = each.key
27+
outbound = var.nacl_rules[each.key].outbound
28+
subnet_count = var.availability_zones
29+
subnet_ids = local.all_subnets_by_name[each.key].ids
30+
tags = local.tags
31+
vpc_id = module.vpc.vpc_attributes.id
3232

3333
depends_on = [module.vpc]
3434
}

modules/nacls/locals.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
locals {
22
inbound = merge([
33
for idx in range(var.subnet_count) : {
4-
for rule_idx, rule in try(var.inbound_rules, []) :
4+
for rule_idx, rule in try(var.inbound, []) :
55
"${idx}-${rule_idx}" => {
66
id = var.subnet_ids[idx]
77
rule = rule
@@ -11,7 +11,7 @@ locals {
1111

1212
outbound = merge([
1313
for idx in range(var.subnet_count) : {
14-
for rule_idx, rule in try(var.outbound_rules, []) :
14+
for rule_idx, rule in try(var.outbound, []) :
1515
"${idx}-${rule_idx}" => {
1616
id = var.subnet_ids[idx]
1717
rule = rule

modules/nacls/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ variable "subnet_ids" {
1919
type = list(string)
2020
}
2121

22-
variable "inbound_rules" {
22+
variable "inbound" {
2323
description = "The inbound rules to apply to the NACL"
2424
type = list(object({
2525
cidr_block = string
@@ -35,7 +35,7 @@ variable "inbound_rules" {
3535
default = []
3636
}
3737

38-
variable "outbound_rules" {
38+
variable "outbound" {
3939
description = "The outbound rules to apply to the NACL"
4040
type = list(object({
4141
cidr_block = string

tests/nacls.tftest.hcl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ run "check_nacl" {
3030

3131
nacl_rules = {
3232
private = {
33-
inbound_rules = [
33+
inbound = [
3434
{
3535
cidr_block = "10.100.0.0/24"
3636
from_port = 22
@@ -40,7 +40,7 @@ run "check_nacl" {
4040
rule_number = 100
4141
}
4242
]
43-
outbound_rules = [
43+
outbound = [
4444
{
4545
cidr_block = "10.100.0.0/24"
4646
from_port = 22
@@ -79,7 +79,7 @@ run "check_nacl_rules" {
7979
vpc_id = "vpc-1234567890"
8080
subnet_count = 3
8181
subnet_ids = ["subnet-1234567890", "subnet-1234567891", "subnet-1234567892"]
82-
inbound_rules = [
82+
inbound = [
8383
{
8484
cidr_block = "10.100.0.0/24"
8585
from_port = 22
@@ -89,7 +89,7 @@ run "check_nacl_rules" {
8989
rule_number = 100
9090
}
9191
]
92-
outbound_rules = [
92+
outbound = [
9393
{
9494
cidr_block = "10.100.0.0/24"
9595
from_port = 22

variables.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,27 +162,27 @@ variable "transit_subnet_tags" {
162162
variable "nacl_rules" {
163163
description = "Map of NACL rules to apply to different subnet types. Each rule requires from_port, to_port, protocol, rule_action, cidr_block, and rule_number"
164164
type = map(object({
165-
inbound_rules = list(object({
165+
inbound = list(object({
166166
cidr_block = string
167-
from_port = number
167+
from_port = optional(number, null)
168168
icmp_code = optional(number, 0)
169169
icmp_type = optional(number, 0)
170170
ipv6_cidr_block = optional(string, null)
171171
protocol = optional(number, -1)
172-
rule_action = string
172+
rule_action = optional(string, "allow")
173173
rule_number = number
174-
to_port = number
174+
to_port = optional(number, null)
175175
}))
176-
outbound_rules = list(object({
176+
outbound = list(object({
177177
cidr_block = string
178-
from_port = number
178+
from_port = optional(number, null)
179179
icmp_code = optional(number, 0)
180180
icmp_type = optional(number, 0)
181181
ipv6_cidr_block = optional(string, null)
182182
protocol = optional(number, -1)
183-
rule_action = string
183+
rule_action = optional(string, "allow")
184184
rule_number = number
185-
to_port = number
185+
to_port = optional(number, null)
186186
}))
187187
}))
188188
default = {}

0 commit comments

Comments
 (0)