Skip to content

Commit d7866f6

Browse files
feat: Allow partial subnet naming
Allow the use of 'null' in the private_subnet_names list to trigger auto-naming for specific subnets. Closes #1239
1 parent 0eefe64 commit d7866f6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,10 @@ resource "aws_subnet" "private" {
281281

282282
tags = merge(
283283
{
284-
Name = try(
285-
var.private_subnet_names[count.index],
286-
format("${var.name}-${var.private_subnet_suffix}-%s", element(var.azs, count.index))
284+
Name = (
285+
try(var.private_subnet_names[count.index], null) != null
286+
? var.private_subnet_names[count.index]
287+
: format("${var.name}-${var.private_subnet_suffix}-%s", element(var.azs, count.index))
287288
)
288289
},
289290
var.tags,

0 commit comments

Comments
 (0)