Error on terraform plan "out of memory

[keskiviikko 20.19] Mishra Narsing (EXT)
terraform plan

runtime: out of memory: cannot allocate 4194304-byte block (1209696256 in use)

fatal error: out of memory

goroutine 10870 [running]:

runtime.throw({0x36a49fc, 0xd})

    /opt/hostedtoolcache/go/1.21.5/x64/src/runtime/panic.go:1077 +0x4d fp=0x6401d6d0 sp=0x6401d6bc pc=0x99d30d

runtime.(*mcache).allocLarge(0x7a502d8, 0x80000, 0x1)

    /opt/hostedtoolcache/go/1.21.5/x64/src/runtime/mcache.go:236 +0x1c5 fp=0x6401d6fc sp=0x6401d6d0 pc=0x977f05

runtime.mallocgc(0x80000, 0x0, 0x0)

    /opt/hostedtoolcache/go/1.21.5/x64/src/runtime/malloc.go:1127 +0x5bf fp=0x6401d750 sp=0x6401d6fc pc=0x96fa8f

runtime.growslice(0x0, 0x80000, 0x0, 0x80000, 0x31b5c80)

    /opt/hostedtoolcache/go/1.21.5/x64/src/runtime/slice.go:266 +0x3d1 fp=0x6401d784 sp=0x6401d750 pc=0x9b2c61

bytes.growSlice({0x7fbb0000, 0x3ffa6, 0x40000}, 0x71)

    /opt/hostedtoolcache/go/1.21.5/x64/src/bytes/buffer.go:249 +0x9e fp=0x6401d7c0 sp=0x6401d784 pc=0xa87dfe

bytes.(*Buffer).grow(0x6401d8b8, 0x71)

    /opt/hostedtoolcache/go/1.21.5/x64/src/bytes/buffer.go:151 +0x110 fp=0x6401d7e8 sp=0x6401d7c0 pc=0xa878b0

bytes.(*Buffer).WriteString(0x6401d8b8, {0x678ed180, 0x71})

    /opt/hostedtoolcache/go/1.21.5/x64/src/bytes/buffer.go:191 +0x4a fp=0x6401d7fc sp=0x6401d7e8 pc=0xa87b2a

github.com/hashicorp/terraform/internal/dag.(*Graph).StringWithNodeTypes(0x2813bb20)

    /home/runner/work/terraform/terraform/internal/dag/graph.go:294 +0x8db fp=0x6401da50 sp=0x6401d7fc pc=0xe14f1b

github.com/hashicorp/terraform/in
[keskiviikko 20.20] Mishra Narsing (EXT)
I dont know whats going on

Hi @nm7427,

The error shown is simply “out of memory”, meaning the host (or container) where Terraform is running does not have enough memory to complete the plan operation. Depending on Terraform version, a newer release may help somewhat, but unfortunately the only reliable resolution here is to give Terraform more memory.

The point at which this crashes may not actually be relevant, but if it is it could be indicative of a very large configuration, and a longer-term solution may be to split up the configuration into more manageable pieces.

I Have hashed every line from config file still it remains the same, I am executing on visual code installed on windows VDI with 24 gb ram.

With the information provided, there’s not much else I can recommend. The only thing we know from the output here is that the process ran out of memory. If the terraform binary is being run natively on windows, I would first try executing it directly rather than through VSCode.