github.com/opentofu/opentofu@v1.7.1/internal/lang/globalref/testdata/assorted/assorted-root.tf (about)

     1  locals {
     2    a = "hello world"
     3    b = 2
     4    single = test_thing.single.id
     5  }
     6  
     7  resource "test_thing" "single" {
     8    string = local.a
     9    number = local.b
    10  
    11  }
    12  
    13  resource "test_thing" "for_each" {
    14    for_each = {"q": local.a}
    15  
    16    string = local.a
    17  
    18    single {
    19      z = test_thing.single.string
    20    }
    21  }
    22  
    23  resource "test_thing" "count" {
    24    for_each = length(local.a)
    25  
    26    string = local.a
    27  }
    28  
    29  module "single" {
    30    source = "./child"
    31  
    32    a = test_thing.single
    33  }
    34  
    35  module "for_each" {
    36    source   = "./child"
    37    for_each = {"q": test_thing.single}
    38  
    39    a = test_thing.single
    40  }
    41  
    42  module "count" {
    43    source = "./child"
    44    count  = length(test_thing.single.string)
    45  
    46    a = test_thing.single
    47  }