From c7c080a4807948de6bd6b3d166bb4f7fa70de306 Mon Sep 17 00:00:00 2001 From: Steven Hawkins Date: Tue, 18 Sep 2018 12:16:20 +0100 Subject: [PATCH 01/15] allowed two client certificates to be specified --- azurerm/resource_arm_service_fabric_cluster.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azurerm/resource_arm_service_fabric_cluster.go b/azurerm/resource_arm_service_fabric_cluster.go index 8ddd315ad51a..0e683c0f5d2f 100644 --- a/azurerm/resource_arm_service_fabric_cluster.go +++ b/azurerm/resource_arm_service_fabric_cluster.go @@ -97,7 +97,7 @@ func resourceArmServiceFabricCluster() *schema.Resource { "client_certificate_thumbprint": { Type: schema.TypeList, Optional: true, - MaxItems: 1, + MaxItems: 2, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "thumbprint": { From 16c9c64bf9b629643944ed7873b7446576066e72 Mon Sep 17 00:00:00 2001 From: Steven Hawkins Date: Wed, 19 Sep 2018 15:28:49 +0100 Subject: [PATCH 02/15] added cluster_code_version atribute --- azurerm/resource_arm_service_fabric_cluster.go | 10 ++++++++++ website/docs/r/service_fabric_cluster.html.markdown | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/azurerm/resource_arm_service_fabric_cluster.go b/azurerm/resource_arm_service_fabric_cluster.go index 0e683c0f5d2f..afd283a2499f 100644 --- a/azurerm/resource_arm_service_fabric_cluster.go +++ b/azurerm/resource_arm_service_fabric_cluster.go @@ -53,6 +53,11 @@ func resourceArmServiceFabricCluster() *schema.Resource { }, false), }, + "cluster_code_version": { + Type: schema.TypeString, + Required: false, + }, + "management_endpoint": { Type: schema.TypeString, Required: true, @@ -275,6 +280,7 @@ func resourceArmServiceFabricClusterCreate(d *schema.ResourceData, meta interfac reliabilityLevel := d.Get("reliability_level").(string) managementEndpoint := d.Get("management_endpoint").(string) upgradeMode := d.Get("upgrade_mode").(string) + clusterCodeVersion := d.Get("cluster_code_version").(string) vmImage := d.Get("vm_image").(string) tags := d.Get("tags").(map[string]interface{}) @@ -309,6 +315,7 @@ func resourceArmServiceFabricClusterCreate(d *schema.ResourceData, meta interfac NodeTypes: nodeTypes, ReliabilityLevel: servicefabric.ReliabilityLevel(reliabilityLevel), UpgradeMode: servicefabric.UpgradeMode(upgradeMode), + ClusterCodeVersion: utils.String(clusterCodeVersion), VMImage: utils.String(vmImage), }, } @@ -346,6 +353,7 @@ func resourceArmServiceFabricClusterUpdate(d *schema.ResourceData, meta interfac name := d.Get("name").(string) reliabilityLevel := d.Get("reliability_level").(string) upgradeMode := d.Get("upgrade_mode").(string) + clusterCodeVersion := d.Get("cluster_code_version").(string) tags := d.Get("tags").(map[string]interface{}) addOnFeaturesRaw := d.Get("add_on_features").(*schema.Set).List() @@ -372,6 +380,7 @@ func resourceArmServiceFabricClusterUpdate(d *schema.ResourceData, meta interfac NodeTypes: nodeTypes, ReliabilityLevel: servicefabric.ReliabilityLevel1(reliabilityLevel), UpgradeMode: servicefabric.UpgradeMode1(upgradeMode), + ClusterCodeVersion: utils.String(clusterCodeVersion), }, Tags: expandTags(tags), } @@ -423,6 +432,7 @@ func resourceArmServiceFabricClusterRead(d *schema.ResourceData, meta interface{ d.Set("management_endpoint", props.ManagementEndpoint) d.Set("reliability_level", string(props.ReliabilityLevel)) d.Set("upgrade_mode", string(props.UpgradeMode)) + d.Set("cluster_code_version ", props.ClusterCodeVersion) d.Set("vm_image", props.VMImage) addOnFeatures := flattenServiceFabricClusterAddOnFeatures(props.AddOnFeatures) diff --git a/website/docs/r/service_fabric_cluster.html.markdown b/website/docs/r/service_fabric_cluster.html.markdown index 9ca2dd16171d..00795044e8dc 100644 --- a/website/docs/r/service_fabric_cluster.html.markdown +++ b/website/docs/r/service_fabric_cluster.html.markdown @@ -23,7 +23,8 @@ resource "azurerm_service_fabric_cluster" "test" { resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" reliability_level = "Bronze" - upgrade_mode = "Automatic" + upgrade_mode = "Manual" + upgrade_mode = "6.3.176.9494" vm_image = "Windows" management_endpoint = "https://example:80" @@ -60,6 +61,8 @@ The following arguments are supported: --- +* `cluster_code_version` - (Optional) Required if Upgrade Mode set to `Manual`, Specifies the Version of the Cluster Code of the cluster. + * `add_on_features` - (Optional) A List of one or more features which should be enabled, such as `DnsService`. * `certificate` - (Optional) A `certificate` block as defined below. From 762f6e4f6886bf8cf0b69f9a3dcaf5877d6c9c2a Mon Sep 17 00:00:00 2001 From: Steven Hawkins Date: Wed, 19 Sep 2018 15:30:31 +0100 Subject: [PATCH 03/15] corrected docs --- .../docs/r/service_fabric_cluster.html.markdown | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/website/docs/r/service_fabric_cluster.html.markdown b/website/docs/r/service_fabric_cluster.html.markdown index 00795044e8dc..5da1b5ddf2a3 100644 --- a/website/docs/r/service_fabric_cluster.html.markdown +++ b/website/docs/r/service_fabric_cluster.html.markdown @@ -19,14 +19,14 @@ resource "azurerm_resource_group" "test" { } resource "azurerm_service_fabric_cluster" "test" { - name = "example-servicefabric" - resource_group_name = "${azurerm_resource_group.test.name}" - location = "${azurerm_resource_group.test.location}" - reliability_level = "Bronze" - upgrade_mode = "Manual" - upgrade_mode = "6.3.176.9494" - vm_image = "Windows" - management_endpoint = "https://example:80" + name = "example-servicefabric" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + reliability_level = "Bronze" + upgrade_mode = "Manual" + cluster_code_version = "6.3.176.9494" + vm_image = "Windows" + management_endpoint = "https://example:80" node_type { name = "first" From 71672ce5dbc4e68524f770a0296682bf44e1c0de Mon Sep 17 00:00:00 2001 From: Steven Hawkins Date: Wed, 19 Sep 2018 17:57:42 +0100 Subject: [PATCH 04/15] added acceptance tests --- .../resource_arm_service_fabric_cluster.go | 2 +- ...esource_arm_service_fabric_cluster_test.go | 63 +++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/azurerm/resource_arm_service_fabric_cluster.go b/azurerm/resource_arm_service_fabric_cluster.go index afd283a2499f..6652a9607426 100644 --- a/azurerm/resource_arm_service_fabric_cluster.go +++ b/azurerm/resource_arm_service_fabric_cluster.go @@ -55,7 +55,7 @@ func resourceArmServiceFabricCluster() *schema.Resource { "cluster_code_version": { Type: schema.TypeString, - Required: false, + Optional: true, }, "management_endpoint": { diff --git a/azurerm/resource_arm_service_fabric_cluster_test.go b/azurerm/resource_arm_service_fabric_cluster_test.go index 439eea3a56fa..6598a6b6004f 100644 --- a/azurerm/resource_arm_service_fabric_cluster_test.go +++ b/azurerm/resource_arm_service_fabric_cluster_test.go @@ -44,6 +44,41 @@ func TestAccAzureRMServiceFabricCluster_basic(t *testing.T) { }) } +func TestAccAzureRMServiceFabricCluster_manualClusterCodeVersion(t *testing.T) { + resourceName := "azurerm_service_fabric_cluster.test" + ri := acctest.RandInt() + location := testLocation() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMServiceFabricClusterDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMServiceFabricCluster_manualClusterCodeVersion(ri, location, "6.3.162.9494"), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMServiceFabricClusterExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "upgrade_mode", "Manual"), + resource.TestCheckResourceAttr(resourceName, "cluster_code_version", "6.3.162.9494"), + ), + }, + { + Config: testAccAzureRMServiceFabricCluster_manualClusterCodeVersion(ri, location, "6.3.176.9494"), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMServiceFabricClusterExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "upgrade_mode", "Manual"), + resource.TestCheckResourceAttr(resourceName, "cluster_code_version", "6.3.176.9494"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func TestAccAzureRMServiceFabricCluster_addOnFeatures(t *testing.T) { resourceName := "azurerm_service_fabric_cluster.test" ri := acctest.RandInt() @@ -432,6 +467,34 @@ resource "azurerm_service_fabric_cluster" "test" { `, rInt, location, rInt, count) } +func testAccAzureRMServiceFabricCluster_manualClusterCodeVersion(rInt int, location, clusterCodeVersion string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" +} + +resource "azurerm_service_fabric_cluster" "test" { + name = "acctest-%[1]d" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + reliability_level = "Bronze" + upgrade_mode = "Manual" + cluster_code_version = "%[3]s" + vm_image = "Windows" + management_endpoint = "http://example:80" + + node_type { + name = "first" + instance_count = 3 + is_primary = true + client_endpoint_port = 2020 + http_endpoint_port = 80 + } +} +`, rInt, location, clusterCodeVersion) +} + func testAccAzureRMServiceFabricCluster_addOnFeatures(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { From 695c118935c2ad4d71c8891abbead6e7ed328dbf Mon Sep 17 00:00:00 2001 From: Steven Hawkins Date: Wed, 19 Sep 2018 17:59:12 +0100 Subject: [PATCH 05/15] keep LF on checkout to Windows --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000000..d3da0b3cceba --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# make sure all .go files stay LF, this will help developers on Windows +*.go text eol=lf \ No newline at end of file From e5991f4db7410c37fea0780e1adc7d92e2fb9df2 Mon Sep 17 00:00:00 2001 From: Steven Hawkins Date: Wed, 19 Sep 2018 18:08:47 +0100 Subject: [PATCH 06/15] new line added --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index d3da0b3cceba..676e9fc261a7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,2 @@ # make sure all .go files stay LF, this will help developers on Windows -*.go text eol=lf \ No newline at end of file +*.go text eol=lf From 26a2db61b43f3d18aec1009ce0e17399e45e057b Mon Sep 17 00:00:00 2001 From: Steven Hawkins Date: Wed, 19 Sep 2018 19:16:53 +0100 Subject: [PATCH 07/15] removed from this PR --- .gitattributes | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 676e9fc261a7..000000000000 --- a/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -# make sure all .go files stay LF, this will help developers on Windows -*.go text eol=lf From 11f2ba026b1876a7603c214d890fdb5d23ff6c62 Mon Sep 17 00:00:00 2001 From: Steven Hawkins Date: Wed, 19 Sep 2018 19:26:40 +0100 Subject: [PATCH 08/15] added validation --- azurerm/resource_arm_service_fabric_cluster.go | 1 + 1 file changed, 1 insertion(+) diff --git a/azurerm/resource_arm_service_fabric_cluster.go b/azurerm/resource_arm_service_fabric_cluster.go index 6652a9607426..be924442e439 100644 --- a/azurerm/resource_arm_service_fabric_cluster.go +++ b/azurerm/resource_arm_service_fabric_cluster.go @@ -56,6 +56,7 @@ func resourceArmServiceFabricCluster() *schema.Resource { "cluster_code_version": { Type: schema.TypeString, Optional: true, + ValidateFunc: validation.NoZeroValues, }, "management_endpoint": { From b20430b7882d0bda590dcade4322ca61efaf92f3 Mon Sep 17 00:00:00 2001 From: Steven Hawkins Date: Wed, 19 Sep 2018 19:28:37 +0100 Subject: [PATCH 09/15] alignment based on PR comment --- azurerm/resource_arm_service_fabric_cluster_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azurerm/resource_arm_service_fabric_cluster_test.go b/azurerm/resource_arm_service_fabric_cluster_test.go index 6598a6b6004f..ebc0b8681cfb 100644 --- a/azurerm/resource_arm_service_fabric_cluster_test.go +++ b/azurerm/resource_arm_service_fabric_cluster_test.go @@ -470,7 +470,7 @@ resource "azurerm_service_fabric_cluster" "test" { func testAccAzureRMServiceFabricCluster_manualClusterCodeVersion(rInt int, location, clusterCodeVersion string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%[1]d" + name = "acctestRG-%[1]d" location = "%[2]s" } From 3f1f3758355d34aaea337a334f73cc7d69d50e05 Mon Sep 17 00:00:00 2001 From: Tom Harvey Date: Thu, 20 Sep 2018 05:33:17 +1000 Subject: [PATCH 10/15] Removing a blank space --- azurerm/resource_arm_service_fabric_cluster.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azurerm/resource_arm_service_fabric_cluster.go b/azurerm/resource_arm_service_fabric_cluster.go index be924442e439..87ed72414968 100644 --- a/azurerm/resource_arm_service_fabric_cluster.go +++ b/azurerm/resource_arm_service_fabric_cluster.go @@ -433,7 +433,7 @@ func resourceArmServiceFabricClusterRead(d *schema.ResourceData, meta interface{ d.Set("management_endpoint", props.ManagementEndpoint) d.Set("reliability_level", string(props.ReliabilityLevel)) d.Set("upgrade_mode", string(props.UpgradeMode)) - d.Set("cluster_code_version ", props.ClusterCodeVersion) + d.Set("cluster_code_version", props.ClusterCodeVersion) d.Set("vm_image", props.VMImage) addOnFeatures := flattenServiceFabricClusterAddOnFeatures(props.AddOnFeatures) From a15e2f24877ab693d952635f4ff088e5ce45f31d Mon Sep 17 00:00:00 2001 From: Steven Hawkins Date: Wed, 19 Sep 2018 20:50:43 +0100 Subject: [PATCH 11/15] fmt --- azurerm/resource_arm_service_fabric_cluster.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azurerm/resource_arm_service_fabric_cluster.go b/azurerm/resource_arm_service_fabric_cluster.go index be924442e439..69bada0add46 100644 --- a/azurerm/resource_arm_service_fabric_cluster.go +++ b/azurerm/resource_arm_service_fabric_cluster.go @@ -54,8 +54,8 @@ func resourceArmServiceFabricCluster() *schema.Resource { }, "cluster_code_version": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, ValidateFunc: validation.NoZeroValues, }, From 6cdb27280964b72d00e0149441bc431eec9923bd Mon Sep 17 00:00:00 2001 From: Steven Hawkins Date: Thu, 20 Sep 2018 17:25:29 +0100 Subject: [PATCH 12/15] added empty string condition --- azurerm/resource_arm_service_fabric_cluster.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/azurerm/resource_arm_service_fabric_cluster.go b/azurerm/resource_arm_service_fabric_cluster.go index 958fd0e1f070..947fd50fc47f 100644 --- a/azurerm/resource_arm_service_fabric_cluster.go +++ b/azurerm/resource_arm_service_fabric_cluster.go @@ -316,11 +316,14 @@ func resourceArmServiceFabricClusterCreate(d *schema.ResourceData, meta interfac NodeTypes: nodeTypes, ReliabilityLevel: servicefabric.ReliabilityLevel(reliabilityLevel), UpgradeMode: servicefabric.UpgradeMode(upgradeMode), - ClusterCodeVersion: utils.String(clusterCodeVersion), VMImage: utils.String(vmImage), }, } + if clusterCodeVersion != "" { + cluster.ClusterProperties.ClusterCodeVersion = utils.String(clusterCodeVersion) + } + future, err := client.Create(ctx, resourceGroup, name, cluster) if err != nil { return fmt.Errorf("Error creating Service Fabric Cluster %q (Resource Group %q): %+v", name, resourceGroup, err) @@ -381,11 +384,14 @@ func resourceArmServiceFabricClusterUpdate(d *schema.ResourceData, meta interfac NodeTypes: nodeTypes, ReliabilityLevel: servicefabric.ReliabilityLevel1(reliabilityLevel), UpgradeMode: servicefabric.UpgradeMode1(upgradeMode), - ClusterCodeVersion: utils.String(clusterCodeVersion), }, Tags: expandTags(tags), } + if clusterCodeVersion != "" { + parameters.ClusterPropertiesUpdateParameters.ClusterCodeVersion = utils.String(clusterCodeVersion) + } + future, err := client.Update(ctx, resourceGroup, name, parameters) if err != nil { return fmt.Errorf("Error updating Service Fabric Cluster %q (Resource Group %q): %+v", name, resourceGroup, err) From 6d13c16ac905465a1244403c49d443833578a74b Mon Sep 17 00:00:00 2001 From: Steven Hawkins Date: Fri, 21 Sep 2018 10:38:36 +0100 Subject: [PATCH 13/15] read ClusterCodeVersion when UpgradeMode is Manual --- azurerm/resource_arm_service_fabric_cluster.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/azurerm/resource_arm_service_fabric_cluster.go b/azurerm/resource_arm_service_fabric_cluster.go index 947fd50fc47f..1011dc0fa64d 100644 --- a/azurerm/resource_arm_service_fabric_cluster.go +++ b/azurerm/resource_arm_service_fabric_cluster.go @@ -438,10 +438,15 @@ func resourceArmServiceFabricClusterRead(d *schema.ResourceData, meta interface{ d.Set("cluster_endpoint", props.ClusterEndpoint) d.Set("management_endpoint", props.ManagementEndpoint) d.Set("reliability_level", string(props.ReliabilityLevel)) - d.Set("upgrade_mode", string(props.UpgradeMode)) - d.Set("cluster_code_version", props.ClusterCodeVersion) d.Set("vm_image", props.VMImage) + upgradeMode := string(props.UpgradeMode) + d.Set("upgrade_mode", upgradeMode) + + if upgradeMode == "Manual" { + d.Set("cluster_code_version", props.ClusterCodeVersion) + } + addOnFeatures := flattenServiceFabricClusterAddOnFeatures(props.AddOnFeatures) if err := d.Set("add_on_features", schema.NewSet(schema.HashString, addOnFeatures)); err != nil { return fmt.Errorf("Error setting `add_on_features`: %+v", err) From 6f1d1f258c0132106bfff9d22802e6c87d174156 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Mon, 24 Sep 2018 11:40:59 +1000 Subject: [PATCH 14/15] Making the `cluster_code_version` field computed --- azurerm/resource_arm_service_fabric_cluster.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/azurerm/resource_arm_service_fabric_cluster.go b/azurerm/resource_arm_service_fabric_cluster.go index 1011dc0fa64d..75563074cac1 100644 --- a/azurerm/resource_arm_service_fabric_cluster.go +++ b/azurerm/resource_arm_service_fabric_cluster.go @@ -56,6 +56,7 @@ func resourceArmServiceFabricCluster() *schema.Resource { "cluster_code_version": { Type: schema.TypeString, Optional: true, + Computed: true, ValidateFunc: validation.NoZeroValues, }, @@ -435,17 +436,12 @@ func resourceArmServiceFabricClusterRead(d *schema.ResourceData, meta interface{ } if props := resp.ClusterProperties; props != nil { + d.Set("cluster_code_version", props.ClusterCodeVersion) d.Set("cluster_endpoint", props.ClusterEndpoint) d.Set("management_endpoint", props.ManagementEndpoint) d.Set("reliability_level", string(props.ReliabilityLevel)) d.Set("vm_image", props.VMImage) - - upgradeMode := string(props.UpgradeMode) - d.Set("upgrade_mode", upgradeMode) - - if upgradeMode == "Manual" { - d.Set("cluster_code_version", props.ClusterCodeVersion) - } + d.Set("upgrade_mode", string(props.UpgradeMode)) addOnFeatures := flattenServiceFabricClusterAddOnFeatures(props.AddOnFeatures) if err := d.Set("add_on_features", schema.NewSet(schema.HashString, addOnFeatures)); err != nil { From f06da916307a872f66bedb8a83ec6f28687d8130 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Mon, 24 Sep 2018 11:51:48 +1000 Subject: [PATCH 15/15] Supporting having `manual` upgrade mode with the version set by Azure ``` $ acctests azurerm TestAccAzureRMServiceFabricCluster_manualLatest === RUN TestAccAzureRMServiceFabricCluster_manualLatest --- PASS: TestAccAzureRMServiceFabricCluster_manualLatest (96.07s) PASS ok github.com/terraform-providers/terraform-provider-azurerm/azurerm 97.192s ``` --- .../resource_arm_service_fabric_cluster.go | 7 +++-- ...esource_arm_service_fabric_cluster_test.go | 27 +++++++++++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/azurerm/resource_arm_service_fabric_cluster.go b/azurerm/resource_arm_service_fabric_cluster.go index 75563074cac1..e0a91059cf17 100644 --- a/azurerm/resource_arm_service_fabric_cluster.go +++ b/azurerm/resource_arm_service_fabric_cluster.go @@ -54,10 +54,9 @@ func resourceArmServiceFabricCluster() *schema.Resource { }, "cluster_code_version": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.NoZeroValues, + Type: schema.TypeString, + Optional: true, + Computed: true, }, "management_endpoint": { diff --git a/azurerm/resource_arm_service_fabric_cluster_test.go b/azurerm/resource_arm_service_fabric_cluster_test.go index ebc0b8681cfb..61956835cd53 100644 --- a/azurerm/resource_arm_service_fabric_cluster_test.go +++ b/azurerm/resource_arm_service_fabric_cluster_test.go @@ -79,6 +79,33 @@ func TestAccAzureRMServiceFabricCluster_manualClusterCodeVersion(t *testing.T) { }) } +func TestAccAzureRMServiceFabricCluster_manualLatest(t *testing.T) { + resourceName := "azurerm_service_fabric_cluster.test" + ri := acctest.RandInt() + location := testLocation() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMServiceFabricClusterDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMServiceFabricCluster_manualClusterCodeVersion(ri, location, ""), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMServiceFabricClusterExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "upgrade_mode", "Manual"), + resource.TestCheckResourceAttrSet(resourceName, "cluster_code_version"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func TestAccAzureRMServiceFabricCluster_addOnFeatures(t *testing.T) { resourceName := "azurerm_service_fabric_cluster.test" ri := acctest.RandInt()