Skip to content

Commit

Permalink
Merge branch 'main' into readme_update
Browse files Browse the repository at this point in the history
  • Loading branch information
shenda1 authored Nov 20, 2024
2 parents 72125e6 + 21e18ff commit 80b11d3
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
4 changes: 4 additions & 0 deletions powerscale/helper/role_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ func GetRoles(ctx context.Context, client *client.Client, state models.RoleDataS
}

roles, _, err := roleParams.Execute()
if err != nil {
return nil, err
}

// Pagination
for roles.Resume != nil && state.RoleFilter != nil {
roleParams = roleParams.Resume(*roles.Resume)
Expand Down
15 changes: 9 additions & 6 deletions powerscale/provider/s3_bucket_datasource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestAccS3BucketDatasource(t *testing.T) {
})
}

func TestAccS3BucketsourceGetAll(t *testing.T) {
func TestAccS3BucketDatasourceGetAll(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Expand Down Expand Up @@ -157,30 +157,33 @@ resource "powerscale_s3_bucket" "bucket_resource_test" {
}]
}
data "powerscale_s3_bucket" "bucket_datasource_test_all" {}
data "powerscale_s3_bucket" "bucket_datasource_test_all" {
depends_on = [
powerscale_s3_bucket.bucket_resource_test
]
}
`, bucketName, bucketName)

var S3BucketDatasourceConfig = fmt.Sprintf(`
resource "powerscale_s3_bucket" "bucket_resource_test" {
name = "%s"
path = "/ifs/%s"
create_path = true
zone = "System"
acl = [{
grantee = {
name = "Everyone"
type = "wellknown"
}
permission = "FULL_CONTROL"
}]
}
data "powerscale_s3_bucket" "bucket_datasource_test" {
filter {
zone = "System"
owner = "root"
owner = powerscale_s3_bucket.bucket_resource_test.owner
}
depends_on = [
powerscale_s3_bucket.bucket_resource_test
]
}
`, bucketName, bucketName)
3 changes: 3 additions & 0 deletions powerscale/provider/snapshot_restore_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ func (r *SnapshotRestoreResource) Update(ctx context.Context, request resource.U

state, diags := helper.ManageSnapshotRestore(ctx, r.client, plan)
response.Diagnostics.Append(diags...)
if response.Diagnostics.HasError() {
return
}

// Save updated data into Terraform state
response.Diagnostics.Append(response.State.Set(ctx, &state)...)
Expand Down
4 changes: 4 additions & 0 deletions powerscale/provider/user_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"terraform-provider-powerscale/powerscale/helper"
"terraform-provider-powerscale/powerscale/models"

"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
Expand Down Expand Up @@ -261,6 +262,9 @@ func (d *UserDataSource) Schema(ctx context.Context, req datasource.SchemaReques
},
},
},
Validators: []validator.List{
listvalidator.SizeAtLeast(1),
},
},
"name_prefix": schema.StringAttribute{
Optional: true,
Expand Down
4 changes: 4 additions & 0 deletions powerscale/provider/user_group_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"terraform-provider-powerscale/powerscale/helper"
"terraform-provider-powerscale/powerscale/models"

"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
Expand Down Expand Up @@ -184,6 +185,9 @@ func (d *UserGroupDataSource) Schema(ctx context.Context, req datasource.SchemaR
},
},
},
Validators: []validator.List{
listvalidator.SizeAtLeast(1),
},
},
"name_prefix": schema.StringAttribute{
Optional: true,
Expand Down
1 change: 0 additions & 1 deletion powerscale/provider/user_group_datasource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ func TestAccUserGroupDataSourceAll(t *testing.T) {
var userGroupFilterDataSourceConfig = `
data "powerscale_user_group" "test" {
filter {
names = []
cached = false
# name_prefix = ""
# domain = ""
Expand Down

0 comments on commit 80b11d3

Please sign in to comment.