diff --git a/.go-version b/.go-version index 8a78acf..038051d 100644 --- a/.go-version +++ b/.go-version @@ -1,2 +1,2 @@ -1.91.1 +1.91.2 diff --git a/client/event_query.go b/client/event_query.go index 2614c07..04792a4 100644 --- a/client/event_query.go +++ b/client/event_query.go @@ -60,12 +60,13 @@ func (c *Client) UpdateEventQuery(ctx context.Context, projectName string, event resp Envelope ) - bytes, err := json.Marshal(attributes) + body := WireEventQueryAttributes{Attributes: attributes} + bytes, err := json.Marshal(body) if err != nil { return event, err } if err := c.CallAPI(ctx, "PUT", - fmt.Sprintf("projects/%v/event_queries/%v", eventQueryID, projectName), bytes, &resp); err != nil { + fmt.Sprintf("projects/%v/event_queries/%v", projectName, eventQueryID), Envelope{Data: bytes}, &resp); err != nil { return nil, err } err = json.Unmarshal(resp.Data, &event) diff --git a/lightstep/resource_event_query_test.go b/lightstep/resource_event_query_test.go index aa6bf41..85358e3 100644 --- a/lightstep/resource_event_query_test.go +++ b/lightstep/resource_event_query_test.go @@ -20,6 +20,16 @@ resource "lightstep_event_query" "terraform" { source = "test-source" query_string = "logs" } +` + + updatedEventQueryConfig := ` +resource "lightstep_event_query" "terraform" { + project_name = "` + testProject + `" + name = "updated name" + type = "test-type" + source = "test-source" + query_string = "logs | filter foo == bar" +} ` resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -36,6 +46,16 @@ resource "lightstep_event_query" "terraform" { resource.TestCheckResourceAttr("lightstep_event_query.terraform", "query_string", "logs"), ), }, + { + Config: updatedEventQueryConfig, + Check: resource.ComposeTestCheckFunc( + testAccCheckEventQueryExists("lightstep_event_query.terraform", &eventQuery), + resource.TestCheckResourceAttr("lightstep_event_query.terraform", "name", "updated name"), + resource.TestCheckResourceAttr("lightstep_event_query.terraform", "type", "test-type"), + resource.TestCheckResourceAttr("lightstep_event_query.terraform", "source", "test-source"), + resource.TestCheckResourceAttr("lightstep_event_query.terraform", "query_string", "logs | filter foo == bar"), + ), + }, }, })