Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csharp: Amazon.JSII.Runtime.JsiiException Expected a boolean, got "a" (string) #960

Closed
rgl opened this issue Sep 8, 2021 · 4 comments
Closed
Labels
bug Something isn't working feature/tokens priority/important-soon High priority, to be worked on as part of our current release or the following one.
Milestone

Comments

@rgl
Copy link

rgl commented Sep 8, 2021

Community Note

  • 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

cdktf & Language Versions

cdktf 0.5.0
csharp 3.1/5.0

Affected Resource(s)

vsphere_virtual_machine

Expected Behavior

It should have used a bool.

Actual Behavior

It converted the bool to a string.

Steps to Reproduce

Using the code from https://github.com/rgl/dotnet-terraform-cdk-vsphere-ubuntu-example/blob/main/Main.cs#L134-L141 which is something alike;

            new VirtualMachine(this, name, new VirtualMachineConfig
            {
                Disk = new[]
                {
                    new VirtualMachineDisk
                    {
                        UnitNumber = 0,
                        Label = "os",
                        Size = Math.Max(ubuntuTemplate.Disks("0").Size, vmDiskOsSize),
                        EagerlyScrub = ubuntuTemplate.Disks("0").EagerlyScrub,
                        ThinProvisioned = ubuntuTemplate.Disks("0").ThinProvisioned,
                    },

Execute the stack with cdktf diff.

This is the error I get:

vagrant@ubuntu:~/dotnet-terraform-cdk-vsphere-ubuntu-example$ npx cdktf diff⠸ synthesizing...
[2021-09-08T18:25:11.944] [ERROR] default - Unhandled exception.
[2021-09-08T18:25:11.946] [ERROR] default -  
[2021-09-08T18:25:11.961] [ERROR] default - Amazon.JSII.Runtime.JsiiException: Expected a boolean, got "${data.vsphere_virtual_machine.ubuntu_template.disks.0.eagerly_scrub}" (string)
   at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
   at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
   at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
   at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
   at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
   at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
   at Amazon.JSII.Runtime.Services.Client.Get(GetRequest request)
   at Amazon.JSII.Runtime.Services.Client.Get(ObjectReference objectReference, String property)
   at Amazon.JSII.Runtime.Deputy.DeputyBase.<>c__DisplayClass9_0`1.<GetInstanceProperty>b__0(IClient client)
   at Amazon.JSII.Runtime.Deputy.DeputyBase.GetPropertyCore[T](JsiiPropertyAttribute propertyAttribute, Func`2 getFunc)
   at Amazon.JSII.Runtime.Deputy.DeputyBase.GetInstanceProperty[T](String propertyName)
   at vsphere.DataVsphereVirtualMachineDisks.get_EagerlyScrub() in /home/vagrant/dotnet-terraform-cdk-vsphere-ubuntu-example/.gen/vsphere/vsphere/DataVsphereVirtualMachineDisks.cs:line 34
   at ExampleStack.<>c__DisplayClass0_0.<.ctor>b__0(String name, Int32 memory) in /home/vagrant/dotnet-terraform-cdk-vsphere-ubuntu-example/Main.cs:line 120
   at ExampleStack.<>c__DisplayClass0_0.<.ctor>b__1(Int32 index) in /home/vagrant/dotnet-terraform-cdk-vsphere-ubuntu-example/Main.cs:line 176
   at System.Linq.Enumerable.SelectRangeIterator`1.ToList()
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at ExampleStack..ctor(Construct scope, String id) in /home/vagrant/dotnet-terraform-cdk-vsphere-ubuntu-example/Main.cs:line 175
   at ExampleStack.Main(String[] args) in /home/vagrant/dotnet-terraform-cdk-vsphere-ubuntu-example/Main.cs:line 183
[2021-09-08T18:25:11.962] [ERROR] default - 
cdktf encountered an error while synthesizing

Synth command: dotnet run -p Example.csproj
Error:         non-zero exit code 134

Command output on stderr:

    Unhandled exception. Amazon.JSII.Runtime.JsiiException: Expected a boolean, got "${data.vsphere_virtual_machine.ubuntu_template.disks.0.eagerly_scrub}" (string)
       at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
       at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
       at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
       at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
       at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
       at Amazon.JSII.Runtime.Services.Client.Send[TRequest,TResponse](TRequest requestObject)
       at Amazon.JSII.Runtime.Services.Client.Get(GetRequest request)
       at Amazon.JSII.Runtime.Services.Client.Get(ObjectReference objectReference, String property)
       at Amazon.JSII.Runtime.Deputy.DeputyBase.<>c__DisplayClass9_0`1.<GetInstanceProperty>b__0(IClient client)
       at Amazon.JSII.Runtime.Deputy.DeputyBase.GetPropertyCore[T](JsiiPropertyAttribute propertyAttribute, Func`2 getFunc)
       at Amazon.JSII.Runtime.Deputy.DeputyBase.GetInstanceProperty[T](String propertyName)
       at vsphere.DataVsphereVirtualMachineDisks.get_EagerlyScrub() in /home/vagrant/dotnet-terraform-cdk-vsphere-ubuntu-example/.gen/vsphere/vsphere/DataVsphereVirtualMachineDisks.cs:line 34
       at ExampleStack.<>c__DisplayClass0_0.<.ctor>b__0(String name, Int32 memory) in /home/vagrant/dotnet-terraform-cdk-vsphere-ubuntu-example/Main.cs:line 120
       at ExampleStack.<>c__DisplayClass0_0.<.ctor>b__1(Int32 index) in /home/vagrant/dotnet-terraform-cdk-vsphere-ubuntu-example/Main.cs:line 176
       at System.Linq.Enumerable.SelectRangeIterator`1.ToList()
       at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
       at ExampleStack..ctor(Construct scope, String id) in /home/vagrant/dotnet-terraform-cdk-vsphere-ubuntu-example/Main.cs:line 175
       at ExampleStack.Main(String[] args) in /home/vagrant/dotnet-terraform-cdk-vsphere-ubuntu-example/Main.cs:line 183
@rgl rgl added bug Something isn't working new Un-triaged issue labels Sep 8, 2021
@jsteinich
Copy link
Collaborator

This is something that is being actively worked on. It's part of a large internal topic (#525) so it's been taking awhile, but we hope to have a resolution in the next release.

@jsteinich jsteinich added feature/tokens priority/important-soon High priority, to be worked on as part of our current release or the following one. and removed new Un-triaged issue labels Sep 9, 2021
@jsteinich
Copy link
Collaborator

Using an escape hatch it should be possible to workaround in the meantime.

@danieldreier danieldreier added this to the 0.8 (in planning) milestone Sep 27, 2021
@DanielMSchmidt
Copy link
Contributor

Thank you @rgl for linking such a great example! I was able verify that this problem does not exist anymore in the current version. I created an abbreviated example here: https://github.com/hashicorp/terraform-cdk/compare/verify-boolean-references-work
It compiles properly and sets all the references as we expect them to 👍

@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2022

I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working feature/tokens priority/important-soon High priority, to be worked on as part of our current release or the following one.
Projects
None yet
Development

No branches or pull requests

4 participants