Skip to content

Commit

Permalink
Merge pull request hashicorp#1606 from hashicorp/only-fetch-remote-st…
Browse files Browse the repository at this point in the history
…ate-consumers-when-global-sharing-is-false

Only fetch remote state consumers when global remote state is false
  • Loading branch information
Uk1288 authored Feb 12, 2025
2 parents b6a2998 + 3db1c67 commit 806d1b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ FEATURES:
BUG FIXES:
* `r/tfe_stack`: Fix serialization issue when using github app installation within vcs_repo block, by @mjyocca [#1572](https://github.com/hashicorp/terraform-provider-tfe/pull/1572)

* `r/tfe_workspace_settings`: Prevent fetching of all workspaces as the `remote_state_consumer_ids` when `global_remote_state` is set to true, by @uk1288 [#1606](https://github.com/hashicorp/terraform-provider-tfe/pull/1606)

## v.0.63.0

BUG FIXES:
Expand Down
12 changes: 6 additions & 6 deletions internal/provider/resource_tfe_workspace_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,13 @@ func (r *workspaceSettings) workspaceSettingsModelFromTFEWorkspace(ws *tfe.Works

result.RemoteStateConsumerIDs = types.SetNull(types.StringType)

_, remoteStateConsumerIDs, err := readWorkspaceStateConsumers(ws.ID, r.config.Client)
if err != nil {
log.Printf("[ERROR] Error reading remote state consumers for workspace %s: %s", ws.ID, err)
return nil
}

if !ws.GlobalRemoteState {
_, remoteStateConsumerIDs, err := readWorkspaceStateConsumers(ws.ID, r.config.Client)
if err != nil {
log.Printf("[ERROR] Error reading remote state consumers for workspace %s: %s", ws.ID, err)
return nil
}

remoteStateConsumerIDValues, diags := types.SetValueFrom(ctx, types.StringType, remoteStateConsumerIDs)
if diags.HasError() {
log.Printf("[ERROR] Error reading remote state consumers for workspace %s: %v", ws.ID, diags)
Expand Down

0 comments on commit 806d1b1

Please sign in to comment.