Module gcp
This provider is a derived work of the Terraform Provider distributed under MPL 2.0. If you encounter a bug or missing feature, first check the
pulumi/pulumi-spotinstrepo; however, if that doesn’t turn up anything, please consult the sourceterraform-providers/terraform-provider-spotinstrepo.
Resources
Others
Resources
Resource Elastigroup
class Elastigroup extends CustomResourceProvides a Spotinst elastigroup GCP resource.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as spotinst from "@pulumi/spotinst";
const example = new spotinst.gcp.Elastigroup("example", {
availabilityZones: [
"asia-east1-c",
"us-central1-a",
],
backendServicesConfig: [{
ports: [{
portName: "port-name",
ports: [
8000,
6000,
],
}],
serviceName: "spotinst-elb-backend-service",
}],
description: "spotinst gcp group",
desiredCapacity: 1,
disks: [{
autoDelete: true,
boot: true,
deviceName: "device",
initializeParams: [{
diskSizeGb: 10,
diskType: "pd-standard",
sourceImage: "",
}],
interface: "SCSI",
mode: "READ_WRITE",
type: "PERSISTENT",
}],
drainingTimeout: 180,
// onDemandCount = 2
fallbackToOndemand: true,
instanceTypesCustoms: [{
memoryGiB: 7.5,
vCPU: 2,
}],
instanceTypesOndemand: ["n1-standard-1"],
instanceTypesPreemptibles: [
"n1-standard-1",
"n1-standard-2",
],
labels: [{
key: "testKey",
value: "testValue",
}],
maxSize: 1,
minSize: 0,
networkInterfaces: [{
network: "spot-network",
}],
preemptiblePercentage: 50,
scaling: [{
up: [{
action: [{
adjustment: 1,
type: "adjustment",
}],
cooldown: 300,
dimensions: [{
name: "storageType",
value: "pd-ssd",
}],
evaluationPeriods: 1,
metricName: "instance/disk/read_ops_count",
namespace: "compute",
operator: "gte",
period: 300,
policyName: "scaleUp1",
source: "stackdriver",
statistic: "average",
threshold: 10000,
unit: "percent",
}],
}],
serviceAccount: "example@myProject.iam.gservicecct.com",
startupScript: "",
subnets: [{
region: "asia-east1",
subnetNames: "",
}],
tags: [
"http",
"https",
],
});GPU
gpu- (Optional) Defines the GPU configuration.type- (Required) The type of GPU instance. Valid values:nvidia-tesla-v100,nvidia-tesla-p100,nvidia-tesla-k80.count- (Required) The number of GPUs. Must be 0, 2, 4, 6, 8.
Usage:
import * as pulumi from "@pulumi/pulumi";Backend Services
backendServices- (Optional) Describes the backend service configurations.serviceName- (Required) The name of the backend service.locationType- (Optional) Sets which location the backend services will be active. Valid values:regional,global.scheme- (Optional) Use whenlocationTypeis “regional”. Set the traffic for the backend service to either between the instances in the vpc or to traffic from the internet. Valid values:INTERNAL,EXTERNAL.namedPort- (Optional) Describes a named port and a list of ports.portName- (Required) The name of the port.ports- (Required) A list of ports.
Usage:
import * as pulumi from "@pulumi/pulumi";Disks
disks- (Optional) Array of disks associated with this instance. Persistent disks must be created before you can assign them.autoDelete- (Optional) Specifies whether the disk will be auto-deleted when the instance is deleted.boot- (Optional) Indicates that this is a boot disk. The virtual machine will use the first partition of the disk for its root filesystem.deviceName- (Optional) Specifies a unique device name of your choice.interface- (Optional, Default:SCSI) Specifies the disk interface to use for attaching this disk, which is either SCSI or NVME.mode- (Optional, Default:READ_WRITE) The mode in which to attach this disk, either READ_WRITE or READ_ONLY.source- (Optional) Specifies a valid partial or full URL to an existing Persistent Disk resource. This field is only applicable for persistent disks.type- (Optional, Default:PERSISTENT) Specifies the type of disk, either SCRATCH or PERSISTENT.initializeParams- (Optional) Specifies the parameters for a new disk that will be created alongside the new instance. Use initialization parameters to create boot disks or local SSDs attached to the new instance.diskSizeGb- (Optional) Specifies disk size in gigabytes. Must be in increments of 2.diskType- (Optional, Default”pd-standard) Specifies the disk type to use to create the instance. Valid values: pd-ssd, local-ssd.sourceImage- (Optional) A source image used to create the disk. You can provide a private (custom) image, and Compute Engine will use the corresponding image from your project.
Usage:
import * as pulumi from "@pulumi/pulumi";Network Interfaces
Each of the networkInterface attributes controls a portion of the GCP
Instance’s “Network Interfaces”. It’s a good idea to familiarize yourself with GCP’s Network
Interfaces docs
to understand the implications of using these attributes.
networkInterface- (Required, minimum 1) Array of objects representing the network configuration for the elastigroup.network- (Required) Network resource for this group.accessConfigs- (Optional) Array of configurations.name- (Optional) Name of this access configuration.type- (Optional) Array of configurations for this interface. Currently, only ONE_TO_ONE_NAT is supported.
import * as pulumi from "@pulumi/pulumi";Scaling Policies
scalingUpPolicy- (Optional) Contains scaling policies for scaling the Elastigroup up.scalingDownPolicy- (Optional) Contains scaling policies for scaling the Elastigroup down.
Each scaling_*_policy supports the following:
policyName- (Optional) Name of scaling policy.metricName- (Optional) Metric to monitor. Valid values: “Percentage CPU”, “Network In”, “Network Out”, “Disk Read Bytes”, “Disk Write Bytes”, “Disk Write Operations/Sec”, “Disk Read Operations/Sec”.statistic- (Optional) Statistic by which to evaluate the selected metric. Valid values: “AVERAGE”, “SAMPLE_COUNT”, “SUM”, “MINIMUM”, “MAXIMUM”, “PERCENTILE”, “COUNT”.threshold- (Optional) The value at which the scaling action is triggered.period- (Optional) Amount of time (seconds) for which the threshold must be met in order to trigger the scaling action.evaluationPeriods- (Optional) Number of consecutive periods in which the threshold must be met in order to trigger a scaling action.cooldown- (Optional) Time (seconds) to wait after a scaling action before resuming monitoring.operator- (Optional) The operator used to evaluate the threshold against the current metric value. Valid values: “gt” (greater than), “get” (greater-than or equal), “lt” (less than), “lte” (less than or equal).action- (Optional) Scaling action to take when the policy is triggered.type- (Optional) Type of scaling action to take when the scaling policy is triggered. Valid values: “adjustment”, “setMinTarget”, “updateCapacity”, “percentageAdjustment”adjustment- (Optional) Value to which the action type will be adjusted. Required if using “numeric” or “percentageAdjustment” action types.
dimensions- (Optional) A list of dimensions describing qualities of the metric.name- (Required) The dimension name.value- (Required) The dimension value.
Usage:
import * as pulumi from "@pulumi/pulumi";Third-Party Integrations
integrationDockerSwarm- (Optional) Describes the Docker Swarm integration.masterHost- (Required) IP or FQDN of one of your swarm managers.masterPort- (Required) Network port used by your swarm.
Usage:
import * as pulumi from "@pulumi/pulumi";Scheduled Tasks
Each scheduledTask supports the following:
taskType- (Required) The task type to run. Valid values:"setCapacity".cronExpression- (Optional) A valid cron expression. The cron is running in UTC time zone and is in Unix cron format.isEnabled- (Optional, Default:true) Setting the task to being enabled or disabled.targetCapacity- (Optional) The desired number of instances the group should have.minCapacity- (Optional) The minimum number of instances the group should have.maxCapacity- (Optional) The maximum number of instances the group should have.
Usage:
import * as pulumi from "@pulumi/pulumi";constructor
new Elastigroup(name: string, args: ElastigroupArgs, opts?: pulumi.CustomResourceOptions)Create a Elastigroup resource with the given unique name, arguments, and options.
nameThe unique name of the resource.argsThe arguments to use to populate this resource's properties.optsA bag of options that control this resource's behavior.
method get
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: ElastigroupState, opts?: pulumi.CustomResourceOptions): ElastigroupGet an existing Elastigroup resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefinedmethod isInstance
public static isInstance(obj: any): obj is ElastigroupReturns true if the given object is an instance of Elastigroup. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
property autoHealing
public autoHealing: pulumi.Output<boolean | undefined>;property availabilityZones
public availabilityZones: pulumi.Output<string[] | undefined>;List of availability zones for the group.
property backendServices
public backendServices: pulumi.Output<ElastigroupBackendService[] | undefined>;property description
public description: pulumi.Output<string | undefined>;The region your GCP group will be created in.
property desiredCapacity
public desiredCapacity: pulumi.Output<number>;The desired number of instances the group should have at any time.
property disks
public disks: pulumi.Output<ElastigroupDisk[] | undefined>;property drainingTimeout
public drainingTimeout: pulumi.Output<number | undefined>;Time (seconds) the instance is allowed to run after it is detached from the group. This is to allow the instance time to drain all the current TCP connections before terminating it.
property fallbackToOndemand
public fallbackToOndemand: pulumi.Output<boolean | undefined>;Activate fallback-to-on-demand. When provisioning an instance, if no Preemptible market is available, fallback-to-on-demand will provision an On-Demand instance to maintain the group capacity.
property gpu
public gpu: pulumi.Output<ElastigroupGpu[] | undefined>;property healthCheckGracePeriod
public healthCheckGracePeriod: pulumi.Output<number | undefined>;property healthCheckType
public healthCheckType: pulumi.Output<string | undefined>;property id
id: Output<ID>;id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.
property instanceTypesCustoms
public instanceTypesCustoms: pulumi.Output<ElastigroupInstanceTypesCustom[] | undefined>;Defines a set of custom instance types. Required if instanceTypesPreemptible and instanceTypesOndemand are not set.
property instanceTypesOndemand
public instanceTypesOndemand: pulumi.Output<string | undefined>;The regular VM instance type to use for mixed-type groups and when falling back to on-demand. Required if instanceTypesPreemptible is not set.
property instanceTypesPreemptibles
public instanceTypesPreemptibles: pulumi.Output<string[] | undefined>;The preemptible VMs instance type. To maximize cost savings and market availability, select as many types as possible. Required if instanceTypesOndemand is not set.
property integrationDockerSwarm
public integrationDockerSwarm: pulumi.Output<ElastigroupIntegrationDockerSwarm | undefined>;property integrationGke
public integrationGke: pulumi.Output<ElastigroupIntegrationGke | undefined>;property ipForwarding
public ipForwarding: pulumi.Output<boolean | undefined>;property labels
public labels: pulumi.Output<ElastigroupLabel[] | undefined>;Array of objects with key-value pairs.
property maxSize
public maxSize: pulumi.Output<number>;The maximum number of instances the group should have at any time.
property metadatas
public metadatas: pulumi.Output<ElastigroupMetadata[] | undefined>;Array of objects with key-value pairs.
property minSize
public minSize: pulumi.Output<number>;The minimum number of instances the group should have at any time.
property name
public name: pulumi.Output<string>;The group name.
property networkInterfaces
public networkInterfaces: pulumi.Output<ElastigroupNetworkInterface[] | undefined>;property ondemandCount
public ondemandCount: pulumi.Output<number | undefined>;property preemptiblePercentage
public preemptiblePercentage: pulumi.Output<number | undefined>;Percentage of Preemptible VMs to spin up from the “desiredCapacity”.
property scalingDownPolicies
public scalingDownPolicies: pulumi.Output<ElastigroupScalingDownPolicy[] | undefined>;property scalingUpPolicies
public scalingUpPolicies: pulumi.Output<ElastigroupScalingUpPolicy[] | undefined>;property scheduledTasks
public scheduledTasks: pulumi.Output<ElastigroupScheduledTask[] | undefined>;property serviceAccount
public serviceAccount: pulumi.Output<string | undefined>;The email of the service account in which the group instances will be launched.
property shutdownScript
public shutdownScript: pulumi.Output<string | undefined>;The Base64-encoded shutdown script that executes prior to instance termination, for more information please see: Shutdown Script
property startupScript
public startupScript: pulumi.Output<string | undefined>;Create and run your own startup scripts on your virtual machines to perform automated tasks every time your instance boots up.
property subnets
public subnets: pulumi.Output<ElastigroupSubnet[] | undefined>;A list of regions and subnets.
property tags
public tags: pulumi.Output<string[] | undefined>;Tags to mark created instances.
property unhealthyDuration
public unhealthyDuration: pulumi.Output<number | undefined>;property urn
urn: Output<URN>;urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
Others
interface ElastigroupArgs
interface ElastigroupArgsThe set of arguments for constructing a Elastigroup resource.
property autoHealing
autoHealing?: pulumi.Input<boolean>;property availabilityZones
availabilityZones?: pulumi.Input<pulumi.Input<string>[]>;List of availability zones for the group.
property backendServices
backendServices?: pulumi.Input<pulumi.Input<ElastigroupBackendService>[]>;property description
description?: pulumi.Input<string>;The region your GCP group will be created in.
property desiredCapacity
desiredCapacity: pulumi.Input<number>;The desired number of instances the group should have at any time.
property disks
disks?: pulumi.Input<pulumi.Input<ElastigroupDisk>[]>;property drainingTimeout
drainingTimeout?: pulumi.Input<number>;Time (seconds) the instance is allowed to run after it is detached from the group. This is to allow the instance time to drain all the current TCP connections before terminating it.
property fallbackToOndemand
fallbackToOndemand?: pulumi.Input<boolean>;Activate fallback-to-on-demand. When provisioning an instance, if no Preemptible market is available, fallback-to-on-demand will provision an On-Demand instance to maintain the group capacity.
property gpu
gpu?: pulumi.Input<pulumi.Input<ElastigroupGpu>[]>;property healthCheckGracePeriod
healthCheckGracePeriod?: pulumi.Input<number>;property healthCheckType
healthCheckType?: pulumi.Input<string>;property instanceTypesCustoms
instanceTypesCustoms?: pulumi.Input<pulumi.Input<ElastigroupInstanceTypesCustom>[]>;Defines a set of custom instance types. Required if instanceTypesPreemptible and instanceTypesOndemand are not set.
property instanceTypesOndemand
instanceTypesOndemand?: pulumi.Input<string>;The regular VM instance type to use for mixed-type groups and when falling back to on-demand. Required if instanceTypesPreemptible is not set.
property instanceTypesPreemptibles
instanceTypesPreemptibles?: pulumi.Input<pulumi.Input<string>[]>;The preemptible VMs instance type. To maximize cost savings and market availability, select as many types as possible. Required if instanceTypesOndemand is not set.
property integrationDockerSwarm
integrationDockerSwarm?: pulumi.Input<ElastigroupIntegrationDockerSwarm>;property integrationGke
integrationGke?: pulumi.Input<ElastigroupIntegrationGke>;property ipForwarding
ipForwarding?: pulumi.Input<boolean>;property labels
labels?: pulumi.Input<pulumi.Input<ElastigroupLabel>[]>;Array of objects with key-value pairs.
property maxSize
maxSize?: pulumi.Input<number>;The maximum number of instances the group should have at any time.
property metadatas
metadatas?: pulumi.Input<pulumi.Input<ElastigroupMetadata>[]>;Array of objects with key-value pairs.
property minSize
minSize?: pulumi.Input<number>;The minimum number of instances the group should have at any time.
property name
name?: pulumi.Input<string>;The group name.
property networkInterfaces
networkInterfaces?: pulumi.Input<pulumi.Input<ElastigroupNetworkInterface>[]>;property ondemandCount
ondemandCount?: pulumi.Input<number>;property preemptiblePercentage
preemptiblePercentage?: pulumi.Input<number>;Percentage of Preemptible VMs to spin up from the “desiredCapacity”.
property scalingDownPolicies
scalingDownPolicies?: pulumi.Input<pulumi.Input<ElastigroupScalingDownPolicy>[]>;property scalingUpPolicies
scalingUpPolicies?: pulumi.Input<pulumi.Input<ElastigroupScalingUpPolicy>[]>;property scheduledTasks
scheduledTasks?: pulumi.Input<pulumi.Input<ElastigroupScheduledTask>[]>;property serviceAccount
serviceAccount?: pulumi.Input<string>;The email of the service account in which the group instances will be launched.
property shutdownScript
shutdownScript?: pulumi.Input<string>;The Base64-encoded shutdown script that executes prior to instance termination, for more information please see: Shutdown Script
property startupScript
startupScript?: pulumi.Input<string>;Create and run your own startup scripts on your virtual machines to perform automated tasks every time your instance boots up.
property subnets
subnets?: pulumi.Input<pulumi.Input<ElastigroupSubnet>[]>;A list of regions and subnets.
property tags
tags?: pulumi.Input<pulumi.Input<string>[]>;Tags to mark created instances.
property unhealthyDuration
unhealthyDuration?: pulumi.Input<number>;interface ElastigroupState
interface ElastigroupStateInput properties used for looking up and filtering Elastigroup resources.
property autoHealing
autoHealing?: pulumi.Input<boolean>;property availabilityZones
availabilityZones?: pulumi.Input<pulumi.Input<string>[]>;List of availability zones for the group.
property backendServices
backendServices?: pulumi.Input<pulumi.Input<ElastigroupBackendService>[]>;property description
description?: pulumi.Input<string>;The region your GCP group will be created in.
property desiredCapacity
desiredCapacity?: pulumi.Input<number>;The desired number of instances the group should have at any time.
property disks
disks?: pulumi.Input<pulumi.Input<ElastigroupDisk>[]>;property drainingTimeout
drainingTimeout?: pulumi.Input<number>;Time (seconds) the instance is allowed to run after it is detached from the group. This is to allow the instance time to drain all the current TCP connections before terminating it.
property fallbackToOndemand
fallbackToOndemand?: pulumi.Input<boolean>;Activate fallback-to-on-demand. When provisioning an instance, if no Preemptible market is available, fallback-to-on-demand will provision an On-Demand instance to maintain the group capacity.
property gpu
gpu?: pulumi.Input<pulumi.Input<ElastigroupGpu>[]>;property healthCheckGracePeriod
healthCheckGracePeriod?: pulumi.Input<number>;property healthCheckType
healthCheckType?: pulumi.Input<string>;property instanceTypesCustoms
instanceTypesCustoms?: pulumi.Input<pulumi.Input<ElastigroupInstanceTypesCustom>[]>;Defines a set of custom instance types. Required if instanceTypesPreemptible and instanceTypesOndemand are not set.
property instanceTypesOndemand
instanceTypesOndemand?: pulumi.Input<string>;The regular VM instance type to use for mixed-type groups and when falling back to on-demand. Required if instanceTypesPreemptible is not set.
property instanceTypesPreemptibles
instanceTypesPreemptibles?: pulumi.Input<pulumi.Input<string>[]>;The preemptible VMs instance type. To maximize cost savings and market availability, select as many types as possible. Required if instanceTypesOndemand is not set.
property integrationDockerSwarm
integrationDockerSwarm?: pulumi.Input<ElastigroupIntegrationDockerSwarm>;property integrationGke
integrationGke?: pulumi.Input<ElastigroupIntegrationGke>;property ipForwarding
ipForwarding?: pulumi.Input<boolean>;property labels
labels?: pulumi.Input<pulumi.Input<ElastigroupLabel>[]>;Array of objects with key-value pairs.
property maxSize
maxSize?: pulumi.Input<number>;The maximum number of instances the group should have at any time.
property metadatas
metadatas?: pulumi.Input<pulumi.Input<ElastigroupMetadata>[]>;Array of objects with key-value pairs.
property minSize
minSize?: pulumi.Input<number>;The minimum number of instances the group should have at any time.
property name
name?: pulumi.Input<string>;The group name.
property networkInterfaces
networkInterfaces?: pulumi.Input<pulumi.Input<ElastigroupNetworkInterface>[]>;property ondemandCount
ondemandCount?: pulumi.Input<number>;property preemptiblePercentage
preemptiblePercentage?: pulumi.Input<number>;Percentage of Preemptible VMs to spin up from the “desiredCapacity”.
property scalingDownPolicies
scalingDownPolicies?: pulumi.Input<pulumi.Input<ElastigroupScalingDownPolicy>[]>;property scalingUpPolicies
scalingUpPolicies?: pulumi.Input<pulumi.Input<ElastigroupScalingUpPolicy>[]>;property scheduledTasks
scheduledTasks?: pulumi.Input<pulumi.Input<ElastigroupScheduledTask>[]>;property serviceAccount
serviceAccount?: pulumi.Input<string>;The email of the service account in which the group instances will be launched.
property shutdownScript
shutdownScript?: pulumi.Input<string>;The Base64-encoded shutdown script that executes prior to instance termination, for more information please see: Shutdown Script
property startupScript
startupScript?: pulumi.Input<string>;Create and run your own startup scripts on your virtual machines to perform automated tasks every time your instance boots up.
property subnets
subnets?: pulumi.Input<pulumi.Input<ElastigroupSubnet>[]>;A list of regions and subnets.
property tags
tags?: pulumi.Input<pulumi.Input<string>[]>;Tags to mark created instances.
property unhealthyDuration
unhealthyDuration?: pulumi.Input<number>;