Skip to content

Commit

Permalink
fix(*with_cidr): remove var.*_prefix_list_ids on *_with_cidr_blocks r…
Browse files Browse the repository at this point in the history
…esources
  • Loading branch information
titouan-joseph committed Jul 22, 2024
1 parent 20e107f commit 9a5ad84
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ resource "aws_security_group_rule" "ingress_with_cidr_blocks" {
join(",", var.ingress_cidr_blocks),
),
))
prefix_list_ids = var.ingress_prefix_list_ids

description = lookup(
var.ingress_with_cidr_blocks[count.index],
"description",
Expand All @@ -214,11 +214,13 @@ resource "aws_security_group_rule" "ingress_with_cidr_blocks" {
"from_port",
var.rules[lookup(var.ingress_with_cidr_blocks[count.index], "rule", "_")][0],
)

to_port = lookup(
var.ingress_with_cidr_blocks[count.index],
"to_port",
var.rules[lookup(var.ingress_with_cidr_blocks[count.index], "rule", "_")][1],
)

protocol = lookup(
var.ingress_with_cidr_blocks[count.index],
"protocol",
Expand All @@ -241,7 +243,7 @@ resource "aws_security_group_rule" "computed_ingress_with_cidr_blocks" {
join(",", var.ingress_cidr_blocks),
),
))
prefix_list_ids = var.ingress_prefix_list_ids

description = lookup(
var.computed_ingress_with_cidr_blocks[count.index],
"description",
Expand All @@ -257,6 +259,7 @@ resource "aws_security_group_rule" "computed_ingress_with_cidr_blocks" {
"_",
)][0],
)

to_port = lookup(
var.computed_ingress_with_cidr_blocks[count.index],
"to_port",
Expand All @@ -266,6 +269,7 @@ resource "aws_security_group_rule" "computed_ingress_with_cidr_blocks" {
"_",
)][1],
)

protocol = lookup(
var.computed_ingress_with_cidr_blocks[count.index],
"protocol",
Expand Down Expand Up @@ -639,7 +643,7 @@ resource "aws_security_group_rule" "egress_with_cidr_blocks" {
join(",", var.egress_cidr_blocks),
),
))
prefix_list_ids = var.egress_prefix_list_ids

description = lookup(
var.egress_with_cidr_blocks[count.index],
"description",
Expand All @@ -651,11 +655,13 @@ resource "aws_security_group_rule" "egress_with_cidr_blocks" {
"from_port",
var.rules[lookup(var.egress_with_cidr_blocks[count.index], "rule", "_")][0],
)

to_port = lookup(
var.egress_with_cidr_blocks[count.index],
"to_port",
var.rules[lookup(var.egress_with_cidr_blocks[count.index], "rule", "_")][1],
)

protocol = lookup(
var.egress_with_cidr_blocks[count.index],
"protocol",
Expand All @@ -678,7 +684,7 @@ resource "aws_security_group_rule" "computed_egress_with_cidr_blocks" {
join(",", var.egress_cidr_blocks),
),
))
prefix_list_ids = var.egress_prefix_list_ids

description = lookup(
var.computed_egress_with_cidr_blocks[count.index],
"description",
Expand All @@ -694,6 +700,7 @@ resource "aws_security_group_rule" "computed_egress_with_cidr_blocks" {
"_",
)][0],
)

to_port = lookup(
var.computed_egress_with_cidr_blocks[count.index],
"to_port",
Expand All @@ -703,6 +710,7 @@ resource "aws_security_group_rule" "computed_egress_with_cidr_blocks" {
"_",
)][1],
)

protocol = lookup(
var.computed_egress_with_cidr_blocks[count.index],
"protocol",
Expand Down

0 comments on commit 9a5ad84

Please sign in to comment.