---
title: "Discussion on \"Day 13: Conditional Expressions & Logic\" | Hashnode"
description: "Discussion on \"Day 13: Conditional Expressions & Logic\". Welcome to Day 13 - Today’s topic is a big one — Conditional Logic in Terraform.By the end of this lesson, you’ll be able to make your Terraform configurations smart, flexible, and environment-aware—meaning your infrastructure can automatically adjus..."
url: "https://hashnode.com/posts/day-13-conditional-expressions-and-logic/68f62b55d1b342e5bc20e581"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Day 13: Conditional Expressions & Logic](https://stackopsdiary.site/day-13-conditional-expressions-and-logic?utm_source=hashnode&utm_medium=feed)

Welcome to Day 13 - Today’s topic is a big one — Conditional Logic in Terraform.By the end of this lesson, you’ll be able to make your Terraform configurations smart, flexible, and environment-aware—meaning your infrastructure can automatically adjus...

Oct 20, 2025 · 13 min read · stackopsdiary.site  
Read the article

-   [#terraform](https://hashnode.com/tag/terraform)
-   [#aws](https://hashnode.com/tag/aws)
-   [#devops](https://hashnode.com/tag/devops)
-   [#iac](https://hashnode.com/tag/iac)

## Written by

[StackOps - Diary](https://hashnode.com/@stackops97)

@stackops97 · Yangon, Myanmar

  
[View profile](https://hashnode.com/@stackops97)

Linux, DevOps, Kubernetes, AWS

I'm a cloud-native enthusiast and tech blogger, sharing insights on Kubernetes, AWS, CI/CD, and Linux across my blog and Facebook page. Passionate about modern infrastructure and microservices, I aim to help others understand and leverage cloud-native technologies for scalable, efficient solutions.

## Responses 1

Markdown supported · ⌘↵ to post

[Thu Kha Kyawe](https://hashnode.com/@thukhakyawe)

[Oct 22, 2025](https://hashnode.com/posts/day-13-conditional-expressions-and-logic/68f62b55d1b342e5bc20e581/comment/68f8f1f68cbc7835c7541ef4)

Thank you! I see there is minor error.

Add the following EIP resource to your main.tf file, preferably before the NAT Gateway resource:

# Elastic IPs for NAT Gateways (conditional)

resource "aws\_eip" "nat" { count = local.create\_nat\_gateway ? local.az\_count : 0 domain = "vpc"

tags = { Name = "${var.project\_name}-${var.environment}-nat-eip-${count.index + 1}" } }

[StackOps - Diary](https://hashnode.com/@stackops97)

[Oct 22, 2025](https://hashnode.com/posts/day-13-conditional-expressions-and-logic/68f62b55d1b342e5bc20e581/comment/68f8f1f68cbc7835c7541ef4#reply-68f9030a19e954364288b3db)

Yes, you’re correct. I don’t know how I missed the EIP block. I really appreciate you pointing that out! 🫡
