1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. logging
  5. FolderSettings
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

gcp.logging.FolderSettings

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

    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 FolderSettings, see:

    Example Usage

    Logging Folder Settings All

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const myFolder = new gcp.organizations.Folder("my_folder", {
        displayName: "folder-name",
        parent: "organizations/123456789",
        deletionProtection: false,
    });
    const settings = gcp.logging.getFolderSettingsOutput({
        folder: myFolder.folderId,
    });
    const iam = new gcp.kms.CryptoKeyIAMMember("iam", {
        cryptoKeyId: "kms-key",
        role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
        member: settings.apply(settings => `serviceAccount:${settings.kmsServiceAccountId}`),
    });
    const example = new gcp.logging.FolderSettings("example", {
        disableDefaultSink: true,
        folder: myFolder.folderId,
        kmsKeyName: "kms-key",
        storageLocation: "us-central1",
    }, {
        dependsOn: [iam],
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    my_folder = gcp.organizations.Folder("my_folder",
        display_name="folder-name",
        parent="organizations/123456789",
        deletion_protection=False)
    settings = gcp.logging.get_folder_settings_output(folder=my_folder.folder_id)
    iam = gcp.kms.CryptoKeyIAMMember("iam",
        crypto_key_id="kms-key",
        role="roles/cloudkms.cryptoKeyEncrypterDecrypter",
        member=settings.apply(lambda settings: f"serviceAccount:{settings.kms_service_account_id}"))
    example = gcp.logging.FolderSettings("example",
        disable_default_sink=True,
        folder=my_folder.folder_id,
        kms_key_name="kms-key",
        storage_location="us-central1",
        opts = pulumi.ResourceOptions(depends_on=[iam]))
    
    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-gcp/sdk/v8/go/gcp/organizations"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		myFolder, err := organizations.NewFolder(ctx, "my_folder", &organizations.FolderArgs{
    			DisplayName:        pulumi.String("folder-name"),
    			Parent:             pulumi.String("organizations/123456789"),
    			DeletionProtection: pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		settings := logging.LookupFolderSettingsOutput(ctx, logging.GetFolderSettingsOutputArgs{
    			Folder: myFolder.FolderId,
    		}, nil)
    		iam, err := kms.NewCryptoKeyIAMMember(ctx, "iam", &kms.CryptoKeyIAMMemberArgs{
    			CryptoKeyId: pulumi.String("kms-key"),
    			Role:        pulumi.String("roles/cloudkms.cryptoKeyEncrypterDecrypter"),
    			Member: settings.ApplyT(func(settings logging.GetFolderSettingsResult) (string, error) {
    				return fmt.Sprintf("serviceAccount:%v", settings.KmsServiceAccountId), nil
    			}).(pulumi.StringOutput),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = logging.NewFolderSettings(ctx, "example", &logging.FolderSettingsArgs{
    			DisableDefaultSink: pulumi.Bool(true),
    			Folder:             myFolder.FolderId,
    			KmsKeyName:         pulumi.String("kms-key"),
    			StorageLocation:    pulumi.String("us-central1"),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			iam,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var myFolder = new Gcp.Organizations.Folder("my_folder", new()
        {
            DisplayName = "folder-name",
            Parent = "organizations/123456789",
            DeletionProtection = false,
        });
    
        var settings = Gcp.Logging.GetFolderSettings.Invoke(new()
        {
            Folder = myFolder.FolderId,
        });
    
        var iam = new Gcp.Kms.CryptoKeyIAMMember("iam", new()
        {
            CryptoKeyId = "kms-key",
            Role = "roles/cloudkms.cryptoKeyEncrypterDecrypter",
            Member = $"serviceAccount:{settings.Apply(getFolderSettingsResult => getFolderSettingsResult.KmsServiceAccountId)}",
        });
    
        var example = new Gcp.Logging.FolderSettings("example", new()
        {
            DisableDefaultSink = true,
            Folder = myFolder.FolderId,
            KmsKeyName = "kms-key",
            StorageLocation = "us-central1",
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                iam,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.organizations.Folder;
    import com.pulumi.gcp.organizations.FolderArgs;
    import com.pulumi.gcp.logging.LoggingFunctions;
    import com.pulumi.gcp.logging.inputs.GetFolderSettingsArgs;
    import com.pulumi.gcp.kms.CryptoKeyIAMMember;
    import com.pulumi.gcp.kms.CryptoKeyIAMMemberArgs;
    import com.pulumi.gcp.logging.FolderSettings;
    import com.pulumi.gcp.logging.FolderSettingsArgs;
    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) {
            var myFolder = new Folder("myFolder", FolderArgs.builder()
                .displayName("folder-name")
                .parent("organizations/123456789")
                .deletionProtection(false)
                .build());
    
            final var settings = LoggingFunctions.getFolderSettings(GetFolderSettingsArgs.builder()
                .folder(myFolder.folderId())
                .build());
    
            var iam = new CryptoKeyIAMMember("iam", CryptoKeyIAMMemberArgs.builder()
                .cryptoKeyId("kms-key")
                .role("roles/cloudkms.cryptoKeyEncrypterDecrypter")
                .member(settings.applyValue(getFolderSettingsResult -> getFolderSettingsResult).applyValue(settings -> String.format("serviceAccount:%s", settings.applyValue(getFolderSettingsResult -> getFolderSettingsResult.kmsServiceAccountId()))))
                .build());
    
            var example = new FolderSettings("example", FolderSettingsArgs.builder()
                .disableDefaultSink(true)
                .folder(myFolder.folderId())
                .kmsKeyName("kms-key")
                .storageLocation("us-central1")
                .build(), CustomResourceOptions.builder()
                    .dependsOn(iam)
                    .build());
    
        }
    }
    
    resources:
      example:
        type: gcp:logging:FolderSettings
        properties:
          disableDefaultSink: true
          folder: ${myFolder.folderId}
          kmsKeyName: kms-key
          storageLocation: us-central1
        options:
          dependson:
            - ${iam}
      myFolder:
        type: gcp:organizations:Folder
        name: my_folder
        properties:
          displayName: folder-name
          parent: organizations/123456789
          deletionProtection: false
      iam:
        type: gcp:kms:CryptoKeyIAMMember
        properties:
          cryptoKeyId: kms-key
          role: roles/cloudkms.cryptoKeyEncrypterDecrypter
          member: serviceAccount:${settings.kmsServiceAccountId}
    variables:
      settings:
        fn::invoke:
          Function: gcp:logging:getFolderSettings
          Arguments:
            folder: ${myFolder.folderId}
    

    Create FolderSettings Resource

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

    Constructor syntax

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

    Parameters

    name string
    The unique name of the resource.
    args FolderSettingsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args FolderSettingsArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args FolderSettingsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args FolderSettingsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args FolderSettingsArgs
    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 folderSettingsResource = new Gcp.Logging.FolderSettings("folderSettingsResource", new()
    {
        Folder = "string",
        DisableDefaultSink = false,
        KmsKeyName = "string",
        StorageLocation = "string",
    });
    
    example, err := logging.NewFolderSettings(ctx, "folderSettingsResource", &logging.FolderSettingsArgs{
    	Folder:             pulumi.String("string"),
    	DisableDefaultSink: pulumi.Bool(false),
    	KmsKeyName:         pulumi.String("string"),
    	StorageLocation:    pulumi.String("string"),
    })
    
    var folderSettingsResource = new FolderSettings("folderSettingsResource", FolderSettingsArgs.builder()
        .folder("string")
        .disableDefaultSink(false)
        .kmsKeyName("string")
        .storageLocation("string")
        .build());
    
    folder_settings_resource = gcp.logging.FolderSettings("folderSettingsResource",
        folder="string",
        disable_default_sink=False,
        kms_key_name="string",
        storage_location="string")
    
    const folderSettingsResource = new gcp.logging.FolderSettings("folderSettingsResource", {
        folder: "string",
        disableDefaultSink: false,
        kmsKeyName: "string",
        storageLocation: "string",
    });
    
    type: gcp:logging:FolderSettings
    properties:
        disableDefaultSink: false
        folder: string
        kmsKeyName: string
        storageLocation: string
    

    FolderSettings 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 FolderSettings resource accepts the following input properties:

    Folder string
    The folder for which to retrieve 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.
    Folder string
    The folder for which to retrieve 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.
    folder String
    The folder for which to retrieve 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.
    folder string
    The folder for which to retrieve 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.
    folder str
    The folder for which to retrieve 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.
    folder String
    The folder for which to retrieve 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 FolderSettings 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 FolderSettings Resource

    Get an existing FolderSettings 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?: FolderSettingsState, opts?: CustomResourceOptions): FolderSettings
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            disable_default_sink: Optional[bool] = None,
            folder: Optional[str] = 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,
            storage_location: Optional[str] = None) -> FolderSettings
    func GetFolderSettings(ctx *Context, name string, id IDInput, state *FolderSettingsState, opts ...ResourceOption) (*FolderSettings, error)
    public static FolderSettings Get(string name, Input<string> id, FolderSettingsState? state, CustomResourceOptions? opts = null)
    public static FolderSettings get(String name, Output<String> id, FolderSettingsState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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.
    Folder string
    The folder for which to retrieve settings.


    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.
    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.
    Folder string
    The folder for which to retrieve settings.


    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.
    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.
    folder String
    The folder for which to retrieve settings.


    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.
    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.
    folder string
    The folder for which to retrieve settings.


    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.
    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.
    folder str
    The folder for which to retrieve settings.


    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.
    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.
    folder String
    The folder for which to retrieve settings.


    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.
    storageLocation String
    The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.

    Import

    FolderSettings can be imported using any of these accepted formats:

    • folders/{{folder}}/settings

    • {{folder}}

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

    $ pulumi import gcp:logging/folderSettings:FolderSettings default folders/{{folder}}/settings
    
    $ pulumi import gcp:logging/folderSettings:FolderSettings default {{folder}}
    

    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.
    gcp logo
    Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi