github.com/koding/terraform@v0.6.4-0.20170608090606-5d7e0339779d/website/source/docs/providers/kubernetes/r/horizontal_pod_autoscaler.html.markdown (about) 1 --- 2 layout: "kubernetes" 3 page_title: "Kubernetes: kubernetes_horizontal_pod_autoscaler" 4 sidebar_current: "docs-kubernetes-resource-horizontal-pod-autoscaler" 5 description: |- 6 Horizontal Pod Autoscaler automatically scales the number of pods in a replication controller, deployment or replica set based on observed CPU utilization. 7 --- 8 9 # kubernetes_horizontal_pod_autoscaler 10 11 Horizontal Pod Autoscaler automatically scales the number of pods in a replication controller, deployment or replica set based on observed CPU utilization. 12 13 14 ## Example Usage 15 16 ```hcl 17 resource "kubernetes_horizontal_pod_autoscaler" "example" { 18 metadata { 19 name = "terraform-example" 20 } 21 spec { 22 max_replicas = 10 23 min_replicas = 8 24 scale_target_ref { 25 kind = "ReplicationController" 26 name = "MyApp" 27 } 28 } 29 } 30 ``` 31 32 ## Argument Reference 33 34 The following arguments are supported: 35 36 * `metadata` - (Required) Standard horizontal pod autoscaler's metadata. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata 37 * `spec` - (Required) Behaviour of the autoscaler. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status. 38 39 ## Nested Blocks 40 41 ### `metadata` 42 43 #### Arguments 44 45 * `annotations` - (Optional) An unstructured key value map stored with the horizontal pod autoscaler that may be used to store arbitrary metadata. More info: http://kubernetes.io/docs/user-guide/annotations 46 * `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. Read more: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#idempotency 47 * `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. More info: http://kubernetes.io/docs/user-guide/labels 48 * `name` - (Optional) Name of the horizontal pod autoscaler, must be unique. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names 49 * `namespace` - (Optional) Namespace defines the space within which name of the horizontal pod autoscaler must be unique. 50 51 #### Attributes 52 53 54 * `generation` - A sequence number representing a specific generation of the desired state. 55 * `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. Read more: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#concurrency-control-and-consistency 56 * `self_link` - A URL representing this horizontal pod autoscaler. 57 * `uid` - The unique in time and space value for this horizontal pod autoscaler. More info: http://kubernetes.io/docs/user-guide/identifiers#uids 58 59 ### `spec` 60 61 #### Arguments 62 63 * `max_replicas` - (Required) Upper limit for the number of pods that can be set by the autoscaler. 64 * `min_replicas` - (Optional) Lower limit for the number of pods that can be set by the autoscaler, defaults to `1`. 65 * `scale_target_ref` - (Required) Reference to scaled resource. e.g. Replication Controller 66 * `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. 67 68 ### `scale_target_ref` 69 70 #### Arguments 71 72 * `api_version` - (Optional) API version of the referent 73 * `kind` - (Required) Kind of the referent. e.g. `ReplicationController`. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds 74 * `name` - (Required) Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names 75 76 ## Import 77 78 Horizontal Pod Autoscaler can be imported using the namespace and name, e.g. 79 80 ``` 81 $ terraform import kubernetes_horizontal_pod_autoscaler.example default/terraform-example 82 ```