Trying to use an object as TFModuleVariable fails on synthetizing

Hi there! :slight_smile:

I have started using the cdktf-tf-module-stack project to build a module with CDKTF.

I have set up a CDKTF project which uses the CDKTF Module and it works fine with a basic test, even passing a variable with a TFModuleVariable.

Now I want to do a more complex use case, that would involve having a TFModuleVariable which would be a complex object. Then I want to loop over it, and that is what fails. My current CDKTF module code looks like this:

class GitHubModule extends TFModuleStack {
  constructor(scope: Construct, id: string) {
    super(scope, id);

    new ProviderRequirement(this, "github", "6.0.0", "integrations/github")

    const memberships = new TFModuleVariable(this, "memberships", {
      description: "Admin and members of the organization",
      default: {
        admins: ["fake"],
        members: ["fake"]
      }
    })

    memberships.value.admins.forEach(function(user: string) {
      new Membership(scope, `github-membership-${user}", {
        username: user,
        role: "admin"
      })
    })
  }
}

And that fails with:

[ERROR] default - TypeError: Cannot read properties of undefined (reading โ€˜forEachโ€™)

I understand that, at synth time the content is undefined and therefore it fails. But then, this does not allow to pass dynamic configurations like this? I tried adding default values so that it could have some value, but it still failed.

Thanks a lot in advance! :slight_smile:
Fran