Skip to content

Commit

Permalink
Public subnets is not required
Browse files Browse the repository at this point in the history
  • Loading branch information
AutomationD committed Aug 25, 2024
1 parent f025f35 commit b9ada9a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ resource "aws_instance" "this" {
vpc_security_group_ids = concat(var.ext_security_groups, [
aws_security_group.this.id
])
subnet_id = len(var.public_subnets) > 0 ? var.public_subnets[0] : var.private_subnets[0]
associate_public_ip_address = len(var.public_subnets) > 0 ? true : false
subnet_id = length(var.public_subnets) > 0 ? var.public_subnets[0] : var.private_subnets[0]
associate_public_ip_address = length(var.public_subnets) > 0 ? true : false
tags = merge({
Name = "${var.env}-${var.name}"
}, var.tags)
Expand Down

0 comments on commit b9ada9a

Please sign in to comment.