DEV Community

Cover image for Terraform Dynamic Block
Cleber Rodrigues
Cleber Rodrigues

Posted on

Terraform Dynamic Block

Terraform Dynamic

Let's learn how to use and build expressions using the Dynamic Block, also combining the for_each and for

dynamic "tag" {
    for_each = {
      for key, value in var.append_custom_tags:
      key => lower(value)
      if key != "Project"
    }

    content {
      key                 = tag.key
      value               = tag.value
    }
  }
Enter fullscreen mode Exit fullscreen mode

Some topics on article:

  • What is Terraform Dynamic?
  • Where use Terraform Dynamic?
  • Terraform Dynamic Syntax
  • When not using Dynamic blocks

Enjoy learning! Read here.

Top comments (0)