Skip to content

Commit

Permalink
Add check for Environment proto field before accessing in Dataflow pr…
Browse files Browse the repository at this point in the history
…ovider (#10016) (#17344)

[upstream:6aba2a9bda474112d1d59bf0b8e7b627afb2ee7a]

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Feb 21, 2024
1 parent 014622d commit 938a8d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
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/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

0 comments on commit 938a8d9

Please sign in to comment.