From b7faae4bacd990e109b5b7b1a9db1cd3f445a387 Mon Sep 17 00:00:00 2001 From: Christoph Blecker Date: Sun, 18 Dec 2016 05:50:46 -0800 Subject: [PATCH] Use node_version during google_container_cluster creation (#10817) --- .../google/resource_container_cluster.go | 4 +++ .../google/resource_container_cluster_test.go | 30 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/builtin/providers/google/resource_container_cluster.go b/builtin/providers/google/resource_container_cluster.go index ba08291e61..9340d78e64 100644 --- a/builtin/providers/google/resource_container_cluster.go +++ b/builtin/providers/google/resource_container_cluster.go @@ -278,6 +278,10 @@ func resourceContainerClusterCreate(d *schema.ResourceData, meta interface{}) er InitialNodeCount: int64(d.Get("initial_node_count").(int)), } + if v, ok := d.GetOk("node_version"); ok { + cluster.InitialClusterVersion = v.(string) + } + if v, ok := d.GetOk("cluster_ipv4_cidr"); ok { cluster.ClusterIpv4Cidr = v.(string) } diff --git a/builtin/providers/google/resource_container_cluster_test.go b/builtin/providers/google/resource_container_cluster_test.go index d602c5bc23..d0dbb48e9f 100644 --- a/builtin/providers/google/resource_container_cluster_test.go +++ b/builtin/providers/google/resource_container_cluster_test.go @@ -26,6 +26,23 @@ func TestAccContainerCluster_basic(t *testing.T) { }) } +func TestAccContainerCluster_withVersion(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckContainerClusterDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccContainerCluster_withVersion, + Check: resource.ComposeTestCheckFunc( + testAccCheckContainerClusterExists( + "google_container_cluster.with_version"), + ), + }, + }, + }) +} + func TestAccContainerCluster_withNodeConfig(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -138,6 +155,19 @@ resource "google_container_cluster" "primary" { } }`, acctest.RandString(10)) +var testAccContainerCluster_withVersion = fmt.Sprintf(` +resource "google_container_cluster" "with_version" { + name = "cluster-test-%s" + zone = "us-central1-a" + node_version = "1.4.7" + initial_node_count = 1 + + master_auth { + username = "mr.yoda" + password = "adoy.rm" + } +}`, acctest.RandString(10)) + var testAccContainerCluster_withNodeConfig = fmt.Sprintf(` resource "google_container_cluster" "with_node_config" { name = "cluster-test-%s"