question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Access network_interface generates an error

See original GitHub issue

cdktf & Language Versions

cdktf version: 0.10.1 language: python

Affected Resource(s)

Access instance details

  #Query a GCP Image filtered by Family        
        gcp_image = DataGoogleComputeImage(self, id = "windows_image", family = "windows-2019", project="windows-cloud" )

        #Get the network interface
        net_int = ComputeInstanceNetworkInterface(subnetwork ="<SUBNETWORK>",subnetwork_project = "<SHARED-PROJECT>")

        #Create a new vm
        instance = ComputeInstance(self,id = "sample-vm", machine_type="e2-standard-4", name="cdktf-instance-1", 
                        boot_disk= ComputeInstanceBootDisk(initialize_params=ComputeInstanceBootDiskInitializeParams(image=gcp_image.name)),
                        network_interface=[net_int], zone= "us-east4-a"
        )

        #Output 
        TerraformOutput(self, "instance_ip", instance.network_interface[0].network_ip)

Debug Output

    Traceback (most recent call last):
      File "/Users/user/terraform-learning/cdktf-gcp/gcp/main.py", line 37, in <module>
        GcpBasicVmStack(app, "gcp")
      File "/Users/user/.local/share/virtualenvs/gcp-XHqyQSdy/lib/python3.9/site-packages/jsii/_runtime.py", line 86, in __call__
        inst = super().__call__(*args, **kwargs)
      File "/Users/user/terraform-learning/cdktf-gcp/gcp/main.py", line 34, in __init__
        TerraformOutput(self, "instance_ip", instance.network_interface[0].network_ip)
    TypeError: 'InterfaceDynamicProxy' object is not subscriptable

Expected Behavior

Should be able to retrieve the instance ip in the output

Actual Behavior

Exception

Steps to Reproduce

Important Factoids

References

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jsteinichcommented, Apr 13, 2022

@jsteinich do we already have another issue that is tracking the work required for this to function without the need for a workaround?

#25 or #1610 should cover it.

0reactions
github-actions[bot]commented, Nov 27, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve network interface provision errors for Amazon ECS ...
I want to resolve network interface provision errors for Amazon Elastic Container Service (Amazon ECS) on AWS Fargate.
Read more >
NetworkInterface.GetAllNetworkInterfaces() causes System ...
GetAllNetworkInterfaces() . The above line causes System.Security Exception. The complete exception message says: [Request for the permission of ...
Read more >
Wireshark 'no interfaces found' error explained - Comparitech
Interface error caused by access permissions​​ When Wireshark reports that it cannot find any “interfaces”, it means that it could not detect any ......
Read more >
An error has occurred while trying to create a virtualbox host ...
If it still does not work, make sure that all the Host-only interface are enabled: · Go to Settings > Network & Internet...
Read more >
Method: instances.updateNetworkInterface | Compute Engine ...
The reason of the error. This is a constant value that identifies the proximate cause of the error. Error reasons are unique within...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found