pulumi_wasm_providers_gcp_mini::compute

Module autoscaler

source
Expand description

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:

§Example Usage

§Autoscaler Single Instance

resources:
  default:
    type: gcp:compute:Autoscaler
    properties:
      name: my-autoscaler
      zone: us-central1-f
      target: ${defaultInstanceGroupManager.id}
      autoscalingPolicy:
        maxReplicas: 5
        minReplicas: 1
        cooldownPeriod: 60
        metrics:
          - name: pubsub.googleapis.com/subscription/num_undelivered_messages
            filter: resource.type = pubsub_subscription AND resource.label.subscription_id = our-subscription
            singleInstanceAssignment: 65535
  defaultInstanceTemplate:
    type: gcp:compute:InstanceTemplate
    name: default
    properties:
      name: my-instance-template
      machineType: e2-medium
      canIpForward: false
      tags:
        - foo
        - bar
      disks:
        - sourceImage: ${debian9.id}
      networkInterfaces:
        - network: default
      metadata:
        foo: bar
      serviceAccount:
        scopes:
          - userinfo-email
          - compute-ro
          - storage-ro
  defaultTargetPool:
    type: gcp:compute:TargetPool
    name: default
    properties:
      name: my-target-pool
  defaultInstanceGroupManager:
    type: gcp:compute:InstanceGroupManager
    name: default
    properties:
      name: my-igm
      zone: us-central1-f
      versions:
        - instanceTemplate: ${defaultInstanceTemplate.id}
          name: primary
      targetPools:
        - ${defaultTargetPool.id}
      baseInstanceName: autoscaler-sample
variables:
  debian9:
    fn::invoke:
      function: gcp:compute:getImage
      arguments:
        family: debian-11
        project: debian-cloud

§Autoscaler Basic

resources:
  foobar:
    type: gcp:compute:Autoscaler
    properties:
      name: my-autoscaler
      zone: us-central1-f
      target: ${foobarInstanceGroupManager.id}
      autoscalingPolicy:
        maxReplicas: 5
        minReplicas: 1
        cooldownPeriod: 60
        cpuUtilization:
          target: 0.5
  foobarInstanceTemplate:
    type: gcp:compute:InstanceTemplate
    name: foobar
    properties:
      name: my-instance-template
      machineType: e2-medium
      canIpForward: false
      tags:
        - foo
        - bar
      disks:
        - sourceImage: ${debian9.id}
      networkInterfaces:
        - network: default
      metadata:
        foo: bar
      serviceAccount:
        scopes:
          - userinfo-email
          - compute-ro
          - storage-ro
  foobarTargetPool:
    type: gcp:compute:TargetPool
    name: foobar
    properties:
      name: my-target-pool
  foobarInstanceGroupManager:
    type: gcp:compute:InstanceGroupManager
    name: foobar
    properties:
      name: my-igm
      zone: us-central1-f
      versions:
        - instanceTemplate: ${foobarInstanceTemplate.id}
          name: primary
      targetPools:
        - ${foobarTargetPool.id}
      baseInstanceName: foobar
variables:
  debian9:
    fn::invoke:
      function: gcp:compute:getImage
      arguments:
        family: debian-11
        project: debian-cloud

§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:

$ 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}}

Structs§

Functions§

  • Registers a new resource with the given unique name and arguments