-
Notifications
You must be signed in to change notification settings - Fork 186
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
runtime error: invalid memory address or nil pointer dereference (Mislabeled Resource Type) #90
Comments
Hmmm I think i am getting closer but still unable to determine the issue. It appears to be related to the fact that the resource is an Array |
Oh wait I got it... but not exactly sure of the details or if I am breaking anything else. To clarify, I added the following line here
If i understand correctly, this is a conditional statement that matches Resources and Data Types that are Index types. If that is true, then I dont know why all id that are no Index types still seem to process okay. At this point the graph did generate successfully. Maybe someone with more knowledge can look into what the proper solution could be as I am sure I am breaking many use cases. |
For anyone following, I still have yet to find a proper fix. I dont think the one listed above makes the correct change. My lack of understanding on the application architecture i think is preventing me from providing a proper PR to correct the issue. I have however been able to reproduce with the following code snippet.
This will create an array of Data resource types that will trigger the runtime error. The data resource can be commented out to see that the code base does work with a Resource type array. I have tried a few different iterations of fixing this but nothing seems to be perfect. The graph generates successfully but the mapping is all off. Hopefully with the ability to reproduce now someone can help out. |
Hey @jlestrada , I'll check this out a bit later. Thanks for the thorough documentation :) . |
I'm also getting a stack trace but it looks quite different from the one posted here.
I'm on Rover version The above crash is also happening when I run just |
@nonbeing the stacktrace appears to be failing in a different portion of the PopulateModuleState function. I agree that i believe this is a different issue. You can attempt to pull the latest source and build locally to test what changes fixed the above mentioned issue. The 0.3.0 release does not contain my proposed fixed for Data source array runtime error. If you can define a way to reproduce i think that greatly helps to figure out the issue. |
I'll check this out a bit later today. Thanks for reporting! |
Hey @nonbeing , make sure you're on the most recent 3.0 version. I'm pretty sure this is something on your end -- the thrown line in your stacktrace (rso.go:219) is blank. Also @jlestrada , I believe @im2nguyen merged your PR and re-released rover with the modified block. I think this issue should probably be closed. |
I encountered the same issue as mentioned by @nonbeing, I haven't installed rover rather I'm using "docker run --rm -it -p 9000:9000 -v $(pwd):/src im2nguyen/rover" command. Status: Downloaded newer image for im2nguyen/rover:latest goroutine 1 [running]: I'm on terraform v1.1.2 |
@Yashfork What's the general structure of the terraform configuration you're applying? |
@JackFlukinger To setup landingzone in GCP I'm trying to visualize 0-bootstrap through rover https://github.com/terraform-google-modules/terraform-example-foundation/tree/master/0-bootstrap |
FYI: I'm able to create plan and can visualize it through Terraform visual but facing issues with Rover |
@Yashfork I'll have a look in more detail tomorrow, thanks for reporting! |
I am indeed on the latest version of Rover:
I am using Terraform The crash is 100% reproducible at my end. I tried running Rover used to work just fine a while ago (perhaps 4 months ago) for my admittedly-complex AWS TF state. I just updated to v0.3.0 and it's crashing constantly now. Just another data point, I tried running rover v0.2.1 on my TF state and it doesn't work right now (like it used to) but at least it doesn't crash/panic either:
|
@nonbeing What is line rso.go:219 from your local installation? Also, rover 0.2.1 isn't compatible with Terraform 1.1.5 -- if you downgrade to Terraform 1.1.0 it should work. |
I'm using the rover v0.3.0 binary for my platform. I downloaded the I'm not a Golang programmer, just an end-user of Rover. However, I looked at the source code zip for the same
So I guess rso.go:219 is |
@nonbeing Oh this is very helpful, I'll have a fix later today. 🙂 |
Experiencing the same issue with a fairly large AWS-based TF state. Hopefully similar issue:
|
Hey @casey-robertson-paypal , @nonbeing , @Yashfork , could one of you test the PR I just submitted? I haven't been able to replicate the issue locally but I'm fairly certain that should resolve it. Sorry about the confusion earlier, my local repo was weirdly out-of-sync. If you could follow the build from source section with my PR and then run rover on your plan, I would really appreciate it :) |
@JackFlukinger Thanks for looking into this and the speedy PR! I don't have a Golang dev-setup so I can't build from source. If you could share a binary for "darwin_amd64" somewhere, I would be happy to test it against my TF state. |
Hey @nonbeing , here you go https://file.io/LvPgsOBGGqi9 |
@JackFlukinger It's working now! 🎉🎊 |
@nonbeing Out of curiosity, what are the resources outside of the purple background? That may not be intended behavior. Could you send a higher-resolution image? Or an SVG using |
Sure, here's the SVG: https://file.io/YJrw7hJXmSEp |
Okay @nonbeing , definitely not intended. Where is the |
@JackFlukinger It is working now! I tried creating a docker image manually and it is working fine. Thanks for the quick fix :) |
@JackFlukinger I've created a new bug to discuss the issue with the visualization since (I guess) it's unrelated to the panic/crash that you fixed here. Can we take the conversation around |
Posting this for now as I continue to debug, but maybe others are seeing similar issues.
Overview: Runtime error when attempting to generate graph from provided plan that points to an invalid memory address reference. Upon further debugging, it appears to be related to a Data source type being labeled as a Resource source type. At the moment I am unsure of how to reproduce.
Release Version: 3.0
ERROR Message:
Additional Context:
From what I gather and understand, it appears that my generated Terraform Plan is causing a runtime error due to a resource being mislabeled. I believe that a Data source is being labeled as a Resource type and thus causing the error.
This error is happening during the generating of the resource map where it appears to be setting the file Name of the resource as well as its line number (code link). To help deep dive into the issue a bit more I modified the code locally which is described by the following code block.
note: forgive my naming of things in advance. I am somewhat confused still about the difference between
states
andconfigs
.The following output here shows a bit more whats going on.
First thing to note here that is worth calling out, there is a 3 depth module call in play. I don't think that matters but maybe it does. It can be seen here at the resource address
module.atlantis_v2.module.ecs_service.module.alb_routing.data.aws_route53_zone.public
is being labeled as aResource
as opposed toData
. The log further down confirms that the Parent module does not contain a resource for hosted zone. The odd thing here is that the resource prior is very similar, but is treated correctly as aData
type. It has an almost identical path to the impacted resource address.At the moment I cannot immediately tell how this type is being set because I assume that is where the problem is located or will at least tell us more information about it. FWIW this is a runtime error that is happening when allowing rover to execute the Terraform Plan as well.
I will keep digging into this but if others see anything similar or have some tips help is appreciated.
The text was updated successfully, but these errors were encountered: