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

Safely access index field #536

Merged
merged 1 commit into from
Jun 12, 2020
Merged

Safely access index field #536

merged 1 commit into from
Jun 12, 2020

Conversation

nmuesch
Copy link
Contributor

@nmuesch nmuesch commented Jun 11, 2020

The newly added indexes field to the log_stream widget schema was being directly accessed, this PR first checks if it exists, adding a safety layer to prevent panics.

Fixes #534

I was able to reproduce this by creating a dashboard with a logstream widget using the provider version 2.7.0 like so:

  title         = "Test Log Stream Dashboard"
  description   = "Created using the Datadog provider in Terraform"
  layout_type   = "free"
  is_read_only  = false

  widget {
    log_stream_definition {
      logset = "19"
      query = "error"
      columns = ["core_host", "core_service", "tag_source"]
    }
    layout = {
      height = 36
      width = 32
      x = 5
      y = 51
    }
  }
}

which leads to a terraform state not having indexes set. Then upgrading to 2.8.0 and running a terraform apply, which was trying to directly access this field and throwing an error on refreshing/reading existing resources.

@ghost ghost added the size/XS label Jun 11, 2020
@nmuesch nmuesch merged commit c18377d into DataDog:master Jun 12, 2020
@nmuesch nmuesch deleted the nick/logindex branch June 12, 2020 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GRPCProvider "invalid memory address or nil pointer dereference"
3 participants