Skip to content

Commit 0983154

Browse files
authored
make logging sink include_children updatable (#15769)
1 parent 2d0dcb7 commit 0983154

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

mmv1/third_party/terraform/services/logging/resource_logging_organization_sink_test.go

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,27 @@ func TestAccLoggingOrganizationSink_update(t *testing.T) {
5959
CheckDestroy: testAccCheckLoggingOrganizationSinkDestroyProducer(t),
6060
Steps: []resource.TestStep{
6161
{
62-
Config: testAccLoggingOrganizationSink_update(sinkName, bucketName, org),
62+
Config: testAccLoggingOrganizationSink_update(sinkName, bucketName, org, "false"),
6363
Check: resource.ComposeTestCheckFunc(
6464
testAccCheckLoggingOrganizationSinkExists(t, "google_logging_organization_sink.update", &sinkBefore),
6565
testAccCheckLoggingOrganizationSink(&sinkBefore, "google_logging_organization_sink.update"),
6666
),
67-
}, {
68-
Config: testAccLoggingOrganizationSink_update(sinkName, updatedBucketName, org),
67+
},
68+
{
69+
Config: testAccLoggingOrganizationSink_update(sinkName, updatedBucketName, org, "true"),
6970
Check: resource.ComposeTestCheckFunc(
7071
testAccCheckLoggingOrganizationSinkExists(t, "google_logging_organization_sink.update", &sinkAfter),
7172
testAccCheckLoggingOrganizationSink(&sinkAfter, "google_logging_organization_sink.update"),
7273
),
73-
}, {
74+
},
75+
{
76+
Config: testAccLoggingOrganizationSink_update(sinkName, bucketName, org, "false"),
77+
Check: resource.ComposeTestCheckFunc(
78+
testAccCheckLoggingOrganizationSinkExists(t, "google_logging_organization_sink.update", &sinkBefore),
79+
testAccCheckLoggingOrganizationSink(&sinkBefore, "google_logging_organization_sink.update"),
80+
),
81+
},
82+
{
7483
ResourceName: "google_logging_organization_sink.update",
7584
ImportState: true,
7685
ImportStateVerify: true,
@@ -327,21 +336,21 @@ resource "google_storage_bucket" "log-bucket" {
327336
`, sinkName, orgId, envvar.GetTestProjectFromEnv(), bucketName)
328337
}
329338

330-
func testAccLoggingOrganizationSink_update(sinkName, bucketName, orgId string) string {
339+
func testAccLoggingOrganizationSink_update(sinkName, bucketName, orgId, includeChildren string) string {
331340
return fmt.Sprintf(`
332341
resource "google_logging_organization_sink" "update" {
333342
name = "%s"
334343
org_id = "%s"
335344
destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}"
336345
filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR"
337-
include_children = false
346+
include_children = %s
338347
}
339348
340349
resource "google_storage_bucket" "log-bucket" {
341350
name = "%s"
342351
location = "US"
343352
}
344-
`, sinkName, orgId, envvar.GetTestProjectFromEnv(), bucketName)
353+
`, sinkName, orgId, envvar.GetTestProjectFromEnv(), includeChildren, bucketName)
345354
}
346355

347356
func testAccLoggingOrganizationSink_described(sinkName, bucketName, orgId string) string {

mmv1/third_party/terraform/services/logging/resource_logging_sink.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,9 @@ func expandResourceLoggingSinkForUpdate(d *schema.ResourceData) (sink *logging.L
159159
Filter: d.Get("filter").(string),
160160
Disabled: d.Get("disabled").(bool),
161161
Description: d.Get("description").(string),
162+
IncludeChildren: d.Get("include_children").(bool),
162163
Exclusions: expandLoggingSinkExclusions(d.Get("exclusions")),
163-
ForceSendFields: []string{"Destination", "Filter", "Disabled", "Exclusions"},
164+
ForceSendFields: []string{"Destination", "Filter", "Disabled", "Exclusions", "IncludeChildren"},
164165
}
165166

166167
updateFields := []string{"exclusions"}

0 commit comments

Comments
 (0)