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

google_dataproc_job panic in flatten/expand #11212

Closed
tejavar opened this issue Mar 3, 2022 · 3 comments · Fixed by GoogleCloudPlatform/magic-modules#5817, #11280 or hashicorp/terraform-provider-google-beta#4124
Assignees

Comments

@tejavar
Copy link

tejavar commented Mar 3, 2022

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 me too comments, 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.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

TF v1.0.3
google v4.11.0
google-beta 4.11.0

Affected Resource(s)

google_dataproc_job

Terraform Configuration Files

# Copy-paste your Terraform configurations here.
#
# For large Terraform configs, please use a service like Dropbox and share a link to the ZIP file.
# For security, you can also encrypt the files using our GPG public key:
#    https://www.hashicorp.com/security
#
# If reproducing the bug involves modifying the config file (e.g., apply a config,
# change a value, apply the config again, see the bug), then please include both:
# * the version of the config before the change, and
# * the version of the config after the change.

Debug Output

This happens in the dataproc job and also in the workflow template, in both expand and flatten function for, for example, the logging config.

In short, providers shouldn't crash for any reason, but in this case it looks like the provider is struggling with what the service could be sending back. The issue is presenting itself in similar ways in other resources (this is -beta):

#10280

What we know from the error is that:

panic: interface conversion: interface {} is nil, not map[string]interface {}

The provider is expecting there to be a map of strings and found nothing. That happens here, in code that hasn't been modified in 4 years:

https://github.com/hashicorp/terraform-provider-google/blame/master/google/utils.go#L323

What this code tells us is that there is an m[0], but the contents of m[0] is nil. That call is coming from here, in code that again hasn't been modified in 4 years:

https://github.com/hashicorp/terraform-provider-google/blame/master/google/resource_dataproc_job.go#L541

What this tells us is that it pertains to the logging_config argument to the resource. The implication is that there is a logging config, but it's empty and therefore producing nil.

They might be able to work around this by changing the value of their logging_config argument in the resource configuration.

Panic Output

Expected Behavior

The short version is that there appears to be a code generation issue in the google provider where an array/slice is checked for one entry (length == 0), and, if there is one, it is accessed. However, the entry is nil so the provider panics.

Actual Behavior

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000
@tejavar tejavar added the bug label Mar 3, 2022
@github-actions github-actions bot added the crash label Mar 3, 2022
@megan07
Copy link
Contributor

megan07 commented Mar 3, 2022

From a quick triage I think we can just change this line to be
if len(m) == 0 || m[0] == nil {

I was able to repro the issue by changing this block to be

logging_config {
  driver_log_levels = {}
}

haven't tested the change, but did a bit of triage.

@slevenick
Copy link
Collaborator

Closing this as it should be fixed by the linked PRs

@github-actions
Copy link

github-actions bot commented Apr 8, 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 have 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 Apr 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.