Skip to content

Commit 4cb6a84

Browse files
tsimacekTomas Simacek
andauthored
v0.11.0 release (#11)
Added support for V10MP2R2 model Removed support for specifying version plan by specific version (e.g 6.6.4) Co-authored-by: Tomas Simacek <tsimacek@pruestorage.com>
1 parent b56e7da commit 4cb6a84

File tree

14 files changed

+81
-71
lines changed

14 files changed

+81
-71
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.11.0 (Sep, 20, 2024)
2+
* Added support for V10MP2R2 model
3+
* Removed support for specifying version plan by specific version (e.g `6.6.4`)
4+
15
## 0.10.0 (July 9, 2024)
26

37
* Added support for tagging by resource type, refer to the [documentation](docs/resources/array_azure.md#nested-schema-for-resource_tags)

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ setup-basic:
2323
@mkdir -p .build-logs/
2424

2525
setup-goreleaser:
26-
@curl -sfLO https://github.com/goreleaser/goreleaser/releases/download/v1.9.2/goreleaser_Linux_x86_64.tar.gz
26+
@curl -sfLO https://github.com/goreleaser/goreleaser/releases/download/v2.0.1/goreleaser_Linux_x86_64.tar.gz
2727
@mkdir -p $(TMPBIN)
2828
@tar -C $(TMPBIN) -xf goreleaser_Linux_x86_64.tar.gz
2929
@rm goreleaser_Linux_x86_64.tar.gz
@@ -36,7 +36,7 @@ test-goreleaser-release: setup-goreleaser setup-basic
3636
@gpg --batch --delete-secret-keys $(TEST_GPG_FINGERPRINT) &>/dev/null || true
3737
@gpg --batch --delete-keys $(TEST_GPG_FINGERPRINT) &>/dev/null || true
3838
@gpg --import < testing/private-key.gpg >> .build-logs/goreleaser-release 2>&1
39-
@GPG_FINGERPRINT=$(TEST_GPG_FINGERPRINT) CI="" goreleaser release --debug --snapshot --rm-dist >> .build-logs/goreleaser-release 2>&1
39+
@GPG_FINGERPRINT=$(TEST_GPG_FINGERPRINT) CI="" goreleaser release --verbose --snapshot --clean >> .build-logs/goreleaser-release 2>&1
4040

4141
test-goreleaser-check: setup-goreleaser setup-basic
4242
@CI="" goreleaser check >> .build-logs/goreleaser-check 2>&1

cbs/common.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ func validateAzureManagedApplicationName(v interface{}, k string) (warnings []st
142142
func validateVersionPrefixTag(v interface{}, k string) (warnings []string, errors []error) {
143143
value := v.(string)
144144

145-
pattern := `^\d+\.\d+(?:\.\d+|\.x)?$`
145+
pattern := `^\d+\.\d+\.x$`
146146
regexpPattern := regexp.MustCompile(pattern)
147147

148148
if !regexpPattern.MatchString(value) {
149-
errors = append(errors, fmt.Errorf("version prefix tag format not correct"))
149+
errors = append(errors, fmt.Errorf("%q must follow {major}.{minor}.x format. See documentation for examples", k))
150150
}
151151

152152
return warnings, errors

cbs/data_azure_plans.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func (a PlanByVersion) Len() int { return len(a) }
125125
func (a PlanByVersion) Less(i, j int) bool { return a[i].Version.LessThan(&a[j].Version) }
126126
func (a PlanByVersion) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
127127

128-
var plan_name_regexp = regexp.MustCompile(`^[\w]+_([\d]+)_([\d]+)_([\d]+)$`)
128+
var plan_name_regexp = regexp.MustCompile(`^[\w]+_([\d]+)_([\d]+)_(x)$`)
129129

130130
// Retrieve a plan information from Azure DefaultTemplate artifact
131131
func GetPlanFromTemplateJson(data []byte) (*Plan, error) {
@@ -152,7 +152,11 @@ func versionPlans(plans []Plan) ([]VersionedPlan, error) {
152152
var versioned_plans []VersionedPlan
153153
for _, plan := range plans {
154154
match := plan_name_regexp.FindStringSubmatch(plan.Name)
155-
version, err := version.NewVersion(fmt.Sprintf("%s.%s.%s", match[1], match[2], match[3]))
155+
patch := match[3]
156+
if patch == "x" {
157+
patch = "99"
158+
}
159+
version, err := version.NewVersion(fmt.Sprintf("%s.%s.%s", match[1], match[2], patch))
156160
if err != nil {
157161
return nil, fmt.Errorf("Unable to parse version string in plan name: %s", plan.Name)
158162
}

cbs/data_azure_plans_test.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,12 @@ func testAccDataAzurePlans() resource.TestCheckFunc {
9696
for i := 0; i < plans_size; i++ {
9797
// Check product version derivation from plan name makes sense.
9898
plan_name := data_resource.Primary.Attributes["plans."+strconv.Itoa(i)+".name"]
99-
name_match := plan_name_regexp.FindStringSubmatch(plan_name)
100-
name_version, err := version.NewVersion(fmt.Sprintf("%s.%s.%s", name_match[1], name_match[2], name_match[3]))
101-
if err != nil {
102-
return err
103-
}
104-
reference_version, _ := version.NewVersion("6.0.0")
105-
if name_version.LessThanOrEqual(reference_version) {
106-
return fmt.Errorf("Incorrect product version: %s", name_version.String())
99+
if !plan_name_regexp.MatchString(plan_name) {
100+
return fmt.Errorf("Incorrect plan id/name: %s, it should be in format of ", plan_name)
107101
}
108-
109102
// We expect that product and publisher is a well-known string.
110103
plan_product := data_resource.Primary.Attributes["plans."+strconv.Itoa(i)+".product"]
111-
if plan_product != "pure_storage_cloud_block_store_deployment" {
104+
if plan_product != "pure_storage_cloud_block_store_deployment" && plan_product != "pure_cloud_block_store_product_deployment" {
112105
return fmt.Errorf("Incorrect plan product: %s", plan_product)
113106
}
114107
plan_publisher := data_resource.Primary.Attributes["plans."+strconv.Itoa(i)+".publisher"]
@@ -138,13 +131,17 @@ func testAccDataCbsPlanAzure() resource.TestCheckFunc {
138131

139132
plan_name := data_resource.Primary.Attributes["name"]
140133
match := plan_name_regexp.FindStringSubmatch(plan_name)
141-
version_tag := fmt.Sprintf("%s.%s.%s", match[1], match[2], match[3])
134+
patch := match[3]
135+
if patch == "x" {
136+
patch = "99"
137+
}
138+
version_tag := fmt.Sprintf("%s.%s.%s", match[1], match[2], patch)
142139
if len(match) != 4 || !re.MatchString(version_tag) {
143140
return fmt.Errorf("Incorrect plan name: %s", plan_name)
144141
}
145142

146143
plan_product := data_resource.Primary.Attributes["product"]
147-
if plan_product != "pure_storage_cloud_block_store_deployment" {
144+
if plan_product != "pure_storage_cloud_block_store_deployment" && plan_product != "pure_cloud_block_store_product_deployment" {
148145
return fmt.Errorf("Incorrect plan product : %s", plan_product)
149146
}
150147

cbs/resource_array_azure.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ import (
5151

5252
// Default managed application plan
5353
const (
54-
defaultPlanName = "cbs_azure_6_3_8"
55-
defaultPlanProduct = "pure_storage_cloud_block_store_deployment"
54+
defaultPlanName = "cbs_azure_6_5_x"
55+
defaultPlanProduct = "pure_cloud_block_store_product_deployment"
5656
defaultPlanPublisher = "purestoragemarketplaceadmin"
5757
defaultPlanVersion = "1.0.0"
5858
)
@@ -166,6 +166,7 @@ func resourceArrayAzure() *schema.Resource {
166166
ValidateFunc: validation.StringInSlice([]string{
167167
"V10MUR1",
168168
"V20MUR1",
169+
"V10MP2R2",
169170
"V20MP2R2",
170171
}, false),
171172
},

cbs/resource_array_azure_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func TestAccArrayAzure_basic(t *testing.T) {
4949
// when tags are provided plan is needed to get plan specific
5050
// list of resources to assign all tags to each resource
5151
cbsAzureParam.PlanName = plans[0].Plan.Name
52-
cbsAzureParam.PlanProduct = "pure_storage_cloud_block_store_deployment"
52+
cbsAzureParam.PlanProduct = plans[0].Plan.Product
5353
cbsAzureParam.PlanPublisher = "purestoragemarketplaceadmin"
5454
cbsAzureParam.PlanVersion = plans[0].Plan.Version
5555

docs/data-sources/azure_plans.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ description: |-
88

99
# cbs_plan_azure (Data Source)
1010

11-
Provides plan specific details specified by plan version parameter (or version prefix e.g. `6.6.4` or `6.6.x`)
11+
Provides plan specific details specified by plan version parameter. The version needs to be specified in format of version prefix e.g. `6.5.x` or `6.6.x` and similar. Specific versions like `6.6.10` are not supported as only the latest version in a given release line is svailable in the marketplace offer for deployment.
1212

1313
## Example Usage
1414
```hcl
15-
data "cbs_plan_azure" "66x_latest_plan" {
15+
data "cbs_plan_azure" "cbs_plan_66x" {
1616
plan_version = "6.6.x"
1717
}
1818
1919
resource "cbs_array_azure" "azure_instance" {
2020
(...)
2121
2222
plan {
23-
name = data.cbs_plan_azure.66x_latest_plan.name
24-
product = data.cbs_plan_azure.66x_latest_plan.product
25-
publisher = data.cbs_plan_azure.66x_latest_plan.publisher
26-
version = data.cbs_plan_azure.66x_latest_plan.version
23+
name = data.cbs_plan_azure.cbs_plan_66x.name
24+
product = data.cbs_plan_azure.cbs_plan_66x.product
25+
publisher = data.cbs_plan_azure.cbs_plan_66x.publisher
26+
version = data.cbs_plan_azure.cbs_plan_66x.version
2727
}
2828
2929
lifecycle {
@@ -34,7 +34,7 @@ resource "cbs_array_azure" "azure_instance" {
3434
}
3535
3636
output "cbs_azure_available_plans" {
37-
value = data.cbs_plan_azure.66x_latest_plan
37+
value = data.cbs_plan_azure.cbs_plan_66x
3838
}
3939
```
4040

docs/resources/array_azure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ resource "cbs_array_azure" "azure_instance" {
103103
## Argument Reference
104104

105105
- `alert_recipients` (Optional) - List of email addresses to receive alerts.
106-
- `array_model` (Required) - CBS array size to launch. The possible values are `V10MUR1`, `V20MUR1` or `V20MP2R2`.
106+
- `array_model` (Required) - CBS array size to launch. The possible values are `V10MUR1`, `V20MUR1`, `V10MP2R2` or `V20MP2R2`.
107107
- `array_name` (Required) - Name of the array, and the name of the managed application.
108108
Required when the array is deployed for use in a Fusion cluster.
109109
- `iscsi_subnet` (Required) - Subnet containing the iSCSI interfaces on the array.

examples/aws_array/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
cbs = {
44
source = "PureStorage-OpenConnect/cbs"
5-
version = "~> 0.10.0"
5+
version = "~> 0.11.0"
66
}
77
}
88
}

0 commit comments

Comments
 (0)