I have started using this 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"
})
})
}
}
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.
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment
Description
I have started using this 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:
And that fails with:
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.
Versions
cdktf debug
output:Providers
No response
Gist
No response
Possible Solutions
No response
Workarounds
No response
Anything Else?
No response
References
No response
Help Wanted
Community Note