import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Creates a Google Cloud Bigtable GC Policy inside a family. For more information see * [the official documentation](https://cloud.google.com/bigtable/) and * [API](https://cloud.google.com/bigtable/docs/go/reference). * * > **Warning**: We don't recommend having multiple GC policies for the same column * family as it may result in unexpected behavior. * * > **Note**: GC policies associated with a replicated table cannot be destroyed directly. * Destroying a GC policy is translated into never perform garbage collection, this is * considered relaxing from pure age-based or version-based GC policy, hence not allowed. * The workaround is unreplicating the instance first by updating the instance to have one * cluster. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const instance = new gcp.bigtable.Instance("instance", { * name: "tf-instance", * clusters: [{ * clusterId: "tf-instance-cluster", * numNodes: 3, * storageType: "HDD", * }], * }); * const table = new gcp.bigtable.Table("table", { * name: "tf-table", * instanceName: instance.name, * columnFamilies: [{ * family: "name", * }], * }); * const policy = new gcp.bigtable.GCPolicy("policy", { * instanceName: instance.name, * table: table.name, * columnFamily: "name", * deletionPolicy: "ABANDON", * gcRules: ` { * \\"rules\\": [ * { * \\"max_age\\": \\"168h\\" * } * ] * } * `, * }); * ``` * * Multiple conditions is also supported. `UNION` when any of its sub-policies apply (OR). `INTERSECTION` when all its sub-policies apply (AND) * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const policy = new gcp.bigtable.GCPolicy("policy", { * instanceName: instance.name, * table: table.name, * columnFamily: "name", * deletionPolicy: "ABANDON", * gcRules: ` { * \\"mode\\": \\"union\\", * \\"rules\\": [ * { * \\"max_age\\": \\"168h\\" * }, * { * \\"max_version\\": 10 * } * ] * } * `, * }); * ``` * * An example of more complex GC policy: * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const instance = new gcp.bigtable.Instance("instance", { * name: "instance_name", * clusters: [{ * clusterId: "cid", * zone: "us-central1-b", * }], * instanceType: "DEVELOPMENT", * deletionProtection: false, * }); * const table = new gcp.bigtable.Table("table", { * name: "your-table", * instanceName: instance.id, * columnFamilies: [{ * family: "cf1", * }], * }); * const policy = new gcp.bigtable.GCPolicy("policy", { * instanceName: instance.id, * table: table.name, * columnFamily: "cf1", * deletionPolicy: "ABANDON", * gcRules: ` { * \\"mode\\": \\"union\\", * \\"rules\\": [ * { * \\"max_age\\": \\"10h\\" * }, * { * \\"mode\\": \\"intersection\\", * \\"rules\\": [ * { * \\"max_age\\": \\"2h\\" * }, * { * \\"max_version\\": 2 * } * ] * } * ] * } * `, * }); * ``` * This is equivalent to running the following `cbt` command: * * ## Import * * This resource does not support import. */ export declare class GCPolicy extends pulumi.CustomResource { /** * Get an existing GCPolicy resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: GCPolicyState, opts?: pulumi.CustomResourceOptions): GCPolicy; /** * Returns true if the given object is an instance of GCPolicy. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is GCPolicy; /** * The name of the column family. */ readonly columnFamily: pulumi.Output; /** * The deletion policy for the GC policy. * Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for GC policy as it cannot be deleted in a replicated instance. * * Possible values are: `ABANDON`. */ readonly deletionPolicy: pulumi.Output; /** * Serialized JSON object to represent a more complex GC policy. Conflicts with `mode`, `maxAge` and `maxVersion`. Conflicts with `mode`, `maxAge` and `maxVersion`. */ readonly gcRules: pulumi.Output; /** * Boolean for whether to allow ignoring warnings when updating the gc policy. * Setting this to `true` allows relaxing the gc policy for replicated clusters by up to 90 days, but keep in mind this may increase how long clusters are inconsistent. Make sure * you understand the risks listed at https://cloud.google.com/bigtable/docs/garbage-collection#increasing before setting this option. * * ----- */ readonly ignoreWarnings: pulumi.Output; /** * The name of the Bigtable instance. */ readonly instanceName: pulumi.Output; /** * GC policy that applies to all cells older than the given age. */ readonly maxAge: pulumi.Output; /** * GC policy that applies to all versions of a cell except for the most recent. */ readonly maxVersions: pulumi.Output; /** * If multiple policies are set, you should choose between `UNION` OR `INTERSECTION`. */ readonly mode: pulumi.Output; /** * The ID of the project in which the resource belongs. If it is not provided, the provider project is used. */ readonly project: pulumi.Output; /** * The name of the table. */ readonly table: pulumi.Output; /** * Create a GCPolicy resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: GCPolicyArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering GCPolicy resources. */ export interface GCPolicyState { /** * The name of the column family. */ columnFamily?: pulumi.Input; /** * The deletion policy for the GC policy. * Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for GC policy as it cannot be deleted in a replicated instance. * * Possible values are: `ABANDON`. */ deletionPolicy?: pulumi.Input; /** * Serialized JSON object to represent a more complex GC policy. Conflicts with `mode`, `maxAge` and `maxVersion`. Conflicts with `mode`, `maxAge` and `maxVersion`. */ gcRules?: pulumi.Input; /** * Boolean for whether to allow ignoring warnings when updating the gc policy. * Setting this to `true` allows relaxing the gc policy for replicated clusters by up to 90 days, but keep in mind this may increase how long clusters are inconsistent. Make sure * you understand the risks listed at https://cloud.google.com/bigtable/docs/garbage-collection#increasing before setting this option. * * ----- */ ignoreWarnings?: pulumi.Input; /** * The name of the Bigtable instance. */ instanceName?: pulumi.Input; /** * GC policy that applies to all cells older than the given age. */ maxAge?: pulumi.Input; /** * GC policy that applies to all versions of a cell except for the most recent. */ maxVersions?: pulumi.Input[]>; /** * If multiple policies are set, you should choose between `UNION` OR `INTERSECTION`. */ mode?: pulumi.Input; /** * The ID of the project in which the resource belongs. If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * The name of the table. */ table?: pulumi.Input; } /** * The set of arguments for constructing a GCPolicy resource. */ export interface GCPolicyArgs { /** * The name of the column family. */ columnFamily: pulumi.Input; /** * The deletion policy for the GC policy. * Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for GC policy as it cannot be deleted in a replicated instance. * * Possible values are: `ABANDON`. */ deletionPolicy?: pulumi.Input; /** * Serialized JSON object to represent a more complex GC policy. Conflicts with `mode`, `maxAge` and `maxVersion`. Conflicts with `mode`, `maxAge` and `maxVersion`. */ gcRules?: pulumi.Input; /** * Boolean for whether to allow ignoring warnings when updating the gc policy. * Setting this to `true` allows relaxing the gc policy for replicated clusters by up to 90 days, but keep in mind this may increase how long clusters are inconsistent. Make sure * you understand the risks listed at https://cloud.google.com/bigtable/docs/garbage-collection#increasing before setting this option. * * ----- */ ignoreWarnings?: pulumi.Input; /** * The name of the Bigtable instance. */ instanceName: pulumi.Input; /** * GC policy that applies to all cells older than the given age. */ maxAge?: pulumi.Input; /** * GC policy that applies to all versions of a cell except for the most recent. */ maxVersions?: pulumi.Input[]>; /** * If multiple policies are set, you should choose between `UNION` OR `INTERSECTION`. */ mode?: pulumi.Input; /** * The ID of the project in which the resource belongs. If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * The name of the table. */ table: pulumi.Input; }