mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-07-05 17:52:38 +00:00
Merge pull request #1968 from chrisst/logging-sink-defaults-991
Setting a default update_mask for all log sinks
This commit is contained in:
commit
73e2972237
|
@ -2,6 +2,7 @@ package google
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
)
|
||||
|
||||
|
@ -58,7 +59,8 @@ func resourceLoggingBillingAccountSinkUpdate(d *schema.ResourceData, meta interf
|
|||
sink := expandResourceLoggingSinkForUpdate(d)
|
||||
|
||||
// The API will reject any requests that don't explicitly set 'uniqueWriterIdentity' to true.
|
||||
_, err := config.clientLogging.BillingAccounts.Sinks.Patch(d.Id(), sink).UniqueWriterIdentity(true).Do()
|
||||
_, err := config.clientLogging.BillingAccounts.Sinks.Patch(d.Id(), sink).
|
||||
UpdateMask(defaultLogSinkUpdateMask).UniqueWriterIdentity(true).Do()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -77,7 +77,8 @@ func resourceLoggingFolderSinkUpdate(d *schema.ResourceData, meta interface{}) e
|
|||
sink.ForceSendFields = append(sink.ForceSendFields, "IncludeChildren")
|
||||
|
||||
// The API will reject any requests that don't explicitly set 'uniqueWriterIdentity' to true.
|
||||
_, err := config.clientLogging.Folders.Sinks.Patch(d.Id(), sink).UniqueWriterIdentity(true).Do()
|
||||
_, err := config.clientLogging.Folders.Sinks.Patch(d.Id(), sink).
|
||||
UpdateMask(defaultLogSinkUpdateMask).UniqueWriterIdentity(true).Do()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -77,7 +77,8 @@ func resourceLoggingOrganizationSinkUpdate(d *schema.ResourceData, meta interfac
|
|||
sink.ForceSendFields = append(sink.ForceSendFields, "IncludeChildren")
|
||||
|
||||
// The API will reject any requests that don't explicitly set 'uniqueWriterIdentity' to true.
|
||||
_, err := config.clientLogging.Organizations.Sinks.Patch(d.Id(), sink).UniqueWriterIdentity(true).Do()
|
||||
_, err := config.clientLogging.Organizations.Sinks.Patch(d.Id(), sink).
|
||||
UpdateMask(defaultLogSinkUpdateMask).UniqueWriterIdentity(true).Do()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -84,7 +84,8 @@ func resourceLoggingProjectSinkUpdate(d *schema.ResourceData, meta interface{})
|
|||
sink := expandResourceLoggingSinkForUpdate(d)
|
||||
uniqueWriterIdentity := d.Get("unique_writer_identity").(bool)
|
||||
|
||||
_, err := config.clientLogging.Projects.Sinks.Patch(d.Id(), sink).UniqueWriterIdentity(uniqueWriterIdentity).Do()
|
||||
_, err := config.clientLogging.Projects.Sinks.Patch(d.Id(), sink).
|
||||
UpdateMask(defaultLogSinkUpdateMask).UniqueWriterIdentity(uniqueWriterIdentity).Do()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -5,6 +5,9 @@ import (
|
|||
"google.golang.org/api/logging/v2"
|
||||
)
|
||||
|
||||
// Empty update masks will eventually cause updates to fail, currently empty masks default to this string
|
||||
const defaultLogSinkUpdateMask = "destination,filter,includeChildren"
|
||||
|
||||
func resourceLoggingSinkSchema() map[string]*schema.Schema {
|
||||
return map[string]*schema.Schema{
|
||||
"name": {
|
||||
|
|
|
@ -14,8 +14,9 @@ Manages a project-level logging sink. For more information see
|
|||
and
|
||||
[API](https://cloud.google.com/logging/docs/reference/v2/rest/).
|
||||
|
||||
Note that you must have the "Logs Configuration Writer" IAM role (`roles/logging.configWriter`)
|
||||
granted to the credentials used with terraform.
|
||||
~> **Note:** You must have [granted the "Logs Configuration Writer"](https://cloud.google.com/logging/docs/access-control) IAM role (`roles/logging.configWriter`) to the credentials used with terraform.
|
||||
|
||||
~> **Note** You must [enable the Cloud Resource Manager API](https://console.cloud.google.com/apis/library/cloudresourcemanager.googleapis.com)
|
||||
|
||||
## Example Usage
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user