» kubernetes_horizontal_pod_autoscaler

Horizontal Pod Autoscaler automatically scales the number of pods in a replication controller, deployment or replica set based on observed CPU utilization.

» Example Usage

resource "kubernetes_horizontal_pod_autoscaler" "example" {
  metadata {
    name = "terraform-example"
  spec {
    max_replicas = 10
    min_replicas = 8
    scale_target_ref {
      kind = "ReplicationController"
      name = "MyApp"

» Argument Reference

The following arguments are supported:

» Nested Blocks

» metadata

» Arguments

  • annotations - (Optional) An unstructured key value map stored with the horizontal pod autoscaler that may be used to store arbitrary metadata. For more info see Kubernetes reference
  • generate_name - (Optional) Prefix, used by the server, to generate a unique name ONLY IF the name field has not been provided. This value will also be combined with a unique suffix. For more info see Kubernetes reference
  • labels - (Optional) Map of string keys and values that can be used to organize and categorize (scope and select) the horizontal pod autoscaler. May match selectors of replication controllers and services. For more info see Kubernetes reference
  • name - (Optional) Name of the horizontal pod autoscaler, must be unique. Cannot be updated. For more info see Kubernetes reference
  • namespace - (Optional) Namespace defines the space within which name of the horizontal pod autoscaler must be unique.

» Attributes

  • generation - A sequence number representing a specific generation of the desired state.
  • resource_version - An opaque value that represents the internal version of this horizontal pod autoscaler that can be used by clients to determine when horizontal pod autoscaler has changed. For more info see Kubernetes reference
  • self_link - A URL representing this horizontal pod autoscaler.
  • uid - The unique in time and space value for this horizontal pod autoscaler. For more info see Kubernetes reference

» spec

» Arguments

  • max_replicas - (Required) Upper limit for the number of pods that can be set by the autoscaler.
  • min_replicas - (Optional) Lower limit for the number of pods that can be set by the autoscaler, defaults to 1.
  • scale_target_ref - (Required) Reference to scaled resource. e.g. Replication Controller
  • target_cpu_utilization_percentage - (Optional) Target average CPU utilization (represented as a percentage of requested CPU) over all the pods. If not specified the default autoscaling policy will be used.

» scale_target_ref

» Arguments

» Import

Horizontal Pod Autoscaler can be imported using the namespace and name, e.g.

$ terraform import kubernetes_horizontal_pod_autoscaler.example default/terraform-example