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

Add check for Environment proto field before accessing in Dataflow provider #6999

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/10016.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
dataflow: fixes potential nil-pointer error if a job's Environment field is nil when reading job information in `google_dataflow_job`
```
3 changes: 3 additions & 0 deletions google-beta/services/dataflow/resource_dataflow_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ func resourceDataflowJobRead(d *schema.ResourceData, meta interface{}) error {
if err := d.Set("effective_labels", job.Labels); err != nil {
return fmt.Errorf("Error setting effective_labels: %s", err)
}
if job.Environment == nil {
return fmt.Errorf("Error accessing Environment proto: proto is nil")
}
if err := d.Set("kms_key_name", job.Environment.ServiceKmsKeyName); err != nil {
return fmt.Errorf("Error setting kms_key_name: %s", err)
}
Expand Down
Loading