-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
azurerm_service_fabric_cluster
- support for specifying the cluster code version
#1945
Changes from 7 commits
5dab9e0
c7c080a
16c9c64
762f6e4
71672ce
695c118
e5991f4
26a2db6
11f2ba0
b20430b
3f1f375
a15e2f2
2b6309a
6cdb272
6d13c16
6f1d1f2
f06da91
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# make sure all .go files stay LF, this will help developers on Windows | ||
*.go text eol=lf |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,11 @@ func resourceArmServiceFabricCluster() *schema.Resource { | |
}, false), | ||
}, | ||
|
||
"cluster_code_version": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
}, | ||
steve-hawkins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
"management_endpoint": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
|
@@ -97,7 +102,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": { | ||
|
@@ -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), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we've run the test suite here and this fails because the
could we update this to only set the field if it's got a value? e.g.
(we also need to update the Create above to do the same thing) |
||
}, | ||
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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe the test failure here is because there's a space at the end of this string (so the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @steve-hawkins since this PR otherwise LGTM - I hope you don't mind but I've pushed a commit to remove the extra space (and will kick off the tests now) |
||
d.Set("vm_image", props.VMImage) | ||
|
||
addOnFeatures := flattenServiceFabricClusterAddOnFeatures(props.AddOnFeatures) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very minor but could we align these assignments? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry copy and paste job |
||
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" { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is outside of the scope of this PR.