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],
});
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]))
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
})
}
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,
},
});
});
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());
}
}
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'
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 string
- The unique name of the resource.
- args OrganizationSettingsArgs
- 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 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 string
- The unique name of the resource.
- args OrganizationSettingsArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args OrganizationSettingsArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args 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",
});
example, err := logging.NewOrganizationSettings(ctx, "organizationSettingsResource", &logging.OrganizationSettingsArgs{
Organization: pulumi.String("string"),
DisableDefaultSink: pulumi.Bool(false),
KmsKeyName: pulumi.String("string"),
StorageLocation: pulumi.String("string"),
})
var organizationSettingsResource = new OrganizationSettings("organizationSettingsResource", OrganizationSettingsArgs.builder()
.organization("string")
.disableDefaultSink(false)
.kmsKeyName("string")
.storageLocation("string")
.build());
organization_settings_resource = gcp.logging.OrganizationSettings("organizationSettingsResource",
organization="string",
disable_default_sink=False,
kms_key_name="string",
storage_location="string")
const organizationSettingsResource = new gcp.logging.OrganizationSettings("organizationSettingsResource", {
organization: "string",
disableDefaultSink: false,
kmsKeyName: "string",
storageLocation: "string",
});
type: gcp:logging:OrganizationSettings
properties:
disableDefaultSink: false
kmsKeyName: string
organization: string
storageLocation: string
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
The OrganizationSettings resource accepts the following input properties:
- Organization string
- The organization for which to retrieve or configure settings.
- Disable
Default boolSink - 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 stringName - The resource name for the configured Cloud KMS key.
- Storage
Location string - The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
- Organization string
- The organization for which to retrieve or configure settings.
- Disable
Default boolSink - 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 stringName - The resource name for the configured Cloud KMS key.
- Storage
Location string - The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
- organization String
- The organization for which to retrieve or configure settings.
- disable
Default BooleanSink - 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 StringName - The resource name for the configured Cloud KMS key.
- storage
Location String - The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
- organization string
- The organization for which to retrieve or configure settings.
- disable
Default booleanSink - 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 stringName - The resource name for the configured Cloud KMS key.
- storage
Location string - The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
- organization str
- The organization for which to retrieve or configure settings.
- disable_
default_ boolsink - 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_ strname - 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 String
- The organization for which to retrieve or configure settings.
- disable
Default BooleanSink - 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 StringName - The resource name for the configured Cloud KMS key.
- storage
Location 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.
- Kms
Service stringAccount Id - The service account that will be used by the Log Router to access your Cloud KMS key.
- Logging
Service stringAccount Id - 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.
- Kms
Service stringAccount Id - The service account that will be used by the Log Router to access your Cloud KMS key.
- Logging
Service stringAccount Id - 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.
- kms
Service StringAccount Id - The service account that will be used by the Log Router to access your Cloud KMS key.
- logging
Service StringAccount Id - 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.
- kms
Service stringAccount Id - The service account that will be used by the Log Router to access your Cloud KMS key.
- logging
Service stringAccount Id - 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_ straccount_ id - The service account that will be used by the Log Router to access your Cloud KMS key.
- logging_
service_ straccount_ id - 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.
- kms
Service StringAccount Id - The service account that will be used by the Log Router to access your Cloud KMS key.
- logging
Service StringAccount Id - 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)
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.
- Disable
Default boolSink - 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 stringName - The resource name for the configured Cloud KMS key.
- Kms
Service stringAccount Id - The service account that will be used by the Log Router to access your Cloud KMS key.
- Logging
Service stringAccount Id - 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 string
- The organization for which to retrieve or configure settings.
- Storage
Location string - The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
- Disable
Default boolSink - 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 stringName - The resource name for the configured Cloud KMS key.
- Kms
Service stringAccount Id - The service account that will be used by the Log Router to access your Cloud KMS key.
- Logging
Service stringAccount Id - 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 string
- The organization for which to retrieve or configure settings.
- Storage
Location string - The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
- disable
Default BooleanSink - 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 StringName - The resource name for the configured Cloud KMS key.
- kms
Service StringAccount Id - The service account that will be used by the Log Router to access your Cloud KMS key.
- logging
Service StringAccount Id - 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 String
- The organization for which to retrieve or configure settings.
- storage
Location String - The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
- disable
Default booleanSink - 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 stringName - The resource name for the configured Cloud KMS key.
- kms
Service stringAccount Id - The service account that will be used by the Log Router to access your Cloud KMS key.
- logging
Service stringAccount Id - 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 string
- The organization for which to retrieve or configure settings.
- storage
Location string - The storage location that Cloud Logging will use to create new resources when a location is needed but not explicitly provided.
- disable_
default_ boolsink - 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_ strname - The resource name for the configured Cloud KMS key.
- kms_
service_ straccount_ id - The service account that will be used by the Log Router to access your Cloud KMS key.
- logging_
service_ straccount_ id - 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 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.
- disable
Default BooleanSink - 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 StringName - The resource name for the configured Cloud KMS key.
- kms
Service StringAccount Id - The service account that will be used by the Log Router to access your Cloud KMS key.
- logging
Service StringAccount Id - 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 String
- The organization for which to retrieve or configure settings.
- storage
Location 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
$ pulumi import gcp:logging/organizationSettings:OrganizationSettings default {{organization}}
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.