2017-05-08 07:38:11 +00:00
---
layout: "google"
2017-05-10 22:01:15 +00:00
page_title: "Google: google_container_engine_versions"
2017-05-08 07:38:11 +00:00
sidebar_current: "docs-google-datasource-container-versions"
description: |-
2019-03-13 16:32:46 +00:00
Provides lists of available Google Kubernetes Engine versions for masters and nodes.
2017-05-08 07:38:11 +00:00
---
2017-05-10 22:41:02 +00:00
# google\_container\_engine\_versions
2017-05-08 07:38:11 +00:00
2019-03-13 16:32:46 +00:00
Provides access to available Google Kubernetes Engine versions in a zone or region for a given project.
2017-05-08 07:38:11 +00:00
2019-03-13 16:32:46 +00:00
-> If you are using the `google_container_engine_versions` datasource with a
regional cluster, ensure that you have provided a region as the `location` to
the datasource. A region can have a different set of supported versions than
its component zones, and not all zones in a region are guaranteed to
support the same version.
2018-11-13 19:01:00 +00:00
## Example Usage
2017-05-08 07:38:11 +00:00
```hcl
2017-05-10 22:01:15 +00:00
data "google_container_engine_versions" "central1b" {
2019-03-13 16:32:46 +00:00
location = "us-central1-b"
2019-03-06 23:12:33 +00:00
version_prefix = "1.12."
2017-05-08 07:38:11 +00:00
}
resource "google_container_cluster" "foo" {
name = "terraform-test-cluster"
2019-03-13 16:32:46 +00:00
location = "us-central1-b"
2017-05-10 22:01:15 +00:00
node_version = "${data.google_container_engine_versions.central1b.latest_node_version}"
2017-05-08 07:38:11 +00:00
initial_node_count = 1
master_auth {
username = "mr.yoda"
password = "adoy.rm"
}
}
```
## Argument Reference
The following arguments are supported:
2019-03-13 16:32:46 +00:00
* `location` (Optional) - The location (region or zone) to list versions for.
Must exactly match the location the cluster will be deployed in, or listed
versions may not be available. If `location` , `region` , and `zone` are not
specified, the provider-level zone must be set and is used instead.
2018-08-28 18:37:07 +00:00
2019-03-13 16:32:46 +00:00
* `zone` (Optional, Deprecated) - Zone to list available cluster versions for.
Should match the zone the cluster will be deployed in. `zone` has been
deprecated in favour of `location` .
2018-08-28 18:37:07 +00:00
2019-03-13 16:32:46 +00:00
* `region` (Optional, Deprecated) - Region to list available cluster versions
for. Should match the region the cluster will be deployed in. `region` has been
deprecated in favour of `location` .
* `project` (Optional) - ID of the project to list available cluster versions for. Should match the project the cluster will be deployed to.
2017-05-08 07:38:11 +00:00
Defaults to the project that the provider is authenticated with.
2019-03-13 16:32:46 +00:00
* `version_prefix` (Optional) - If provided, Terraform will only return versions
2019-03-06 23:12:33 +00:00
that match the string prefix. For example, `1.11.` will match all `1.11` series
releases. Since this is just a string match, it's recommended that you append a
`.` after minor versions to ensure that prefixes such as `1.1` don't match
versions like `1.12.5-gke.10` accidentally. See [the docs on versioning schema ](https://cloud.google.com/kubernetes-engine/versioning-and-upgrades#versioning_scheme )
for full details on how version strings are formatted.
2017-05-08 07:38:11 +00:00
## Attributes Reference
The following attributes are exported:
* `valid_master_versions` - A list of versions available in the given zone for use with master instances.
* `valid_node_versions` - A list of versions available in the given zone for use with node instances.
* `latest_master_version` - The latest version available in the given zone for use with master instances.
* `latest_node_version` - The latest version available in the given zone for use with node instances.
2018-04-19 17:59:52 +00:00
* `default_cluster_version` - Version of Kubernetes the service deploys by default.