Skip to content

Commit 4cb6a84

Browse files
tsimacekTomas Simacek
and
Tomas Simacek
authored
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
}

examples/azure_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
}

examples/azure_array/terraform.tfvars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ resource_group_name = "resource_xxxx"
55
license_key = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
66
log_sender_domain = "example-company.org"
77
alert_recipients = ["admin1@example-company.org", "admin2@example-company.org"]
8-
array_model = "V10MUR1"
8+
array_model = "V10MP2R2"
99
zone = 1
1010
virtual_network_id = "/subscriptions/xxxxxxxxxxxxxx/resourceGroups/xxxxxxxxxxxxxx/providers/Microsoft.Network/virtualNetworks/xxxxxxxxxxxxxx"
1111
key_vault_id = "/subscriptions/xxxxxxxxxxxxxx/resourceGroups/xxxxxxxxxxxxxx/providers/Microsoft.KeyVault/vaults/xxxxxxxxxxxxxx"

go.mod

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ require (
2424
github.com/mattn/go-sqlite3 v1.14.16
2525
github.com/stretchr/testify v1.8.4
2626
github.com/terraform-providers/terraform-provider-azurerm v1.44.0
27-
golang.org/x/crypto v0.14.0
28-
golang.org/x/term v0.13.0
27+
golang.org/x/crypto v0.21.0
28+
golang.org/x/term v0.18.0
2929
)
3030

3131
require github.com/google/uuid v1.3.1 // indirect
@@ -45,23 +45,23 @@ require (
4545
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
4646
github.com/davecgh/go-spew v1.1.1 // indirect
4747
github.com/dimchansky/utfbom v1.1.1 // indirect
48-
github.com/fatih/color v1.13.0 // indirect
48+
github.com/fatih/color v1.16.0 // indirect
4949
github.com/go-openapi/analysis v0.21.4 // indirect
5050
github.com/go-openapi/jsonpointer v0.19.5 // indirect
5151
github.com/go-openapi/jsonreference v0.20.0 // indirect
5252
github.com/go-openapi/loads v0.21.2 // indirect
5353
github.com/go-openapi/spec v0.20.7 // indirect
5454
github.com/gofrs/uuid v4.3.0+incompatible // indirect
55-
github.com/golang/protobuf v1.5.2 // indirect
55+
github.com/golang/protobuf v1.5.3 // indirect
5656
github.com/google/go-cmp v0.5.9 // indirect
5757
github.com/hashicorp/errwrap v1.1.0 // indirect
5858
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
5959
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
6060
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
61-
github.com/hashicorp/go-hclog v1.3.1 // indirect
61+
github.com/hashicorp/go-hclog v1.6.3 // indirect
6262
github.com/hashicorp/go-multierror v1.1.1 // indirect
6363
github.com/hashicorp/go-plugin v1.4.5 // indirect
64-
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
64+
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
6565
github.com/hashicorp/go-uuid v1.0.3 // indirect
6666
github.com/hashicorp/hc-install v0.4.0 // indirect
6767
github.com/hashicorp/hcl/v2 v2.14.1 // indirect
@@ -78,7 +78,7 @@ require (
7878
github.com/manicminer/hamilton v0.50.0 // indirect
7979
github.com/manicminer/hamilton-autorest v0.3.0 // indirect
8080
github.com/mattn/go-colorable v0.1.13 // indirect
81-
github.com/mattn/go-isatty v0.0.16 // indirect
81+
github.com/mattn/go-isatty v0.0.20 // indirect
8282
github.com/mitchellh/copystructure v1.2.0 // indirect
8383
github.com/mitchellh/go-homedir v1.1.0 // indirect
8484
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
@@ -94,14 +94,14 @@ require (
9494
github.com/vmihailenco/tagparser v0.1.2 // indirect
9595
github.com/zclconf/go-cty v1.11.1 // indirect
9696
go.mongodb.org/mongo-driver v1.10.3 // indirect
97-
golang.org/x/net v0.17.0 // indirect
98-
golang.org/x/oauth2 v0.1.0 // indirect
99-
golang.org/x/sys v0.13.0 // indirect
100-
golang.org/x/text v0.13.0 // indirect
97+
golang.org/x/net v0.23.0 // indirect
98+
golang.org/x/oauth2 v0.7.0 // indirect
99+
golang.org/x/sys v0.20.0 // indirect
100+
golang.org/x/text v0.14.0 // indirect
101101
google.golang.org/appengine v1.6.7 // indirect
102-
google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71 // indirect
103-
google.golang.org/grpc v1.50.1 // indirect
104-
google.golang.org/protobuf v1.28.1 // indirect
102+
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
103+
google.golang.org/grpc v1.56.3 // indirect
104+
google.golang.org/protobuf v1.33.0 // indirect
105105
gopkg.in/yaml.v2 v2.4.0 // indirect
106106
gopkg.in/yaml.v3 v3.0.1 // indirect
107107
)

0 commit comments

Comments
 (0)