BillingAccountBucketConfig class
Manages a billing account 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.getBillingAccount({
billingAccount: "00AA00-000AAA-00AA0A",
});
const basic = new gcp.logging.BillingAccountBucketConfig("basic", {
billingAccount: _default.then(_default => _default.billingAccount),
location: "global",
retentionDays: 30,
bucketId: "_Default",
});
import pulumi
import pulumi_gcp as gcp
default = gcp.organizations.get_billing_account(billing_account="00AA00-000AAA-00AA0A")
basic = gcp.logging.BillingAccountBucketConfig("basic",
billing_account=default.billing_account,
location="global",
retention_days=30,
bucket_id="_Default")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var @default = Gcp.Organizations.GetBillingAccount.Invoke(new()
{
BillingAccount = "00AA00-000AAA-00AA0A",
});
var basic = new Gcp.Logging.BillingAccountBucketConfig("basic", new()
{
BillingAccount = @default.Apply(@default => @default.Apply(getBillingAccountResult => getBillingAccountResult.BillingAccount)),
Location = "global",
RetentionDays = 30,
BucketId = "_Default",
});
});
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.GetBillingAccount(ctx, &organizations.GetBillingAccountArgs{
BillingAccount: pulumi.StringRef("00AA00-000AAA-00AA0A"),
}, nil)
if err != nil {
return err
}
_, err = logging.NewBillingAccountBucketConfig(ctx, "basic", &logging.BillingAccountBucketConfigArgs{
BillingAccount: pulumi.String(_default.BillingAccount),
Location: pulumi.String("global"),
RetentionDays: pulumi.Int(30),
BucketId: pulumi.String("_Default"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
data "gcp_organizations_getbillingaccount" "default" {
billing_account = "00AA00-000AAA-00AA0A"
}
resource "gcp_logging_billingaccountbucketconfig" "basic" {
billing_account = data.gcp_organizations_getbillingaccount.default.billing_account
location = "global"
retention_days = 30
bucket_id = "_Default"
}
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.GetBillingAccountArgs;
import com.pulumi.gcp.logging.BillingAccountBucketConfig;
import com.pulumi.gcp.logging.BillingAccountBucketConfigArgs;
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.getBillingAccount(GetBillingAccountArgs.builder()
.billingAccount("00AA00-000AAA-00AA0A")
.build());
var basic = new BillingAccountBucketConfig("basic", BillingAccountBucketConfigArgs.builder()
.billingAccount(default_.billingAccount())
.location("global")
.retentionDays(30)
.bucketId("_Default")
.build());
}
}
resources:
basic:
type: gcp:logging:BillingAccountBucketConfig
properties:
billingAccount: ${default.billingAccount}
location: global
retentionDays: 30
bucketId: _Default
variables:
default:
fn::invoke:
function: gcp:organizations:getBillingAccount
arguments:
billingAccount: 00AA00-000AAA-00AA0A
Create logging bucket with index configs
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const example_billing_account_bucket_index_configs = new gcp.logging.BillingAccountBucketConfig("example-billing-account-bucket-index-configs", {
folder: _default.billingAccount,
location: "global",
retentionDays: 30,
bucketId: "_Default",
indexConfigs: [{
fieldPath: "jsonPayload.request.status",
type: "INDEX_TYPE_STRING",
}],
});
import pulumi
import pulumi_gcp as gcp
example_billing_account_bucket_index_configs = gcp.logging.BillingAccountBucketConfig("example-billing-account-bucket-index-configs",
folder=default["billingAccount"],
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 example_billing_account_bucket_index_configs = new Gcp.Logging.BillingAccountBucketConfig("example-billing-account-bucket-index-configs", new()
{
Folder = @default.BillingAccount,
Location = "global",
RetentionDays = 30,
BucketId = "_Default",
IndexConfigs = new[]
{
new Gcp.Logging.Inputs.BillingAccountBucketConfigIndexConfigArgs
{
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/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := logging.NewBillingAccountBucketConfig(ctx, "example-billing-account-bucket-index-configs", &logging.BillingAccountBucketConfigArgs{
Folder: _default.BillingAccount,
Location: pulumi.String("global"),
RetentionDays: pulumi.Int(30),
BucketId: pulumi.String("_Default"),
IndexConfigs: logging.BillingAccountBucketConfigIndexConfigArray{
&logging.BillingAccountBucketConfigIndexConfigArgs{
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"
}
}
}
resource "gcp_logging_billingaccountbucketconfig" "example-billing-account-bucket-index-configs" {
folder = default.billingAccount
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.logging.BillingAccountBucketConfig;
import com.pulumi.gcp.logging.BillingAccountBucketConfigArgs;
import com.pulumi.gcp.logging.inputs.BillingAccountBucketConfigIndexConfigArgs;
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) {
var example_billing_account_bucket_index_configs = new BillingAccountBucketConfig("example-billing-account-bucket-index-configs", BillingAccountBucketConfigArgs.builder()
.folder(default_.get("billingAccount"))
.location("global")
.retentionDays(30)
.bucketId("_Default")
.indexConfigs(BillingAccountBucketConfigIndexConfigArgs.builder()
.fieldPath("jsonPayload.request.status")
.type("INDEX_TYPE_STRING")
.build())
.build());
}
}
resources:
example-billing-account-bucket-index-configs:
type: gcp:logging:BillingAccountBucketConfig
properties:
folder: ${default.billingAccount}
location: global
retentionDays: 30
bucketId: _Default
indexConfigs:
- fieldPath: jsonPayload.request.status
type: INDEX_TYPE_STRING
Import
This resource can be imported using the following format:
billingAccounts/{{billingAccount}}/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/billingAccountBucketConfig:BillingAccountBucketConfig default billingAccounts/{{billingAccount}}/locations/{{location}}/buckets/{{bucket_id}}
Constructors
- BillingAccountBucketConfig(String name, {BillingAccountBucketConfigArgs? args, CustomResourceOptions? options})
-
Creates a new BillingAccountBucketConfig.
nameThe Pulumi resource name.argsArguments used to configure this BillingAccountBucketConfig. The set of arguments for BillingAccountBucketConfig.optionsResource options controlling this resource's behavior. - BillingAccountBucketConfig.reference(String urn)
- Creates a typed reference to an existing BillingAccountBucketConfig resource.
Properties
-
billingAccount
↔ Output<
String> -
The parent resource that contains the logging bucket.
latefinal
-
bucketId
↔ Output<
String> -
The name of the logging bucket. Logging automatically creates two log buckets:
_Requiredand_Default.latefinal -
childResources
→ Set<
Resource> -
finalinherited
-
cmekSettings
↔ Output<
BillingAccountBucketConfigCmekSettings?> -
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< BillingAccountBucketConfigIndexConfig> > -
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.
latefinal
-
name
↔ Output<
String> -
The resource name of the bucket. For example: "projects/my-project-id/locations/my-location/buckets/my-bucket-id"
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, {BillingAccountBucketConfigState? state, CustomResourceOptions? options}) → BillingAccountBucketConfig -
Gets an existing BillingAccountBucketConfig resource's state with the given
nameandid.