@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
342 lines • 12.9 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* Represents an Autoscaler resource.
*
* Autoscalers allow you to automatically scale virtual machine instances in
* managed instance groups according to an autoscaling policy that you
* define.
*
* To get more information about Autoscaler, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/autoscalers)
* * How-to Guides
* * [Autoscaling Groups of Instances](https://cloud.google.com/compute/docs/autoscaler/)
*
* ## Example Usage
*
* ### Autoscaler Single Instance
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const debian9 = gcp.compute.getImage({
* family: "debian-11",
* project: "debian-cloud",
* });
* const defaultInstanceTemplate = new gcp.compute.InstanceTemplate("default", {
* name: "my-instance-template",
* machineType: "e2-medium",
* canIpForward: false,
* tags: [
* "foo",
* "bar",
* ],
* disks: [{
* sourceImage: debian9.then(debian9 => debian9.id),
* }],
* networkInterfaces: [{
* network: "default",
* }],
* metadata: {
* foo: "bar",
* },
* serviceAccount: {
* scopes: [
* "userinfo-email",
* "compute-ro",
* "storage-ro",
* ],
* },
* });
* const defaultTargetPool = new gcp.compute.TargetPool("default", {name: "my-target-pool"});
* const defaultInstanceGroupManager = new gcp.compute.InstanceGroupManager("default", {
* name: "my-igm",
* zone: "us-central1-f",
* versions: [{
* instanceTemplate: defaultInstanceTemplate.id,
* name: "primary",
* }],
* targetPools: [defaultTargetPool.id],
* baseInstanceName: "autoscaler-sample",
* });
* const _default = new gcp.compute.Autoscaler("default", {
* name: "my-autoscaler",
* zone: "us-central1-f",
* target: defaultInstanceGroupManager.id,
* autoscalingPolicy: {
* maxReplicas: 5,
* minReplicas: 1,
* cooldownPeriod: 60,
* stabilizationPeriod: 300,
* metrics: [{
* name: "pubsub.googleapis.com/subscription/num_undelivered_messages",
* filter: "resource.type = pubsub_subscription AND resource.label.subscription_id = our-subscription",
* singleInstanceAssignment: 65535,
* }],
* },
* });
* ```
* ### Autoscaler Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const debian9 = gcp.compute.getImage({
* family: "debian-11",
* project: "debian-cloud",
* });
* const foobarInstanceTemplate = new gcp.compute.InstanceTemplate("foobar", {
* name: "my-instance-template",
* machineType: "e2-medium",
* canIpForward: false,
* tags: [
* "foo",
* "bar",
* ],
* disks: [{
* sourceImage: debian9.then(debian9 => debian9.id),
* }],
* networkInterfaces: [{
* network: "default",
* }],
* metadata: {
* foo: "bar",
* },
* serviceAccount: {
* scopes: [
* "userinfo-email",
* "compute-ro",
* "storage-ro",
* ],
* },
* });
* const foobarTargetPool = new gcp.compute.TargetPool("foobar", {name: "my-target-pool"});
* const foobarInstanceGroupManager = new gcp.compute.InstanceGroupManager("foobar", {
* name: "my-igm",
* zone: "us-central1-f",
* versions: [{
* instanceTemplate: foobarInstanceTemplate.id,
* name: "primary",
* }],
* targetPools: [foobarTargetPool.id],
* baseInstanceName: "foobar",
* });
* const foobar = new gcp.compute.Autoscaler("foobar", {
* name: "my-autoscaler",
* zone: "us-central1-f",
* target: foobarInstanceGroupManager.id,
* autoscalingPolicy: {
* maxReplicas: 5,
* minReplicas: 1,
* cooldownPeriod: 60,
* stabilizationPeriod: 300,
* cpuUtilization: {
* target: 0.5,
* },
* },
* });
* ```
*
* ## Import
*
* Autoscaler can be imported using any of these accepted formats:
*
* * `projects/{{project}}/zones/{{zone}}/autoscalers/{{name}}`
* * `{{project}}/{{zone}}/{{name}}`
* * `{{zone}}/{{name}}`
* * `{{name}}`
*
* When using the `pulumi import` command, Autoscaler can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/autoscaler:Autoscaler default projects/{{project}}/zones/{{zone}}/autoscalers/{{name}}
* $ pulumi import gcp:compute/autoscaler:Autoscaler default {{project}}/{{zone}}/{{name}}
* $ pulumi import gcp:compute/autoscaler:Autoscaler default {{zone}}/{{name}}
* $ pulumi import gcp:compute/autoscaler:Autoscaler default {{name}}
* ```
*/
export declare class Autoscaler extends pulumi.CustomResource {
/**
* Get an existing Autoscaler 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<pulumi.ID>, state?: AutoscalerState, opts?: pulumi.CustomResourceOptions): Autoscaler;
/**
* Returns true if the given object is an instance of Autoscaler. 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 Autoscaler;
/**
* The configuration parameters for the autoscaling algorithm. You can
* define one or more of the policies for an autoscaler: cpuUtilization,
* customMetricUtilizations, and loadBalancingUtilization.
* If none of these are specified, the default will be to autoscale based
* on cpuUtilization to 0.6 or 60%.
* Structure is documented below.
*/
readonly autoscalingPolicy: pulumi.Output<outputs.compute.AutoscalerAutoscalingPolicy>;
/**
* Creation timestamp in RFC3339 text format.
*/
readonly creationTimestamp: pulumi.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.
*/
readonly deletionPolicy: pulumi.Output<string>;
/**
* An optional description of this resource.
*/
readonly description: pulumi.Output<string | undefined>;
/**
* Name of the resource. The name must be 1-63 characters long and match
* the regular expression `a-z?` which means the
* first character must be a lowercase letter, and all following
* characters must be a dash, lowercase letter, or digit, except the last
* character, which cannot be a dash.
*/
readonly name: pulumi.Output<string>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
readonly project: pulumi.Output<string>;
/**
* The URI of the created resource.
*/
readonly selfLink: pulumi.Output<string>;
/**
* URL of the managed instance group that this autoscaler will scale.
*/
readonly target: pulumi.Output<string>;
/**
* URL of the zone where the instance group resides.
*/
readonly zone: pulumi.Output<string>;
/**
* Create a Autoscaler 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: AutoscalerArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Autoscaler resources.
*/
export interface AutoscalerState {
/**
* The configuration parameters for the autoscaling algorithm. You can
* define one or more of the policies for an autoscaler: cpuUtilization,
* customMetricUtilizations, and loadBalancingUtilization.
* If none of these are specified, the default will be to autoscale based
* on cpuUtilization to 0.6 or 60%.
* Structure is documented below.
*/
autoscalingPolicy?: pulumi.Input<inputs.compute.AutoscalerAutoscalingPolicy | undefined>;
/**
* Creation timestamp in RFC3339 text format.
*/
creationTimestamp?: pulumi.Input<string | undefined>;
/**
* 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.
*/
deletionPolicy?: pulumi.Input<string | undefined>;
/**
* An optional description of this resource.
*/
description?: pulumi.Input<string | undefined>;
/**
* Name of the resource. The name must be 1-63 characters long and match
* the regular expression `a-z?` which means the
* first character must be a lowercase letter, and all following
* characters must be a dash, lowercase letter, or digit, except the last
* character, which cannot be a dash.
*/
name?: pulumi.Input<string | undefined>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string | undefined>;
/**
* The URI of the created resource.
*/
selfLink?: pulumi.Input<string | undefined>;
/**
* URL of the managed instance group that this autoscaler will scale.
*/
target?: pulumi.Input<string | undefined>;
/**
* URL of the zone where the instance group resides.
*/
zone?: pulumi.Input<string | undefined>;
}
/**
* The set of arguments for constructing a Autoscaler resource.
*/
export interface AutoscalerArgs {
/**
* The configuration parameters for the autoscaling algorithm. You can
* define one or more of the policies for an autoscaler: cpuUtilization,
* customMetricUtilizations, and loadBalancingUtilization.
* If none of these are specified, the default will be to autoscale based
* on cpuUtilization to 0.6 or 60%.
* Structure is documented below.
*/
autoscalingPolicy: pulumi.Input<inputs.compute.AutoscalerAutoscalingPolicy>;
/**
* 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.
*/
deletionPolicy?: pulumi.Input<string | undefined>;
/**
* An optional description of this resource.
*/
description?: pulumi.Input<string | undefined>;
/**
* Name of the resource. The name must be 1-63 characters long and match
* the regular expression `a-z?` which means the
* first character must be a lowercase letter, and all following
* characters must be a dash, lowercase letter, or digit, except the last
* character, which cannot be a dash.
*/
name?: pulumi.Input<string | undefined>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string | undefined>;
/**
* URL of the managed instance group that this autoscaler will scale.
*/
target: pulumi.Input<string>;
/**
* URL of the zone where the instance group resides.
*/
zone?: pulumi.Input<string | undefined>;
}
//# sourceMappingURL=autoscaler.d.ts.map