Dynamic and static resource in one module

Hello,
I am trying to put in place a CloudFront module that contains some basic origin and cache behaviour but I still want to be able to add more dynamic origins and cache behaviours.For example:

dynamic "origin" {
...
}

origin {
...
}

dynamic "ordered_cache_behavior" {
...
}

ordered_cache_behavior {
...
}

When I try to apply the mentioned above configurations, I am getting error The argument "origin.<the last specified origin in the origins list>.domain_name" is required, but no definition was found. It is like the combination of dynamic and static resource messes up the Index of the iterator in the dynamic block.

After I removed the static origin block and left only the dynamic ones - everything was okay.

Has anyone experienced such issue or is it possible to have both dynamic and static block of a same attribute at all?

Best regards,
Vladislav

Hi @vlado_l94l,

It’s hard to say what could be happening here without a more complete reproduction. Can you supply an example config which exhibits the problem, and are you using the latest Terraform release?