Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider/google: Use node_version during google_container_cluster creation #10817

Merged
merged 1 commit into from
Dec 18, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use node_version during google_container_cluster creation
  • Loading branch information
Christoph Blecker committed Dec 18, 2016
commit 9292708e8af3df0a51cb71292b9f8e70979345ab
4 changes: 4 additions & 0 deletions builtin/providers/google/resource_container_cluster.go
Original file line number Diff line number Diff line change
@@ -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)
}
30 changes: 30 additions & 0 deletions builtin/providers/google/resource_container_cluster_test.go
Original file line number Diff line number Diff line change
@@ -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"