Skip to content
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

Remove workspace includes from policy set reads #1080

Merged
merged 2 commits into from
Oct 2, 2023
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ BUG FIXES:
* `r/tfe_team_project_access`: Fixes a panic that occurs when the client is configured against an older TFE release, by @sebasslash [1011](https://github.com/hashicorp/terraform-provider-tfe/pull/1011)
* The provider no longer makes two service discovery requests per provider config, by @brandonc [1034](https://github.com/hashicorp/terraform-provider-tfe/pull/1034)
* `d/tfe_policy_set`: Add `excluded_workspace_ids` attribute, by @Netra2104 [1035](https://github.com/hashicorp/terraform-provider-tfe/pull/1035)
* `r/tfe_workspace_policy_set` and `r/tfe_workspace_policy_set_exclusion`: Removed workspace-related `include` parameters since included workspace data is not required to manage these resources, by @jbonhag [1080](https://github.com/hashicorp/terraform-provider-tfe/pull/1080)

FEATURES:
* `d/tfe_organization_membership`: Add `organization_membership_id` attribute, by @laurenolivia [997](https://github.com/hashicorp/terraform-provider-tfe/pull/997)
Expand Down
4 changes: 1 addition & 3 deletions internal/provider/resource_tfe_workspace_policy_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ func resourceTFEWorkspacePolicySetRead(d *schema.ResourceData, meta interface{})
workspaceID := d.Get("workspace_id").(string)

log.Printf("[DEBUG] Read configuration of workspace policy set: %s", policySetID)
policySet, err := config.Client.PolicySets.ReadWithOptions(ctx, policySetID, &tfe.PolicySetReadOptions{
Include: []tfe.PolicySetIncludeOpt{tfe.PolicySetWorkspaces},
})
policySet, err := config.Client.PolicySets.Read(ctx, policySetID)
if err != nil {
if errors.Is(err, tfe.ErrResourceNotFound) {
log.Printf("[DEBUG] Policy set %s no longer exists", policySetID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ func resourceTFEWorkspacePolicySetExclusionRead(d *schema.ResourceData, meta int
workspaceExclusionsID := d.Get("workspace_id").(string)

log.Printf("[DEBUG] Read configuration of excluded workspace policy set: %s", policySetID)
policySet, err := config.Client.PolicySets.ReadWithOptions(ctx, policySetID, &tfe.PolicySetReadOptions{
Include: []tfe.PolicySetIncludeOpt{tfe.PolicySetWorkspaceExclusions},
})
policySet, err := config.Client.PolicySets.Read(ctx, policySetID)
if err != nil {
if errors.Is(err, tfe.ErrResourceNotFound) {
log.Printf("[DEBUG] Policy set %s no longer exists", policySetID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"testing"
"time"

tfe "github.com/hashicorp/go-tfe"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)
Expand Down Expand Up @@ -102,9 +101,7 @@ func testAccCheckTFEWorkspacePolicySetExclusionExists(n string) resource.TestChe
return fmt.Errorf("no excluded workspace id set")
}

policySet, err := config.Client.PolicySets.ReadWithOptions(ctx, policySetID, &tfe.PolicySetReadOptions{
Include: []tfe.PolicySetIncludeOpt{tfe.PolicySetWorkspaces},
})
policySet, err := config.Client.PolicySets.Read(ctx, policySetID)
if err != nil {
return fmt.Errorf("error reading polciy set %s: %w", policySetID, err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"testing"
"time"

tfe "github.com/hashicorp/go-tfe"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)
Expand Down Expand Up @@ -100,9 +99,7 @@ func testAccCheckTFEWorkspacePolicySetExists(n string) resource.TestCheckFunc {
return fmt.Errorf("No workspace id set")
}

policySet, err := config.Client.PolicySets.ReadWithOptions(ctx, policySetID, &tfe.PolicySetReadOptions{
Include: []tfe.PolicySetIncludeOpt{tfe.PolicySetWorkspaces},
})
policySet, err := config.Client.PolicySets.Read(ctx, policySetID)
if err != nil {
return fmt.Errorf("error reading polciy set %s: %w", policySetID, err)
}
Expand Down
Loading