Skip to content

Commit 68a8c54

Browse files
update description (#5416) (#10493)
Signed-off-by: Modular Magician <[email protected]>
1 parent 2e10392 commit 68a8c54

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

.changelog/5416.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
logging: fixed a bug with updating `description` on `google_logging_project_sink`, `google_logging_folder_sink` and `google_logging_organization_sink`
3+
```

google/resource_logging_project_sink_test.go

+50
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,37 @@ func TestAccLoggingProjectSink_described(t *testing.T) {
5454
})
5555
}
5656

57+
func TestAccLoggingProjectSink_described_update(t *testing.T) {
58+
t.Parallel()
59+
60+
sinkName := "tf-test-sink-" + randString(t, 10)
61+
bucketName := "tf-test-sink-bucket-" + randString(t, 10)
62+
63+
vcrTest(t, resource.TestCase{
64+
PreCheck: func() { testAccPreCheck(t) },
65+
Providers: testAccProviders,
66+
CheckDestroy: testAccCheckLoggingProjectSinkDestroyProducer(t),
67+
Steps: []resource.TestStep{
68+
{
69+
Config: testAccLoggingProjectSink_described(sinkName, getTestProjectFromEnv(), bucketName),
70+
},
71+
{
72+
ResourceName: "google_logging_project_sink.described",
73+
ImportState: true,
74+
ImportStateVerify: true,
75+
},
76+
{
77+
Config: testAccLoggingProjectSink_described_update(sinkName, getTestProjectFromEnv(), bucketName),
78+
},
79+
{
80+
ResourceName: "google_logging_project_sink.described",
81+
ImportState: true,
82+
ImportStateVerify: true,
83+
},
84+
},
85+
})
86+
}
87+
5788
func TestAccLoggingProjectSink_disabled(t *testing.T) {
5889
t.Parallel()
5990

@@ -347,6 +378,25 @@ resource "google_storage_bucket" "log-bucket" {
347378
`, name, project, project, bucketName)
348379
}
349380

381+
func testAccLoggingProjectSink_described_update(name, project, bucketName string) string {
382+
return fmt.Sprintf(`
383+
resource "google_logging_project_sink" "described" {
384+
name = "%s"
385+
project = "%s"
386+
destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}"
387+
filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR"
388+
description = "description updated"
389+
390+
unique_writer_identity = false
391+
}
392+
393+
resource "google_storage_bucket" "log-bucket" {
394+
name = "%s"
395+
location = "US"
396+
}
397+
`, name, project, project, bucketName)
398+
}
399+
350400
func testAccLoggingProjectSink_disabled(name, project, bucketName string) string {
351401
return fmt.Sprintf(`
352402
resource "google_logging_project_sink" "disabled" {

google/resource_logging_sink.go

+1
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ func expandResourceLoggingSinkForUpdate(d *schema.ResourceData) (sink *logging.L
153153
Destination: d.Get("destination").(string),
154154
Filter: d.Get("filter").(string),
155155
Disabled: d.Get("disabled").(bool),
156+
Description: d.Get("description").(string),
156157
ForceSendFields: []string{"Destination", "Filter", "Disabled"},
157158
}
158159

0 commit comments

Comments
 (0)