CapacityCommitment class

Capacity commitment is a way to purchase compute capacity for BigQuery jobs (in the form of slots) with some committed period of usage. Annual commitments renew by default. Commitments can be removed after their commitment end time passes.

In order to remove annual commitment, its plan needs to be changed to monthly or flex first.

To get more information about CapacityCommitment, see:

Example Usage

Bigquery Reservation Capacity Commitment Docs

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

const example = new gcp.bigquery.CapacityCommitment("example", {
    capacityCommitmentId: "example-commitment",
    location: "us-west2",
    slotCount: 100,
    plan: "FLEX_FLAT_RATE",
    edition: "ENTERPRISE",
});
import pulumi
import pulumi_gcp as gcp

example = gcp.bigquery.CapacityCommitment("example",
    capacity_commitment_id="example-commitment",
    location="us-west2",
    slot_count=100,
    plan="FLEX_FLAT_RATE",
    edition="ENTERPRISE")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var example = new Gcp.BigQuery.CapacityCommitment("example", new()
    {
        CapacityCommitmentId = "example-commitment",
        Location = "us-west2",
        SlotCount = 100,
        Plan = "FLEX_FLAT_RATE",
        Edition = "ENTERPRISE",
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := bigquery.NewCapacityCommitment(ctx, "example", &bigquery.CapacityCommitmentArgs{
			CapacityCommitmentId: pulumi.String("example-commitment"),
			Location:             pulumi.String("us-west2"),
			SlotCount:            pulumi.Int(100),
			Plan:                 pulumi.String("FLEX_FLAT_RATE"),
			Edition:              pulumi.String("ENTERPRISE"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_bigquery_capacitycommitment" "example" {
  capacity_commitment_id = "example-commitment"
  location               = "us-west2"
  slot_count             = 100
  plan                   = "FLEX_FLAT_RATE"
  edition                = "ENTERPRISE"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.bigquery.CapacityCommitment;
import com.pulumi.gcp.bigquery.CapacityCommitmentArgs;
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 = new CapacityCommitment("example", CapacityCommitmentArgs.builder()
            .capacityCommitmentId("example-commitment")
            .location("us-west2")
            .slotCount(100)
            .plan("FLEX_FLAT_RATE")
            .edition("ENTERPRISE")
            .build());

    }
}
resources:
  example:
    type: gcp:bigquery:CapacityCommitment
    properties:
      capacityCommitmentId: example-commitment
      location: us-west2
      slotCount: 100
      plan: FLEX_FLAT_RATE
      edition: ENTERPRISE

Import

CapacityCommitment can be imported using any of these accepted formats:

  • projects/{{project}}/locations/{{location}}/capacityCommitments/{{capacity_commitment_id}}
  • {{project}}/{{location}}/{{capacity_commitment_id}}
  • {{location}}/{{capacity_commitment_id}}

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

$ pulumi import gcp:bigquery/capacityCommitment:CapacityCommitment default projects/{{project}}/locations/{{location}}/capacityCommitments/{{capacity_commitment_id}}
$ pulumi import gcp:bigquery/capacityCommitment:CapacityCommitment default {{project}}/{{location}}/{{capacity_commitment_id}}
$ pulumi import gcp:bigquery/capacityCommitment:CapacityCommitment default {{location}}/{{capacity_commitment_id}}

Constructors

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

Properties

capacityCommitmentId ↔ Output<String?>
The optional capacity commitment ID. Capacity commitment name will be generated automatically if this field is empty. This field must only contain lower case alphanumeric characters or dashes. The first and last character cannot be a dash. Max length is 64 characters. NOTE: this ID won't be kept if the capacity commitment is split or merged.
latefinal
childResources → Set<Resource>
finalinherited
commitmentEndTime ↔ Output<String>
The start of the current commitment period. It is applicable only for ACTIVE capacity commitments.
latefinal
commitmentStartTime ↔ Output<String>
The start of the current commitment period. It is applicable only for ACTIVE capacity commitments.
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
edition ↔ Output<String?>
The edition type. Valid values are STANDARD, ENTERPRISE, ENTERPRISE_PLUS
latefinal
enforceSingleAdminProjectPerOrg ↔ Output<String?>
If true, fail the request if another project in the organization has a capacity commitment.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
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
location ↔ Output<String?>
The geographic location where the transfer config should reside. Examples: US, EU, asia-northeast1. The default value is US.
latefinal
name ↔ Output<String>
The resource name of the capacity commitment, e.g., projects/myproject/locations/US/capacityCommitments/123
latefinal
plan ↔ Output<String>
Capacity commitment plan. Valid values are at https://cloud.google.com/bigquery/docs/reference/reservations/rpc/google.cloud.bigquery.reservation.v1#commitmentplan
latefinal
project ↔ Output<String>
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
latefinal
renewalPlan ↔ Output<String?>
The plan this capacity commitment is converted to after commitmentEndTime passes. Once the plan is changed, committed period is extended according to commitment plan. Only applicable for some commitment plans.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
slotCount ↔ Output<int>
Number of slots in this commitment.
latefinal
state ↔ Output<String>
State of the commitment
latefinal
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, {CapacityCommitmentState? state, CustomResourceOptions? options}) → CapacityCommitment
Gets an existing CapacityCommitment resource's state with the given name and id.