Billing Account Bucket Config Args
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/v7/go/gcp/logging"
"github.com/pulumi/pulumi-gcp/sdk/v7/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
})
}
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.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 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
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 thepulumi 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
Properties
The parent resource that contains the logging bucket.
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.
Describes this bucket.
A list of indexed fields and related configuration data. Structure is documented below.
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.