Skip to content

Commit 200bae8

Browse files
authored
Fix tflint (#180)
1 parent 866e681 commit 200bae8

File tree

9 files changed

+25
-25
lines changed

9 files changed

+25
-25
lines changed

examples/existing-ips/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module "subnets" {
2929
vpc_id = module.vpc.vpc_id
3030
igw_id = [module.vpc.igw_id]
3131
ipv4_cidr_block = [module.vpc.vpc_cidr_block]
32-
nat_elastic_ips = aws_eip.nat_ips.*.public_ip
32+
nat_elastic_ips = aws_eip.nat_ips[*].public_ip
3333
nat_gateway_enabled = true
3434
nat_instance_enabled = false
3535

examples/existing-ips/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
output "existing_ips" {
22
description = "Elastic IP Addresses created by this module for use by NAT"
3-
value = aws_eip.nat_ips.*.public_ip
3+
value = aws_eip.nat_ips[*].public_ip
44
}
55

66
output "nat_ips" {

main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,11 @@ locals {
163163
)
164164

165165
create_public_route_tables = local.public_route_table_enabled && length(var.public_route_table_ids) == 0
166-
public_route_table_ids = local.create_public_route_tables ? aws_route_table.public.*.id : var.public_route_table_ids
166+
public_route_table_ids = local.create_public_route_tables ? aws_route_table.public[*].id : var.public_route_table_ids
167167

168168
private_route_table_enabled = local.private_enabled && var.private_route_table_enabled
169169
private_route_table_count = local.private_route_table_enabled ? local.subnet_az_count : 0
170-
private_route_table_ids = local.private_route_table_enabled ? aws_route_table.private.*.id : []
170+
private_route_table_ids = local.private_route_table_enabled ? aws_route_table.private[*].id : []
171171

172172
# public and private network ACLs
173173
# Support deprecated var.public_network_acl_id
@@ -199,7 +199,7 @@ locals {
199199
nat_enabled = local.nat_gateway_enabled || local.nat_instance_enabled
200200
need_nat_eips = local.nat_enabled && length(var.nat_elastic_ips) == 0
201201
need_nat_eip_data = local.nat_enabled && length(var.nat_elastic_ips) > 0
202-
nat_eip_allocations = local.nat_enabled ? (local.need_nat_eips ? aws_eip.default.*.id : data.aws_eip.nat.*.id) : []
202+
nat_eip_allocations = local.nat_enabled ? (local.need_nat_eips ? aws_eip.default[*].id : data.aws_eip.nat[*].id) : []
203203

204204
need_nat_ami_id = local.nat_instance_enabled && length(var.nat_instance_ami_id) == 0
205205
nat_instance_ami_id = local.need_nat_ami_id ? data.aws_ami.nat_instance[0].id : try(var.nat_instance_ami_id[0], "")

nat-gateway.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ resource "aws_route" "nat4" {
2929
count = local.nat_gateway_enabled && local.private4_enabled ? local.private_route_table_count : 0
3030

3131
route_table_id = local.private_route_table_ids[count.index]
32-
nat_gateway_id = element(aws_nat_gateway.default.*.id, count.index)
32+
nat_gateway_id = element(aws_nat_gateway.default[*].id, count.index)
3333
destination_cidr_block = "0.0.0.0/0"
3434
depends_on = [aws_route_table.private]
3535

@@ -45,7 +45,7 @@ resource "aws_route" "private_nat64" {
4545
count = local.nat_gateway_enabled && local.private_dns64_enabled ? local.private_route_table_count : 0
4646

4747
route_table_id = local.private_route_table_ids[count.index]
48-
nat_gateway_id = element(aws_nat_gateway.default.*.id, count.index)
48+
nat_gateway_id = element(aws_nat_gateway.default[*].id, count.index)
4949
destination_ipv6_cidr_block = local.nat64_cidr
5050
depends_on = [aws_route_table.private]
5151

@@ -61,7 +61,7 @@ resource "aws_route" "public_nat64" {
6161
count = local.nat_gateway_enabled && local.public_dns64_enabled ? local.public_route_table_count : 0
6262

6363
route_table_id = local.public_route_table_ids[count.index]
64-
nat_gateway_id = element(aws_nat_gateway.default.*.id, count.index)
64+
nat_gateway_id = element(aws_nat_gateway.default[*].id, count.index)
6565
destination_ipv6_cidr_block = local.nat64_cidr
6666
depends_on = [aws_route_table.public]
6767

nat-instance.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ resource "aws_security_group_rule" "nat_instance_egress" {
3434
to_port = 0
3535
protocol = "-1"
3636
cidr_blocks = ["0.0.0.0/0"] #tfsec:ignore:AWS007
37-
security_group_id = join("", aws_security_group.nat_instance.*.id)
37+
security_group_id = join("", aws_security_group.nat_instance[*].id)
3838
type = "egress"
3939
}
4040

@@ -46,7 +46,7 @@ resource "aws_security_group_rule" "nat_instance_ingress" {
4646
to_port = 0
4747
protocol = "-1"
4848
cidr_blocks = [local.base_ipv4_cidr_block]
49-
security_group_id = join("", aws_security_group.nat_instance.*.id)
49+
security_group_id = join("", aws_security_group.nat_instance[*].id)
5050
type = "ingress"
5151
}
5252

@@ -130,7 +130,7 @@ resource "aws_route" "nat_instance" {
130130
count = local.nat_instance_enabled ? local.private_route_table_count : 0
131131

132132
route_table_id = local.private_route_table_ids[count.index]
133-
network_interface_id = element(aws_instance.nat_instance.*.primary_network_interface_id, count.index)
133+
network_interface_id = element(aws_instance.nat_instance[*].primary_network_interface_id, count.index)
134134
destination_cidr_block = "0.0.0.0/0"
135135
depends_on = [aws_route_table.private]
136136

outputs-deprecated.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
output "nat_gateway_public_ips" {
22
description = "DEPRECATED: use `nat_ips` instead. Public IPv4 IP addresses in use by NAT."
3-
value = local.need_nat_eip_data ? var.nat_elastic_ips : aws_eip.default.*.public_ip
3+
value = local.need_nat_eip_data ? var.nat_elastic_ips : aws_eip.default[*].public_ip
44
}

outputs.tf

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,45 +12,45 @@ output "availability_zone_ids" {
1212

1313
output "public_subnet_ids" {
1414
description = "IDs of the created public subnets"
15-
value = aws_subnet.public.*.id
15+
value = aws_subnet.public[*].id
1616
}
1717

1818
output "private_subnet_ids" {
1919
description = "IDs of the created private subnets"
20-
value = aws_subnet.private.*.id
20+
value = aws_subnet.private[*].id
2121
}
2222

2323
# Provide some consistency in CDIR outputs by always returning a list.
2424
# Avoid (or at least reduce) `count` problems by toggling the return
2525
# value via configuration rather than computing it via `compact()`.
2626
output "public_subnet_cidrs" {
2727
description = "IPv4 CIDR blocks of the created public subnets"
28-
value = local.public4_enabled ? aws_subnet.public.*.cidr_block : []
28+
value = local.public4_enabled ? aws_subnet.public[*].cidr_block : []
2929
}
3030

3131
output "public_subnet_ipv6_cidrs" {
3232
description = "IPv6 CIDR blocks of the created public subnets"
33-
value = local.public6_enabled ? aws_subnet.public.*.ipv6_cidr_block : []
33+
value = local.public6_enabled ? aws_subnet.public[*].ipv6_cidr_block : []
3434
}
3535

3636
output "private_subnet_cidrs" {
3737
description = "IPv4 CIDR blocks of the created private subnets"
38-
value = local.private4_enabled ? aws_subnet.private.*.cidr_block : []
38+
value = local.private4_enabled ? aws_subnet.private[*].cidr_block : []
3939
}
4040

4141
output "private_subnet_ipv6_cidrs" {
4242
description = "IPv6 CIDR blocks of the created private subnets"
43-
value = local.private6_enabled ? aws_subnet.private.*.ipv6_cidr_block : []
43+
value = local.private6_enabled ? aws_subnet.private[*].ipv6_cidr_block : []
4444
}
4545

4646
output "public_route_table_ids" {
4747
description = "IDs of the created public route tables"
48-
value = aws_route_table.public.*.id
48+
value = aws_route_table.public[*].id
4949
}
5050

5151
output "private_route_table_ids" {
5252
description = "IDs of the created private route tables"
53-
value = aws_route_table.private.*.id
53+
value = aws_route_table.private[*].id
5454
}
5555

5656
output "public_network_acl_id" {
@@ -65,12 +65,12 @@ output "private_network_acl_id" {
6565

6666
output "nat_gateway_ids" {
6767
description = "IDs of the NAT Gateways created"
68-
value = aws_nat_gateway.default.*.id
68+
value = aws_nat_gateway.default[*].id
6969
}
7070

7171
output "nat_instance_ids" {
7272
description = "IDs of the NAT Instances created"
73-
value = aws_instance.nat_instance.*.id
73+
value = aws_instance.nat_instance[*].id
7474
}
7575

7676
output "nat_instance_ami_id" {
@@ -80,7 +80,7 @@ output "nat_instance_ami_id" {
8080

8181
output "nat_ips" {
8282
description = "Elastic IP Addresses in use by NAT"
83-
value = local.need_nat_eip_data ? var.nat_elastic_ips : aws_eip.default.*.public_ip
83+
value = local.need_nat_eip_data ? var.nat_elastic_ips : aws_eip.default[*].public_ip
8484
}
8585

8686
output "nat_eip_allocation_ids" {

private.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ resource "aws_network_acl" "private" {
8787
count = local.private_open_network_acl_enabled ? 1 : 0
8888

8989
vpc_id = local.vpc_id
90-
subnet_ids = aws_subnet.private.*.id
90+
subnet_ids = aws_subnet.private[*].id
9191

9292
tags = module.private_label.tags
9393
}

public.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ resource "aws_network_acl" "public" {
9898
count = local.public_open_network_acl_enabled ? 1 : 0
9999

100100
vpc_id = local.vpc_id
101-
subnet_ids = aws_subnet.public.*.id
101+
subnet_ids = aws_subnet.public[*].id
102102

103103
tags = module.public_label.tags
104104
}

0 commit comments

Comments
 (0)