Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- `scalr_provider_configuration`: Service account email is no longer required when using OIDC credentials in the Google provider configuration. ([#469](https://github.com/Scalr/terraform-provider-scalr/pull/469))
- `scalr_access_policy`: changed type of `role_ids` attribute from TypeList to TypeSet. ([#466](https://github.com/Scalr/terraform-provider-scalr/pull/466))
- `scalr_iam_team`: changed type of `users` attribute from TypeList to TypeSet. ([#466](https://github.com/Scalr/terraform-provider-scalr/pull/466))
- `scalr_policy_group`: changed type of `environments` attribute from TypeList to TypeSet. ([#466](https://github.com/Scalr/terraform-provider-scalr/pull/466))
- `scalr_webhook`: changed type of `events` attribute from TypeList to TypeSet. ([#466](https://github.com/Scalr/terraform-provider-scalr/pull/466))
- Added sorting for computed attributes with List of String type in resources and data sources. ([#466](https://github.com/Scalr/terraform-provider-scalr/pull/466))

## [3.9.0] - 2025-09-19

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/access_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ resource "scalr_access_policy" "team_read_all_on_acc_scope" {

### Required

- `role_ids` (List of String) The list of the role IDs.
- `role_ids` (Set of String) The list of the role IDs.
- `scope` (Block List, Min: 1, Max: 1) Defines the scope where access policy is applied. (see [below for nested schema](#nestedblock--scope))
- `subject` (Block List, Min: 1, Max: 1) Defines the subject of the access policy. (see [below for nested schema](#nestedblock--subject))

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/iam_team.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ resource "scalr_iam_team" "example" {
- `account_id` (String) An identifier of the Scalr account, in the format `acc-<RANDOM STRING>`.
- `description` (String) A verbose description of the team.
- `identity_provider_id` (String) An identifier of the login identity provider, in the format `idp-<RANDOM STRING>`. This is required when `account_id` is not specified.
- `users` (List of String) A list of the user identifiers to add to the team.
- `users` (Set of String) A list of the user identifiers to add to the team.

### Read-Only

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/policy_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ resource "scalr_policy_group" "example" {

- `account_id` (String) The identifier of the Scalr account, in the format `acc-<RANDOM STRING>`.
- `common_functions_folder` (String) An absolute path from the repository root to the folder that contains common rego functions.
- `environments` (List of String) A list of the environments the policy group is linked to. Use `["*"]` to enforce in all environments. To manage a linkage use either this attribute or the `scalr_policy_group_linkage` resource.
- `environments` (Set of String) A list of the environments the policy group is linked to. Use `["*"]` to enforce in all environments. To manage a linkage use either this attribute or the `scalr_policy_group_linkage` resource.
- `opa_version` (String) The version of Open Policy Agent to run policies against. If omitted, the system default version is assigned.

### Read-Only
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/webhook.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ resource "scalr_webhook" "example2" {

### Required

- `events` (List of String) List of event IDs.
- `events` (Set of String) List of event IDs.
- `name` (String) Name of the webhook.
- `url` (String) Endpoint URL. Required if `endpoint_id` is not set.

Expand Down
4 changes: 3 additions & 1 deletion internal/provider/data_source_scalr_access_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"log"
"sort"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -124,10 +125,11 @@ func dataSourceScalrAccessPolicyRead(ctx context.Context, d *schema.ResourceData
scope[0] = scopeEl
_ = d.Set("scope", scope)

roleIds := make([]interface{}, 0)
roleIds := make([]string, 0)
for _, role := range ap.Roles {
roleIds = append(roleIds, role.ID)
}
sort.Strings(roleIds)

_ = d.Set("role_ids", roleIds)
_ = d.Set("is_system", ap.IsSystem)
Expand Down
2 changes: 2 additions & 0 deletions internal/provider/data_source_scalr_agent_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"log"
"sort"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

Expand Down Expand Up @@ -148,6 +149,7 @@ func dataSourceScalrAgentPoolRead(ctx context.Context, d *schema.ResourceData, m
for _, workspace := range agentPool.Workspaces {
workspaces = append(workspaces, workspace.ID)
}
sort.Strings(workspaces)

log.Printf("[DEBUG] agent pool %s workspaces: %+v", agentPool.ID, workspaces)
_ = d.Set("workspace_ids", workspaces)
Expand Down
2 changes: 2 additions & 0 deletions internal/provider/data_source_scalr_iam_team.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package provider

import (
"context"
"sort"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -107,6 +108,7 @@ func dataSourceScalrIamTeamRead(ctx context.Context, d *schema.ResourceData, met
for _, u := range team.Users {
users = append(users, u.ID)
}
sort.Strings(users)
}
_ = d.Set("users", users)

Expand Down
3 changes: 3 additions & 0 deletions internal/provider/data_source_scalr_iam_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package provider
import (
"context"
"log"
"sort"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

Expand Down Expand Up @@ -103,6 +104,7 @@ func dataSourceScalrIamUserRead(ctx context.Context, d *schema.ResourceData, met
for _, idp := range u.IdentityProviders {
idps = append(idps, idp.ID)
}
sort.Strings(idps)
}
_ = d.Set("identity_providers", idps)

Expand All @@ -111,6 +113,7 @@ func dataSourceScalrIamUserRead(ctx context.Context, d *schema.ResourceData, met
for _, t := range u.Teams {
teams = append(teams, t.ID)
}
sort.Strings(teams)
}
_ = d.Set("teams", teams)

Expand Down
2 changes: 2 additions & 0 deletions internal/provider/data_source_scalr_policy_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package provider
import (
"context"
"log"
"sort"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

Expand Down Expand Up @@ -197,6 +198,7 @@ func dataSourceScalrPolicyGroupRead(ctx context.Context, d *schema.ResourceData,
for _, env := range pg.Environments {
envs = append(envs, env.ID)
}
sort.Strings(envs)
_ = d.Set("environments", envs)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package provider
import (
"context"
"fmt"
"sort"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -78,6 +79,7 @@ func dataSourceScalrProviderConfigurationsRead(ctx context.Context, d *schema.Re
// Update the page number to get the next page.
options.PageNumber = providerConfigurations.NextPage
}
sort.Strings(ids)

_ = d.Set("ids", ids)
d.SetId(fmt.Sprintf("%d", schema.HashString(accountID+name+providerName)))
Expand Down
3 changes: 3 additions & 0 deletions internal/provider/data_source_scalr_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package provider
import (
"context"
"log"
"sort"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

Expand Down Expand Up @@ -111,6 +112,8 @@ func dataSourceScalrRoleRead(ctx context.Context, d *schema.ResourceData, meta i
for _, permission := range role.Permissions {
permissionNames = append(permissionNames, permission.ID)
}
sort.Strings(permissionNames)

_ = d.Set("permissions", permissionNames)
}

Expand Down
3 changes: 3 additions & 0 deletions internal/provider/data_source_scalr_service_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package provider
import (
"context"
"log"
"sort"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -136,6 +137,8 @@ func dataSourceScalrServiceAccountRead(ctx context.Context, d *schema.ResourceDa
for _, owner := range sa.Owners {
owners = append(owners, owner.ID)
}
sort.Strings(owners)

_ = d.Set("owners", owners)

_ = d.Set("name", sa.Name)
Expand Down
2 changes: 2 additions & 0 deletions internal/provider/data_source_scalr_ssh_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"sort"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -97,6 +98,7 @@ func dataSourceScalrSSHKeyRead(ctx context.Context, d *schema.ResourceData, meta
for _, environment := range sshKey.Environments {
environmentIDs = append(environmentIDs, environment.ID)
}
sort.Strings(environmentIDs)
_ = d.Set("environments", environmentIDs)
}

Expand Down
2 changes: 2 additions & 0 deletions internal/provider/data_source_scalr_vcs_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package provider

import (
"context"
"sort"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -118,6 +119,7 @@ func dataSourceScalrVcsProviderRead(ctx context.Context, d *schema.ResourceData,
for _, env := range vcsProvider.Environments {
envIds = append(envIds, env.ID)
}
sort.Strings(envIds)

// Update the configuration.
_ = d.Set("vcs_type", vcsProvider.VcsType)
Expand Down
2 changes: 2 additions & 0 deletions internal/provider/data_source_scalr_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package provider
import (
"context"
"log"
"sort"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

Expand Down Expand Up @@ -170,6 +171,7 @@ func dataSourceScalrWebhookRead(ctx context.Context, d *schema.ResourceData, met
for _, event := range webhook.Events {
events = append(events, event.ID)
}
sort.Strings(events)
}
_ = d.Set("events", events)

Expand Down
2 changes: 2 additions & 0 deletions internal/provider/data_source_scalr_workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"log"
"sort"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
Expand Down Expand Up @@ -372,6 +373,7 @@ func dataSourceScalrWorkspaceRead(ctx context.Context, d *schema.ResourceData, m
for _, tag := range workspace.Tags {
tags = append(tags, tag.ID)
}
sort.Strings(tags)
}
_ = d.Set("tag_ids", tags)

Expand Down
2 changes: 2 additions & 0 deletions internal/provider/data_source_scalr_workspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package provider
import (
"context"
"fmt"
"sort"
"strings"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
Expand Down Expand Up @@ -98,6 +99,7 @@ func dataSourceScalrWorkspacesRead(ctx context.Context, d *schema.ResourceData,
}
options.PageNumber = wl.NextPage
}
sort.Strings(ids)

_ = d.Set("ids", ids)
d.SetId(fmt.Sprintf("%d", schema.HashString(id.String())))
Expand Down
4 changes: 4 additions & 0 deletions internal/provider/environment_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package provider
import (
"context"
"fmt"
"sort"

"github.com/hashicorp/terraform-plugin-framework-validators/datasourcevalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
Expand Down Expand Up @@ -211,6 +212,7 @@ func (d *environmentDataSource) Read(ctx context.Context, req datasource.ReadReq
for i, group := range environment.PolicyGroups {
policyGroups[i] = group.ID
}
sort.Strings(policyGroups)
policyGroupsValue, diags := types.ListValueFrom(ctx, types.StringType, policyGroups)
resp.Diagnostics.Append(diags...)
cfg.PolicyGroups = policyGroupsValue
Expand All @@ -219,6 +221,7 @@ func (d *environmentDataSource) Read(ctx context.Context, req datasource.ReadReq
for i, pcfg := range environment.DefaultProviderConfigurations {
defaultPcfgs[i] = pcfg.ID
}
sort.Strings(defaultPcfgs)
defaultPcfgsValue, diags := types.ListValueFrom(ctx, types.StringType, defaultPcfgs)
resp.Diagnostics.Append(diags...)
cfg.DefaultProviderConfigurations = defaultPcfgsValue
Expand All @@ -227,6 +230,7 @@ func (d *environmentDataSource) Read(ctx context.Context, req datasource.ReadReq
for i, tag := range environment.Tags {
tags[i] = tag.ID
}
sort.Strings(tags)
tagsValue, diags := types.ListValueFrom(ctx, types.StringType, tags)
resp.Diagnostics.Append(diags...)
cfg.TagIDs = tagsValue
Expand Down
2 changes: 2 additions & 0 deletions internal/provider/environment_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package provider
import (
"context"
"errors"
"sort"

"github.com/hashicorp/terraform-plugin-framework-validators/setvalidator"
"github.com/hashicorp/terraform-plugin-framework/diag"
Expand Down Expand Up @@ -89,6 +90,7 @@ func environmentResourceModelFromAPI(ctx context.Context, env *scalr.Environment
for i, group := range env.PolicyGroups {
policyGroups[i] = group.ID
}
sort.Strings(policyGroups)
policyGroupsValue, d := types.ListValueFrom(ctx, types.StringType, policyGroups)
diags.Append(d...)
model.PolicyGroups = policyGroupsValue
Expand Down
3 changes: 3 additions & 0 deletions internal/provider/provider_configuration_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package provider
import (
"context"
"fmt"
"sort"

"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
Expand Down Expand Up @@ -144,6 +145,7 @@ func (r *providerConfigurationDataSource) Read(ctx context.Context, req datasour
for i, owner := range providerConfiguration.Owners {
owners[i] = owner.ID
}
sort.Strings(owners)
ownersValue, d := types.ListValueFrom(ctx, types.StringType, owners)
resp.Diagnostics.Append(d...)
cfg.Owners = ownersValue
Expand All @@ -156,6 +158,7 @@ func (r *providerConfigurationDataSource) Read(ctx context.Context, req datasour
for i, environment := range providerConfiguration.Environments {
environments[i] = environment.ID
}
sort.Strings(environments)
}
environmentsValue, d := types.ListValueFrom(ctx, types.StringType, environments)
resp.Diagnostics.Append(d...)
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/resource_scalr_access_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func resourceScalrAccessPolicy() *schema.Resource {
},
"role_ids": {
Description: "The list of the role IDs.",
Type: schema.TypeList,
Type: schema.TypeSet,
Required: true,
MinItems: 1,
MaxItems: 128,
Expand All @@ -131,7 +131,7 @@ func resourceScalrAccessPolicy() *schema.Resource {
func parseRoleIdDefinitions(d *schema.ResourceData) ([]*scalr.Role, error) {
roles := make([]*scalr.Role, 0)

roleIds := d.Get("role_ids").([]interface{})
roleIds := d.Get("role_ids").(*schema.Set).List()
err := ValidateIDsDefinitions(roleIds)
if err != nil {
return nil, fmt.Errorf("Got error during parsing role ids: %s", err.Error())
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/resource_scalr_iam_team.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func resourceScalrIamTeam() *schema.Resource {
},
"users": {
Description: "A list of the user identifiers to add to the team.",
Type: schema.TypeList,
Type: schema.TypeSet,
Optional: true,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
Expand All @@ -63,7 +63,7 @@ func resourceScalrIamTeam() *schema.Resource {
func parseUserDefinitions(d *schema.ResourceData) ([]*scalr.User, error) {
var users []*scalr.User

userIDs := d.Get("users").([]interface{})
userIDs := d.Get("users").(*schema.Set).List()
err := ValidateIDsDefinitions(userIDs)
if err != nil {
return nil, fmt.Errorf("Got error during parsing users: %s", err.Error())
Expand Down
Loading
Loading