From cbb4fb14a59ebf9899c5bfc1971b386bbbb520e7 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Thu, 15 Nov 2018 08:52:30 +0000 Subject: [PATCH] codereview changes --- azurerm/helpers/kubernetes/kube_config.go | 3 +-- azurerm/resource_arm_kubernetes_cluster.go | 8 ++------ examples/kubernetes/advanced-networking/variables.tf | 1 + examples/kubernetes/basic/variables.tf | 1 + website/docs/d/kubernetes_cluster.html.markdown | 2 +- website/docs/index.html.markdown | 2 +- 6 files changed, 7 insertions(+), 10 deletions(-) diff --git a/azurerm/helpers/kubernetes/kube_config.go b/azurerm/helpers/kubernetes/kube_config.go index 059594f2d2783..e12581f9c65dd 100644 --- a/azurerm/helpers/kubernetes/kube_config.go +++ b/azurerm/helpers/kubernetes/kube_config.go @@ -108,8 +108,7 @@ func ParseKubeConfigAAD(config string) (*KubeConfigAAD, error) { } var kubeConfig KubeConfigAAD - err := yaml.Unmarshal([]byte(config), &kubeConfig) - if err != nil { + if err := yaml.Unmarshal([]byte(config), &kubeConfig); err != nil { return nil, fmt.Errorf("Failed to unmarshal YAML config with error %+v", err) } if len(kubeConfig.Clusters) <= 0 || len(kubeConfig.Users) <= 0 { diff --git a/azurerm/resource_arm_kubernetes_cluster.go b/azurerm/resource_arm_kubernetes_cluster.go index 5dbc5afc888e9..90c496d314471 100644 --- a/azurerm/resource_arm_kubernetes_cluster.go +++ b/azurerm/resource_arm_kubernetes_cluster.go @@ -475,8 +475,7 @@ func resourceArmKubernetesClusterCreateUpdate(d *schema.ResourceData, meta inter return fmt.Errorf("Error creating/updating Managed Kubernetes Cluster %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletionRef(ctx, client.Client) - if err != nil { + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { return fmt.Errorf("Error waiting for completion of Managed Kubernetes Cluster %q (Resource Group %q): %+v", name, resGroup, err) } @@ -712,7 +711,6 @@ func flattenKubernetesClusterAddonProfiles(profile map[string]*containerservice. func expandKubernetesClusterAgentPoolProfiles(d *schema.ResourceData) []containerservice.ManagedClusterAgentPoolProfile { configs := d.Get("agent_pool_profile").([]interface{}) config := configs[0].(map[string]interface{}) - profiles := make([]containerservice.ManagedClusterAgentPoolProfile, 0, len(configs)) name := config["name"].(string) count := int32(config["count"].(int)) @@ -738,9 +736,7 @@ func expandKubernetesClusterAgentPoolProfiles(d *schema.ResourceData) []containe profile.VnetSubnetID = utils.String(vnetSubnetID) } - profiles = append(profiles, profile) - - return profiles + return []containerservice.ManagedClusterAgentPoolProfile{profile} } func flattenKubernetesClusterAgentPoolProfiles(profiles *[]containerservice.ManagedClusterAgentPoolProfile, fqdn *string) []interface{} { diff --git a/examples/kubernetes/advanced-networking/variables.tf b/examples/kubernetes/advanced-networking/variables.tf index a2588b4845e16..f5b98293a49a8 100644 --- a/examples/kubernetes/advanced-networking/variables.tf +++ b/examples/kubernetes/advanced-networking/variables.tf @@ -1,5 +1,6 @@ variable "prefix" { description = "A prefix used for all resources in this example" + default = "tomdev" } variable "location" { diff --git a/examples/kubernetes/basic/variables.tf b/examples/kubernetes/basic/variables.tf index 7de68ae5473f7..402932aabe536 100644 --- a/examples/kubernetes/basic/variables.tf +++ b/examples/kubernetes/basic/variables.tf @@ -1,5 +1,6 @@ variable "prefix" { description = "A prefix used for all resources in this example" + default = "tomdev" } variable "location" { diff --git a/website/docs/d/kubernetes_cluster.html.markdown b/website/docs/d/kubernetes_cluster.html.markdown index 8b2710921070a..d2bbcb2ac70c0 100644 --- a/website/docs/d/kubernetes_cluster.html.markdown +++ b/website/docs/d/kubernetes_cluster.html.markdown @@ -80,7 +80,7 @@ A `agent_pool_profile` block exports the following: * `max_pods` - The maximum number of pods that can run on each agent. -* `name` - The name assigned to this pool of agents +* `name` - The name assigned to this pool of agents. * `os_disk_size_gb` - The size of the Agent VM's Operating System Disk in GB. diff --git a/website/docs/index.html.markdown b/website/docs/index.html.markdown index 7f5666b7f348e..28dbb78bf766b 100644 --- a/website/docs/index.html.markdown +++ b/website/docs/index.html.markdown @@ -73,7 +73,7 @@ The following arguments are supported: the `ARM_CLIENT_SECRET` environment variable. * `tenant_id` - (Optional) The tenant ID to use. It can also be sourced from the - `ARM_TENANT_ID` environment variable.` + `ARM_TENANT_ID` environment variable. * `use_msi` - (Optional) Set to true to authenticate using managed service identity. It can also be sourced from the `ARM_USE_MSI` environment variable.