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

Change the default value of unique_writer_identity in resource logging_project_sink to true. #8875

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package logging

import (
Expand Down Expand Up @@ -36,9 +38,9 @@ func ResourceLoggingProjectSink() *schema.Resource {
schm.Schema["unique_writer_identity"] = &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Default: false,
Default: true,
ForceNew: true,
Description: `Whether or not to create a unique identity associated with this sink. If false (the default), then the writer_identity used is serviceAccount:[email protected]. If true, then a unique service account is created and used for this sink. If you wish to publish logs across projects, you must set unique_writer_identity to true.`,
Description: `Whether or not to create a unique identity associated with this sink. If false (the legacy behavior), then the writer_identity used is serviceAccount:[email protected]. If true, then a unique service account is created and used for this sink. If you wish to publish logs across projects, you must set unique_writer_identity to true.`,
}
return schm
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,11 @@ func testAccLoggingProjectSink_basic(name, project, bucketName string) string {
resource "google_logging_project_sink" "basic" {
name = "%s"
project = "%s"
destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}"
destination = "storage.googleapis.com/${google_storage_bucket.gcs-bucket.name}"
filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR"

unique_writer_identity = false
}

resource "google_storage_bucket" "log-bucket" {
resource "google_storage_bucket" "gcs-bucket" {
name = "%s"
location = "US"
}
Expand All @@ -310,14 +308,12 @@ func testAccLoggingProjectSink_described(name, project, bucketName string) strin
resource "google_logging_project_sink" "described" {
name = "%s"
project = "%s"
destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}"
destination = "storage.googleapis.com/${google_storage_bucket.gcs-bucket.name}"
filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR"
description = "this is a description for a project level logging sink"

unique_writer_identity = false
}

resource "google_storage_bucket" "log-bucket" {
resource "google_storage_bucket" "gcs-bucket" {
name = "%s"
location = "US"
}
Expand All @@ -329,14 +325,12 @@ func testAccLoggingProjectSink_described_update(name, project, bucketName string
resource "google_logging_project_sink" "described" {
name = "%s"
project = "%s"
destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}"
destination = "storage.googleapis.com/${google_storage_bucket.gcs-bucket.name}"
filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR"
description = "description updated"

unique_writer_identity = false
}

resource "google_storage_bucket" "log-bucket" {
resource "google_storage_bucket" "gcs-bucket" {
name = "%s"
location = "US"
}
Expand All @@ -348,14 +342,14 @@ func testAccLoggingProjectSink_disabled(name, project, bucketName string) string
resource "google_logging_project_sink" "disabled" {
name = "%s"
project = "%s"
destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}"
destination = "storage.googleapis.com/${google_storage_bucket.gcs-bucket.name}"
filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR"
disabled = true

unique_writer_identity = false
}

resource "google_storage_bucket" "log-bucket" {
resource "google_storage_bucket" "gcs-bucket" {
name = "%s"
location = "US"
}
Expand All @@ -367,14 +361,14 @@ func testAccLoggingProjectSink_disabled_update(name, project, bucketName, disabl
resource "google_logging_project_sink" "disabled" {
name = "%s"
project = "%s"
destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}"
destination = "storage.googleapis.com/${google_storage_bucket.gcs-bucket.name}"
filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR"
disabled = "%s"

unique_writer_identity = true
}

resource "google_storage_bucket" "log-bucket" {
resource "google_storage_bucket" "gcs-bucket" {
name = "%s"
location = "US"
}
Expand All @@ -385,13 +379,13 @@ func testAccLoggingProjectSink_uniqueWriter(name, bucketName string) string {
return fmt.Sprintf(`
resource "google_logging_project_sink" "unique_writer" {
name = "%s"
destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}"
destination = "storage.googleapis.com/${google_storage_bucket.gcs-bucket.name}"
filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR"

unique_writer_identity = true
}

resource "google_storage_bucket" "log-bucket" {
resource "google_storage_bucket" "gcs-bucket" {
name = "%s"
location = "US"
}
Expand All @@ -402,13 +396,13 @@ func testAccLoggingProjectSink_uniqueWriterUpdated(name, bucketName string) stri
return fmt.Sprintf(`
resource "google_logging_project_sink" "unique_writer" {
name = "%s"
destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}"
destination = "storage.googleapis.com/${google_storage_bucket.gcs-bucket.name}"
filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=WARNING"

unique_writer_identity = true
}

resource "google_storage_bucket" "log-bucket" {
resource "google_storage_bucket" "gcs-bucket" {
name = "%s"
location = "US"
}
Expand All @@ -420,7 +414,7 @@ func testAccLoggingProjectSink_heredoc(name, project, bucketName string) string
resource "google_logging_project_sink" "heredoc" {
name = "%s"
project = "%s"
destination = "storage.googleapis.com/${google_storage_bucket.log-bucket.name}"
destination = "storage.googleapis.com/${google_storage_bucket.gcs-bucket.name}"

filter = <<EOS

Expand All @@ -433,7 +427,7 @@ EOS
unique_writer_identity = false
}

resource "google_storage_bucket" "log-bucket" {
resource "google_storage_bucket" "gcs-bucket" {
name = "%s"
location = "US"
}
Expand All @@ -444,7 +438,7 @@ func testAccLoggingProjectSink_bigquery_before(sinkName, bqDatasetID string) str
return fmt.Sprintf(`
resource "google_logging_project_sink" "bigquery" {
name = "%s"
destination = "bigquery.googleapis.com/projects/%s/datasets/${google_bigquery_dataset.logging_sink.dataset_id}"
destination = "bigquery.googleapis.com/projects/%s/datasets/${google_bigquery_dataset.bq_dataset.dataset_id}"
filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=ERROR"

unique_writer_identity = true
Expand All @@ -454,7 +448,7 @@ resource "google_logging_project_sink" "bigquery" {
}
}

resource "google_bigquery_dataset" "logging_sink" {
resource "google_bigquery_dataset" "bq_dataset" {
dataset_id = "%s"
description = "Log sink (generated during acc test of terraform-provider-google(-beta))."
}
Expand All @@ -465,13 +459,11 @@ func testAccLoggingProjectSink_bigquery_after(sinkName, bqDatasetID string) stri
return fmt.Sprintf(`
resource "google_logging_project_sink" "bigquery" {
name = "%s"
destination = "bigquery.googleapis.com/projects/%s/datasets/${google_bigquery_dataset.logging_sink.dataset_id}"
destination = "bigquery.googleapis.com/projects/%s/datasets/${google_bigquery_dataset.bq_dataset.dataset_id}"
filter = "logName=\"projects/%s/logs/compute.googleapis.com%%2Factivity_log\" AND severity>=WARNING"

unique_writer_identity = false
}

resource "google_bigquery_dataset" "logging_sink" {
resource "google_bigquery_dataset" "bq_dataset" {
dataset_id = "%s"
description = "Log sink (generated during acc test of terraform-provider-google(-beta))."
}
Expand All @@ -495,8 +487,6 @@ resource "google_logging_project_sink" "loggingbucket" {
description = "test-2"
filter = "resource.type = k8s_container"
}

unique_writer_identity = true
}

`, name, project, project)
Expand Down