github.com/hugorut/terraform@v1.1.3/src/terraform/testdata/validate-bad-resource-count/main.tf (about)

     1  // a resource named "aws_security_groups" does not exist in the schema
     2  variable "sg_ports" {
     3    type        = list(number)
     4    description = "List of ingress ports"
     5    default     = [8200, 8201, 8300, 9200, 9500]
     6  }
     7  
     8  
     9  resource "aws_security_groups" "dynamicsg" {
    10    name        = "dynamicsg"
    11    description = "Ingress for Vault"
    12  
    13    dynamic "ingress" {
    14      for_each = var.sg_ports
    15      content {
    16        from_port   = ingress.value
    17        to_port     = ingress.value
    18        protocol    = "tcp"
    19        cidr_blocks = ["0.0.0.0/0"]
    20      }
    21    }
    22  }