OrganizationBucketConfig class

Manages a organization-level logging bucket config. For more information see the official logging documentation and Storing Logs.

> Note: Logging buckets are automatically created for a given folder, project, organization, billingAccount and cannot be deleted. Creating a resource of this type will acquire and update the resource that already exists at the desired location. These buckets cannot be removed so deleting this resource will remove the bucket config from your state but will leave the logging bucket unchanged. The buckets that are currently automatically created are "_Default" and "_Required".

Example Usage

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

const _default = gcp.organizations.getOrganization({
    organization: "123456789",
});
const basic = new gcp.logging.OrganizationBucketConfig("basic", {
    organization: _default.then(_default => _default.organization),
    location: "global",
    retentionDays: 30,
    bucketId: "_Default",
    indexConfigs: [{
        fieldPath: "jsonPayload.request.status",
        type: "INDEX_TYPE_STRING",
    }],
});
import pulumi
import pulumi_gcp as gcp

default = gcp.organizations.get_organization(organization="123456789")
basic = gcp.logging.OrganizationBucketConfig("basic",
    organization=default.organization,
    location="global",
    retention_days=30,
    bucket_id="_Default",
    index_configs=[{
        "field_path": "jsonPayload.request.status",
        "type": "INDEX_TYPE_STRING",
    }])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var @default = Gcp.Organizations.GetOrganization.Invoke(new()
    {
        Organization = "123456789",
    });

    var basic = new Gcp.Logging.OrganizationBucketConfig("basic", new()
    {
        Organization = @default.Apply(@default => @default.Apply(getOrganizationResult => getOrganizationResult.Organization)),
        Location = "global",
        RetentionDays = 30,
        BucketId = "_Default",
        IndexConfigs = new[]
        {
            new Gcp.Logging.Inputs.OrganizationBucketConfigIndexConfigArgs
            {
                FieldPath = "jsonPayload.request.status",
                Type = "INDEX_TYPE_STRING",
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/logging"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := organizations.GetOrganization(ctx, &organizations.GetOrganizationArgs{
			Organization: pulumi.StringRef("123456789"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = logging.NewOrganizationBucketConfig(ctx, "basic", &logging.OrganizationBucketConfigArgs{
			Organization:  pulumi.String(_default.Organization),
			Location:      pulumi.String("global"),
			RetentionDays: pulumi.Int(30),
			BucketId:      pulumi.String("_Default"),
			IndexConfigs: logging.OrganizationBucketConfigIndexConfigArray{
				&logging.OrganizationBucketConfigIndexConfigArgs{
					FieldPath: pulumi.String("jsonPayload.request.status"),
					Type:      pulumi.String("INDEX_TYPE_STRING"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

data "gcp_organizations_getorganization" "default" {
  organization = "123456789"
}

resource "gcp_logging_organizationbucketconfig" "basic" {
  organization   = data.gcp_organizations_getorganization.default.organization
  location       = "global"
  retention_days = 30
  bucket_id      = "_Default"
  index_configs {
    field_path = "jsonPayload.request.status"
    type       = "INDEX_TYPE_STRING"
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetOrganizationArgs;
import com.pulumi.gcp.logging.OrganizationBucketConfig;
import com.pulumi.gcp.logging.OrganizationBucketConfigArgs;
import com.pulumi.gcp.logging.inputs.OrganizationBucketConfigIndexConfigArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 default = OrganizationsFunctions.getOrganization(GetOrganizationArgs.builder()
            .organization("123456789")
            .build());

        var basic = new OrganizationBucketConfig("basic", OrganizationBucketConfigArgs.builder()
            .organization(default_.organization())
            .location("global")
            .retentionDays(30)
            .bucketId("_Default")
            .indexConfigs(OrganizationBucketConfigIndexConfigArgs.builder()
                .fieldPath("jsonPayload.request.status")
                .type("INDEX_TYPE_STRING")
                .build())
            .build());

    }
}
resources:
  basic:
    type: gcp:logging:OrganizationBucketConfig
    properties:
      organization: ${default.organization}
      location: global
      retentionDays: 30
      bucketId: _Default
      indexConfigs:
        - fieldPath: jsonPayload.request.status
          type: INDEX_TYPE_STRING
variables:
  default:
    fn::invoke:
      function: gcp:organizations:getOrganization
      arguments:
        organization: '123456789'

Import

This resource can be imported using the following format:

  • organizations/{{organization}}/locations/{{location}}/buckets/{{bucket_id}}

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

$ pulumi import gcp:logging/organizationBucketConfig:OrganizationBucketConfig default organizations/{{organization}}/locations/{{location}}/buckets/{{bucket_id}}

Constructors

OrganizationBucketConfig(String name, {OrganizationBucketConfigArgs? args, CustomResourceOptions? options})
Creates a new OrganizationBucketConfig. name The Pulumi resource name. args Arguments used to configure this OrganizationBucketConfig. The set of arguments for OrganizationBucketConfig. options Resource options controlling this resource's behavior.
OrganizationBucketConfig.reference(String urn)
Creates a typed reference to an existing OrganizationBucketConfig resource.

Properties

bucketId ↔ Output<String>
The name of the logging bucket. Logging automatically creates two log buckets: _Required and _Default.
latefinal
childResources → Set<Resource>
finalinherited
cmekSettings ↔ Output<OrganizationBucketConfigCmekSettings?>
The CMEK settings of the log bucket. If present, new log entries written to this log bucket are encrypted using the CMEK key provided in this configuration. If a log bucket has CMEK settings, the CMEK settings cannot be disabled later by updating the log bucket. Changing the KMS key is allowed.
latefinal
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
deletionPolicy ↔ Output<String>
Whether Terraform will be prevented from destroying the resource. Defaults to "DELETE". When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
latefinal
description ↔ Output<String>
Describes this bucket.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
indexConfigs ↔ Output<List<OrganizationBucketConfigIndexConfig>>
A list of indexed fields and related configuration data. Structure is documented below.
latefinal
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
lifecycleState ↔ Output<String>
The bucket's lifecycle such as active or deleted. See LifecycleState.
latefinal
location ↔ Output<String>
The location of the bucket. The supported locations are: "global" "us-central1"
latefinal
name ↔ Output<String>
The resource name of the bucket. For example: "organizations/my-organization-id/locations/my-location/buckets/my-bucket-id"
latefinal
organization ↔ Output<String>
The parent resource that contains the logging bucket.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
retentionDays ↔ Output<int?>
Logs will be retained by default for this amount of time, after which they will automatically be deleted. The minimum retention period is 1 day. If this value is set to zero at bucket creation time, the default time of 30 days will be used. Bucket retention can not be increased on buckets outside of projects.
latefinal
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {OrganizationBucketConfigState? state, CustomResourceOptions? options}) → OrganizationBucketConfig
Gets an existing OrganizationBucketConfig resource's state with the given name and id.