1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. logging
  5. OrganizationSettings
Google Cloud v8.25.0 published on Thursday, Apr 3, 2025 by Pulumi

gcp.logging.OrganizationSettings

Explore with Pulumi AI

Default resource settings control whether CMEK is required for new log buckets. These settings also determine the storage location for the _Default and _Required log buckets, and whether the _Default sink is enabled or disabled.

To get more information about OrganizationSettings, see:

Example Usage

Logging Organization Settings All

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const settings = gcp.logging.getOrganizationSettings({
    organization: "123456789",
});
const iam = new gcp.kms.CryptoKeyIAMMember("iam", {
    cryptoKeyId: "kms-key",
    role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
    member: settings.then(settings => `serviceAccount:${settings.kmsServiceAccountId}`),
});
const example = new gcp.logging.OrganizationSettings("example", {
    disableDefaultSink: true,
    kmsKeyName: "kms-key",
    organization: "123456789",
    storageLocation: "us-central1",
}, {
    dependsOn: [iam],
});
Copy
import pulumi
import pulumi_gcp as gcp

settings = gcp.logging.get_organization_settings(organization="123456789")
iam = gcp.kms.CryptoKeyIAMMember("iam",
    crypto_key_id="kms-key",
    role="roles/cloudkms.cryptoKeyEncrypterDecrypter",
    member=f"serviceAccount:{settings.kms_service_account_id}")
example = gcp.logging.OrganizationSettings("example",
    disable_default_sink=True,
    kms_key_name="kms-key",
    organization="123456789",
    storage_location="us-central1",
    opts = pulumi.ResourceOptions(depends_on=[iam]))
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/kms"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/logging"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		settings, err := logging.LookupOrganizationSettings(ctx, &logging.LookupOrganizationSettingsArgs{
			Organization: "123456789",
		}, nil)
		if err != nil {
			return err
		}
		iam, err := kms.NewCryptoKeyIAMMember(ctx, "iam", &kms.CryptoKeyIAMMemberArgs{
			CryptoKeyId: pulumi.String("kms-key"),
			Role:        pulumi.String("roles/cloudkms.cryptoKeyEncrypterDecrypter"),
			Member:      pulumi.Sprintf("serviceAccount:%v", settings.KmsServiceAccountId),
		})
		if err != nil {
			return err
		}
		_, err = logging.NewOrganizationSettings(ctx, "example", &logging.OrganizationSettingsArgs{
			DisableDefaultSink: pulumi.Bool(true),
			KmsKeyName:         pulumi.String("kms-key"),
			Organization:       pulumi.String("123456789"),
			StorageLocation:    pulumi.String("us-central1"),
		}, pulumi.DependsOn([]pulumi.Resource{
			iam,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var settings = Gcp.Logging.GetOrganizationSettings.Invoke(new()
    {
        Organization = "123456789",
    });

    var iam = new Gcp.Kms.CryptoKeyIAMMember("iam", new()
    {
        CryptoKeyId = "kms-key",
        Role = "roles/cloudkms.cryptoKeyEncrypterDecrypter",
        Member = $"serviceAccount:{settings.Apply(getOrganizationSettingsResult => getOrganizationSettingsResult.KmsServiceAccountId)}",
    });

    var example = new Gcp.Logging.OrganizationSettings("example", new()
    {
        DisableDefaultSink = true,
        KmsKeyName = "kms-key",
        Organization = "123456789",
        StorageLocation = "us-central1",
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            iam,
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.logging.LoggingFunctions;
import com.pulumi.gcp.logging.inputs.GetOrganizationSettingsArgs;
import com.pulumi.gcp.kms.CryptoKeyIAMMember;
import com.pulumi.gcp.kms.CryptoKeyIAMMemberArgs;
import com.pulumi.gcp.logging.OrganizationSettings;
import com.pulumi.gcp.logging.OrganizationSettingsArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var settings = LoggingFunctions.getOrganizationSettings(GetOrganizationSettingsArgs.builder()
            .organization("123456789")
            .build());

        var iam = new CryptoKeyIAMMember("iam", CryptoKeyIAMMemberArgs.builder()
            .cryptoKeyId("kms-key")
            .role("roles/cloudkms.cryptoKeyEncrypterDecrypter")
            .member(String.format("serviceAccount:%s", settings.applyValue(getOrganizationSettingsResult -> getOrganizationSettingsResult.kmsServiceAccountId())))
            .build());

        var example = new OrganizationSettings("example", OrganizationSettingsArgs.builder()
            .disableDefaultSink(true)
            .kmsKeyName("kms-key")
            .organization("123456789")
            .storageLocation("us-central1")
            .build(), CustomResourceOptions.builder()
                .dependsOn(iam)
                .build());

    }
}
Copy
resources:
  example:
    type: gcp:logging:OrganizationSettings
    properties:
      disableDefaultSink: true
      kmsKeyName: kms-key
      organization: '123456789'
      storageLocation: us-central1
    options:
      dependsOn:
        - ${iam}
  iam:
    type: gcp:kms:CryptoKeyIAMMember
    properties:
      cryptoKeyId: kms-key
      role: roles/cloudkms.cryptoKeyEncrypterDecrypter
      member: serviceAccount:${settings.kmsServiceAccountId}
variables:
  settings:
    fn::invoke:
      function: gcp:logging:getOrganizationSettings
      arguments:
        organization: '123456789'
Copy

Create OrganizationSettings Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new OrganizationSettings(name: string, args: OrganizationSettingsArgs, opts?: CustomResourceOptions);
@overload
def OrganizationSettings(resource_name: str,
                         args: OrganizationSettingsArgs,
                         opts: Optional[ResourceOptions] = None)

@overload
def OrganizationSettings(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         organization: Optional[str] = None,
                         disable_default_sink: Optional[bool] = None,
                         kms_key_name: Optional[str] = None,
                         storage_location: Optional[str] = None)
func NewOrganizationSettings(ctx *Context, name string, args OrganizationSettingsArgs, opts ...ResourceOption) (*OrganizationSettings, error)
public OrganizationSettings(string name, OrganizationSettingsArgs args, CustomResourceOptions? opts = null)
public OrganizationSettings(String name, OrganizationSettingsArgs args)
public OrganizationSettings(String name, OrganizationSettingsArgs args, CustomResourceOptions options)
type: gcp:logging:OrganizationSettings
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. OrganizationSettingsArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. OrganizationSettingsArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. OrganizationSettingsArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. OrganizationSettingsArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. OrganizationSettingsArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var organizationSettingsResource = new Gcp.Logging.OrganizationSettings("organizationSettingsResource", new()
{
    Organization = "string",
    DisableDefaultSink = false,
    KmsKeyName = "string",
    StorageLocation = "string",
});
Copy
example, err := logging.NewOrganizationSettings(ctx, "organizationSettingsResource", &logging.OrganizationSettingsArgs{
	Organization:       pulumi.String("string"),
	DisableDefaultSink: pulumi.Bool(false),
	KmsKeyName:         pulumi.String("string"),
	StorageLocation:    pulumi.String("string"),
})
Copy
var organizationSettingsResource = new OrganizationSettings("organizationSettingsResource", OrganizationSettingsArgs.builder()
    .organization("string")
    .disableDefaultSink(false)
    .kmsKeyName("string")
    .storageLocation("string")
    .build());
Copy
organization_settings_resource = gcp.logging.OrganizationSettings("organizationSettingsResource",
    organization="string",
    disable_default_sink=False,
    kms_key_name="string",
    storage_location="string")
Copy
const organizationSettingsResource = new gcp.logging.OrganizationSettings("organizationSettingsResource", {
    organization: "string",
    disableDefaultSink: false,
    kmsKeyName: "string",
    storageLocation: "string",
});
Copy
type: gcp:logging:OrganizationSettings
properties:
    disableDefaultSink: false
    kmsKeyName: string
    organization: string
    storageLocation: string
Copy

OrganizationSettings Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The OrganizationSettings resource accepts the following input properties:

Organization
This property is required.
Changes to this property will trigger replacement.
string
The organization for which to retrieve or configure settings.


DisableDefaultSink bool
If set to true, the _Default sink in newly created projects and folders will created in a disabled state. This can be used to automatically disable log storage if there is already an aggregated sink configured in the hierarchy. The _Default sink can be re-enabled manually if needed.
KmsKeyName string
The resource name for the configured Cloud KMS key.
StorageLocation string
The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
Organization
This property is required.
Changes to this property will trigger replacement.
string
The organization for which to retrieve or configure settings.


DisableDefaultSink bool
If set to true, the _Default sink in newly created projects and folders will created in a disabled state. This can be used to automatically disable log storage if there is already an aggregated sink configured in the hierarchy. The _Default sink can be re-enabled manually if needed.
KmsKeyName string
The resource name for the configured Cloud KMS key.
StorageLocation string
The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
organization
This property is required.
Changes to this property will trigger replacement.
String
The organization for which to retrieve or configure settings.


disableDefaultSink Boolean
If set to true, the _Default sink in newly created projects and folders will created in a disabled state. This can be used to automatically disable log storage if there is already an aggregated sink configured in the hierarchy. The _Default sink can be re-enabled manually if needed.
kmsKeyName String
The resource name for the configured Cloud KMS key.
storageLocation String
The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
organization
This property is required.
Changes to this property will trigger replacement.
string
The organization for which to retrieve or configure settings.


disableDefaultSink boolean
If set to true, the _Default sink in newly created projects and folders will created in a disabled state. This can be used to automatically disable log storage if there is already an aggregated sink configured in the hierarchy. The _Default sink can be re-enabled manually if needed.
kmsKeyName string
The resource name for the configured Cloud KMS key.
storageLocation string
The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
organization
This property is required.
Changes to this property will trigger replacement.
str
The organization for which to retrieve or configure settings.


disable_default_sink bool
If set to true, the _Default sink in newly created projects and folders will created in a disabled state. This can be used to automatically disable log storage if there is already an aggregated sink configured in the hierarchy. The _Default sink can be re-enabled manually if needed.
kms_key_name str
The resource name for the configured Cloud KMS key.
storage_location str
The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
organization
This property is required.
Changes to this property will trigger replacement.
String
The organization for which to retrieve or configure settings.


disableDefaultSink Boolean
If set to true, the _Default sink in newly created projects and folders will created in a disabled state. This can be used to automatically disable log storage if there is already an aggregated sink configured in the hierarchy. The _Default sink can be re-enabled manually if needed.
kmsKeyName String
The resource name for the configured Cloud KMS key.
storageLocation String
The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.

Outputs

All input properties are implicitly available as output properties. Additionally, the OrganizationSettings resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
KmsServiceAccountId string
The service account that will be used by the Log Router to access your Cloud KMS key.
LoggingServiceAccountId string
The service account for the given container. Sinks use this service account as their writerIdentity if no custom service account is provided.
Name string
The resource name of the settings.
Id string
The provider-assigned unique ID for this managed resource.
KmsServiceAccountId string
The service account that will be used by the Log Router to access your Cloud KMS key.
LoggingServiceAccountId string
The service account for the given container. Sinks use this service account as their writerIdentity if no custom service account is provided.
Name string
The resource name of the settings.
id String
The provider-assigned unique ID for this managed resource.
kmsServiceAccountId String
The service account that will be used by the Log Router to access your Cloud KMS key.
loggingServiceAccountId String
The service account for the given container. Sinks use this service account as their writerIdentity if no custom service account is provided.
name String
The resource name of the settings.
id string
The provider-assigned unique ID for this managed resource.
kmsServiceAccountId string
The service account that will be used by the Log Router to access your Cloud KMS key.
loggingServiceAccountId string
The service account for the given container. Sinks use this service account as their writerIdentity if no custom service account is provided.
name string
The resource name of the settings.
id str
The provider-assigned unique ID for this managed resource.
kms_service_account_id str
The service account that will be used by the Log Router to access your Cloud KMS key.
logging_service_account_id str
The service account for the given container. Sinks use this service account as their writerIdentity if no custom service account is provided.
name str
The resource name of the settings.
id String
The provider-assigned unique ID for this managed resource.
kmsServiceAccountId String
The service account that will be used by the Log Router to access your Cloud KMS key.
loggingServiceAccountId String
The service account for the given container. Sinks use this service account as their writerIdentity if no custom service account is provided.
name String
The resource name of the settings.

Look up Existing OrganizationSettings Resource

Get an existing OrganizationSettings resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: OrganizationSettingsState, opts?: CustomResourceOptions): OrganizationSettings
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        disable_default_sink: Optional[bool] = None,
        kms_key_name: Optional[str] = None,
        kms_service_account_id: Optional[str] = None,
        logging_service_account_id: Optional[str] = None,
        name: Optional[str] = None,
        organization: Optional[str] = None,
        storage_location: Optional[str] = None) -> OrganizationSettings
func GetOrganizationSettings(ctx *Context, name string, id IDInput, state *OrganizationSettingsState, opts ...ResourceOption) (*OrganizationSettings, error)
public static OrganizationSettings Get(string name, Input<string> id, OrganizationSettingsState? state, CustomResourceOptions? opts = null)
public static OrganizationSettings get(String name, Output<String> id, OrganizationSettingsState state, CustomResourceOptions options)
resources:  _:    type: gcp:logging:OrganizationSettings    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
DisableDefaultSink bool
If set to true, the _Default sink in newly created projects and folders will created in a disabled state. This can be used to automatically disable log storage if there is already an aggregated sink configured in the hierarchy. The _Default sink can be re-enabled manually if needed.
KmsKeyName string
The resource name for the configured Cloud KMS key.
KmsServiceAccountId string
The service account that will be used by the Log Router to access your Cloud KMS key.
LoggingServiceAccountId string
The service account for the given container. Sinks use this service account as their writerIdentity if no custom service account is provided.
Name string
The resource name of the settings.
Organization Changes to this property will trigger replacement. string
The organization for which to retrieve or configure settings.


StorageLocation string
The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
DisableDefaultSink bool
If set to true, the _Default sink in newly created projects and folders will created in a disabled state. This can be used to automatically disable log storage if there is already an aggregated sink configured in the hierarchy. The _Default sink can be re-enabled manually if needed.
KmsKeyName string
The resource name for the configured Cloud KMS key.
KmsServiceAccountId string
The service account that will be used by the Log Router to access your Cloud KMS key.
LoggingServiceAccountId string
The service account for the given container. Sinks use this service account as their writerIdentity if no custom service account is provided.
Name string
The resource name of the settings.
Organization Changes to this property will trigger replacement. string
The organization for which to retrieve or configure settings.


StorageLocation string
The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
disableDefaultSink Boolean
If set to true, the _Default sink in newly created projects and folders will created in a disabled state. This can be used to automatically disable log storage if there is already an aggregated sink configured in the hierarchy. The _Default sink can be re-enabled manually if needed.
kmsKeyName String
The resource name for the configured Cloud KMS key.
kmsServiceAccountId String
The service account that will be used by the Log Router to access your Cloud KMS key.
loggingServiceAccountId String
The service account for the given container. Sinks use this service account as their writerIdentity if no custom service account is provided.
name String
The resource name of the settings.
organization Changes to this property will trigger replacement. String
The organization for which to retrieve or configure settings.


storageLocation String
The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
disableDefaultSink boolean
If set to true, the _Default sink in newly created projects and folders will created in a disabled state. This can be used to automatically disable log storage if there is already an aggregated sink configured in the hierarchy. The _Default sink can be re-enabled manually if needed.
kmsKeyName string
The resource name for the configured Cloud KMS key.
kmsServiceAccountId string
The service account that will be used by the Log Router to access your Cloud KMS key.
loggingServiceAccountId string
The service account for the given container. Sinks use this service account as their writerIdentity if no custom service account is provided.
name string
The resource name of the settings.
organization Changes to this property will trigger replacement. string
The organization for which to retrieve or configure settings.


storageLocation string
The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
disable_default_sink bool
If set to true, the _Default sink in newly created projects and folders will created in a disabled state. This can be used to automatically disable log storage if there is already an aggregated sink configured in the hierarchy. The _Default sink can be re-enabled manually if needed.
kms_key_name str
The resource name for the configured Cloud KMS key.
kms_service_account_id str
The service account that will be used by the Log Router to access your Cloud KMS key.
logging_service_account_id str
The service account for the given container. Sinks use this service account as their writerIdentity if no custom service account is provided.
name str
The resource name of the settings.
organization Changes to this property will trigger replacement. str
The organization for which to retrieve or configure settings.


storage_location str
The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
disableDefaultSink Boolean
If set to true, the _Default sink in newly created projects and folders will created in a disabled state. This can be used to automatically disable log storage if there is already an aggregated sink configured in the hierarchy. The _Default sink can be re-enabled manually if needed.
kmsKeyName String
The resource name for the configured Cloud KMS key.
kmsServiceAccountId String
The service account that will be used by the Log Router to access your Cloud KMS key.
loggingServiceAccountId String
The service account for the given container. Sinks use this service account as their writerIdentity if no custom service account is provided.
name String
The resource name of the settings.
organization Changes to this property will trigger replacement. String
The organization for which to retrieve or configure settings.


storageLocation String
The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.

Import

OrganizationSettings can be imported using any of these accepted formats:

  • organizations/{{organization}}/settings

  • {{organization}}

When using the pulumi import command, OrganizationSettings can be imported using one of the formats above. For example:

$ pulumi import gcp:logging/organizationSettings:OrganizationSettings default organizations/{{organization}}/settings
Copy
$ pulumi import gcp:logging/organizationSettings:OrganizationSettings default {{organization}}
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Google Cloud (GCP) Classic pulumi/pulumi-gcp
License
Apache-2.0
Notes
This Pulumi package is based on the google-beta Terraform Provider.