Skip to content

Commit

Permalink
Add tfe_project table (#42) (#51)
Browse files Browse the repository at this point in the history
Co-authored-by: Edouard de BRYE <[email protected]>
Co-authored-by: ParthaI <[email protected]>
  • Loading branch information
3 people authored Feb 13, 2024
1 parent 10f9ce7 commit 231e873
Show file tree
Hide file tree
Showing 14 changed files with 204 additions and 37 deletions.
71 changes: 71 additions & 0 deletions docs/tables/tfe_project.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: "Steampipe Table: tfe_project - Query Terraform Enterprise Projects using SQL"
description: "Allows users to query Projects in Terraform Enterprise, specifically the ID and name association."
---

# Table: tfe_project - Query Terraform Enterprise Projects using SQL

Terraform Cloud projects let you organize your workspaces into groups. You can structure your projects based on your
organization's resource usage and ownership patterns, such as teams, business units, or services. With Terraform Cloud
Standard Edition, you can give teams access to groups of workspaces using projects.

## Table Usage Guide
The `tfe_project` table provides information about Projects within Terraform Enterprise organization. As a DevOps
engineer or a system administrator, explore project's details through this table, including its ID, name and organization.
Utilize it in conjunction with `tfe_workspace` table to improve grouping and filtering on workspaces insights.

**Important Notes**
- You must specify the `organization` in the `tfe.spc` file to query this table.

## Examples

### List projects
Explore which projects are in the Terraform Enterprise organization.

```sql+postgres
select
id,
name,
organization,
organization_name
from
tfe_project;
```

```sql+sqlite
select
id,
name,
organization,
organization_name
from
tfe_project;
```

### List workspace in a specific project
Explore which workspaces belong to a specific project. This can provide an additional filtering layer to analyse
relative workspaces.

```sql+postgres
select
w.name
from
tfe_workspace as w
join
tfe_project as p
on p.id = w.project_id
where
p.name = 'my-project';
```

```sql+sqlite
select
w.name
from
tfe_workspace as w
join
tfe_project as p
on p.id = w.project_id
where
p.name = 'my-project';
```
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/turbot/steampipe-plugin-tfe
go 1.21

require (
github.com/hashicorp/go-tfe v0.17.1
github.com/hashicorp/go-tfe v1.43.0
github.com/pkg/errors v0.9.1
github.com/turbot/steampipe-plugin-sdk/v5 v5.8.0
)
Expand Down Expand Up @@ -41,7 +41,7 @@ require (
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
Expand All @@ -51,12 +51,12 @@ require (
github.com/hashicorp/go-getter v1.7.3 // indirect
github.com/hashicorp/go-hclog v1.6.1 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
github.com/hashicorp/go-retryablehttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.5 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-slug v0.7.0 // indirect
github.com/hashicorp/go-slug v0.13.3 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/hcl/v2 v2.19.1 // indirect
github.com/hashicorp/jsonapi v0.0.0-20210518035559-1e50d74c8db3 // indirect
github.com/hashicorp/jsonapi v1.2.0 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
Expand Down Expand Up @@ -96,7 +96,7 @@ require (
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.11.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.5.0 // indirect
Expand Down
30 changes: 15 additions & 15 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
Expand Down Expand Up @@ -403,33 +403,33 @@ github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-getter v1.7.3 h1:bN2+Fw9XPFvOCjB0UOevFIMICZ7G2XSQHzfvLUyOM5E=
github.com/hashicorp/go-getter v1.7.3/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744=
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v1.6.1 h1:pa92nu9bPoAqI7p+uPDCIWGAibUdlCi6TYWJEQQkLf8=
github.com/hashicorp/go-hclog v1.6.1/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A=
github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI=
github.com/hashicorp/go-retryablehttp v0.5.2 h1:AoISa4P4IsW0/m4T6St8Yw38gTl5GtBAgfkhYh1xAz4=
github.com/hashicorp/go-retryablehttp v0.5.2/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M=
github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8=
github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo=
github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I=
github.com/hashicorp/go-slug v0.7.0 h1:8HIi6oreWPtnhpYd8lIGQBgp4rXzDWQTOhfILZm+nok=
github.com/hashicorp/go-slug v0.7.0/go.mod h1:Ib+IWBYfEfJGI1ZyXMGNbu2BU+aa3Dzu41RKLH301v4=
github.com/hashicorp/go-tfe v0.17.1 h1:rKk8rfxkohCDTPjZbbe2sYjBKl8Qs4Lnqv3iE4g9yNw=
github.com/hashicorp/go-tfe v0.17.1/go.mod h1:PJOKM4yKS61uJPjvKNRIZrEhsoWrPyytIikpx1X37x8=
github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-slug v0.13.3 h1:JiYNpOkD0HmMWw/lNYiBAUD6+WIBIV7UftKiqIbpNqM=
github.com/hashicorp/go-slug v0.13.3/go.mod h1:RA4C+ezyC2nDsiPM5+1djqagveBBJdSN/fM2QCUziYQ=
github.com/hashicorp/go-tfe v1.43.0 h1:0rFw/87Mw87nBrkH4JkCIYlUlmR+l2IYs4Ip5cVBIC0=
github.com/hashicorp/go-tfe v1.43.0/go.mod h1:bwFaHnmB+XigFoSVYaBXfYiwFI9+RecXTA0CrHT919s=
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl/v2 v2.19.1 h1://i05Jqznmb2EXqa39Nsvyan2o5XyMowW5fnCKW5RPI=
github.com/hashicorp/hcl/v2 v2.19.1/go.mod h1:ThLC89FV4p9MPW804KVbe/cEXoQ8NZEh+JtMeeGErHE=
github.com/hashicorp/jsonapi v0.0.0-20210518035559-1e50d74c8db3 h1:mzwkutymYIXR5oQT9YnfbLuuw7LZmksiHKRPUTN5ijo=
github.com/hashicorp/jsonapi v0.0.0-20210518035559-1e50d74c8db3/go.mod h1:Yog5+CPEM3c99L1CL2CFCYoSzgWm5vTU58idbRUaLik=
github.com/hashicorp/jsonapi v1.2.0 h1:ezDCzOFsKTL+KxVQuA1rNxkIGTvZph1rNu8kT5A8trI=
github.com/hashicorp/jsonapi v1.2.0/go.mod h1:Yog5+CPEM3c99L1CL2CFCYoSzgWm5vTU58idbRUaLik=
github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE=
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
Expand Down Expand Up @@ -757,8 +757,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down
1 change: 1 addition & 0 deletions tfe/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func Plugin(ctx context.Context) *plugin.Plugin {
"tfe_oauth_client": tableTfeOauthClient(ctx),
"tfe_organization": tableTfeOrganization(ctx),
"tfe_organization_member": tableTfeOrganizationMember(ctx),
"tfe_project": tableTfeProject(ctx),
"tfe_run": tableTfeRun(ctx),
"tfe_sentinel_policy": tableTfeSentinelPolicy(ctx),
"tfe_ssh_key": tableTfeSshKey(ctx),
Expand Down
2 changes: 1 addition & 1 deletion tfe/table_tfe_oauth_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func listOauthClient(ctx context.Context, d *plugin.QueryData, h *plugin.Hydrate

pagesLeft := true
for pagesLeft {
result, err := conn.OAuthClients.List(ctx, organizationName, options)
result, err := conn.OAuthClients.List(ctx, organizationName, &options)
if err != nil {
if isNotFoundError(err) {
return nil, nil
Expand Down
2 changes: 1 addition & 1 deletion tfe/table_tfe_organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func listOrganization(ctx context.Context, d *plugin.QueryData, _ *plugin.Hydrat
}
pagesLeft := true
for pagesLeft {
result, err := conn.Organizations.List(ctx, options)
result, err := conn.Organizations.List(ctx, &options)
if err != nil {
plugin.Logger(ctx).Error("tfe_organization.listOrganization", "query_error", err)
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions tfe/table_tfe_organization_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func listOrganizationMember(ctx context.Context, d *plugin.QueryData, h *plugin.
organizationName := data.(string)
limit := d.QueryContext.Limit
options := tfe.OrganizationMembershipListOptions{
Include: "user,teams",
Include: []tfe.OrgMembershipIncludeOpt{tfe.OrgMembershipUser, tfe.OrgMembershipTeam},
ListOptions: tfe.ListOptions{
// https://www.terraform.io/docs/cloud/api/index.html#pagination
PageSize: 100,
Expand All @@ -58,7 +58,7 @@ func listOrganizationMember(ctx context.Context, d *plugin.QueryData, h *plugin.

pagesLeft := true
for pagesLeft {
result, err := conn.OrganizationMemberships.List(ctx, organizationName, options)
result, err := conn.OrganizationMemberships.List(ctx, organizationName, &options)
if err != nil {
plugin.Logger(ctx).Error("tfe_organization_member.listOrganizationMember", "query_error", err)
return nil, err
Expand Down
95 changes: 95 additions & 0 deletions tfe/table_tfe_project.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package tfe

import (
"context"
"github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform"

"github.com/hashicorp/go-tfe"

"github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto"
"github.com/turbot/steampipe-plugin-sdk/v5/plugin"
)

func tableTfeProject(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "tfe_project",
Description: "Projects for the workspaces.",
List: &plugin.ListConfig{
Hydrate: listProject,
},
Get: &plugin.GetConfig{
KeyColumns: plugin.SingleColumn("id"),
Hydrate: getProject,
},
Columns: []*plugin.Column{
// Top columns
{Name: "id", Type: proto.ColumnType_STRING, Description: "ID of the project."},
{Name: "name", Type: proto.ColumnType_STRING, Description: "Name of the project."},
{Name: "organization", Type: proto.ColumnType_JSON, Description: "Organization details that the project belongs to."},
{Name: "organization_name", Type: proto.ColumnType_STRING, Hydrate: GetOrganizationName, Transform: transform.FromValue(), Description: "Name of the organization containing the project."},
},
}
}

func listProject(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) {
conn, err := connect(ctx, d)
if err != nil {
plugin.Logger(ctx).Error("tfe_project.listProject", "connection_error", err)
return nil, err
}
data, err := GetOrganizationName(ctx, d, h)
if err != nil {
return nil, err
}
organizationName := data.(string)
limit := d.QueryContext.Limit
options := tfe.ProjectListOptions{
ListOptions: tfe.ListOptions{
// https://www.terraform.io/docs/cloud/api/index.html#pagination
PageSize: 100,
},
}
if limit != nil {
if *limit < int64(100) {
options.PageSize = int(*limit)
}
}

pagesLeft := true
for pagesLeft {
result, err := conn.Projects.List(ctx, organizationName, &options)
if err != nil {
plugin.Logger(ctx).Error("tfe_project.listProject", "query_error", err)
return nil, err
}
for _, i := range result.Items {
d.StreamListItem(ctx, i)
// Context can be cancelled due to manual cancellation or the limit has been hit
if d.RowsRemaining(ctx) == 0 {
return nil, nil
}
}
// Pagination
if result.Pagination.CurrentPage < result.Pagination.TotalPages {
options.PageNumber = result.Pagination.NextPage
} else {
pagesLeft = false
}
}
return nil, nil
}

func getProject(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (interface{}, error) {
conn, err := connect(ctx, d)
if err != nil {
plugin.Logger(ctx).Error("tfe_project.getProject", "connection_error", err)
return nil, err
}
result, err := conn.Projects.Read(ctx, d.EqualsQuals["id"].GetStringValue())

if err != nil {
plugin.Logger(ctx).Error("tfe_project.getProject", "query_error", err)
return nil, err
}
return result, nil
}
8 changes: 4 additions & 4 deletions tfe/table_tfe_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ func listRun(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (i
return nil, err
}
limit := d.QueryContext.Limit
include := "plan,apply,created_by,cost_estimate,configuration_version,configuration_version.ingress_attributes"
include := []tfe.RunIncludeOpt{tfe.RunPlan, tfe.RunApply, tfe.RunCreatedBy, tfe.RunCostEstimate, tfe.RunConfigVer, tfe.RunConfigVerIngress, tfe.RunWorkspace, tfe.RunTaskStages}

options := tfe.RunListOptions{
Include: &include,
Include: include,
ListOptions: tfe.ListOptions{
// https://www.terraform.io/docs/cloud/api/index.html#pagination
PageSize: 100,
Expand All @@ -76,7 +76,7 @@ func listRun(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (i

pagesLeft := true
for pagesLeft {
result, err := conn.Runs.List(ctx, d.EqualsQuals["workspace_id"].GetStringValue(), options)
result, err := conn.Runs.List(ctx, d.EqualsQuals["workspace_id"].GetStringValue(), &options)
if err != nil {
plugin.Logger(ctx).Error("tfe_run.listRun", "query_error", err)
return nil, err
Expand Down Expand Up @@ -104,7 +104,7 @@ func getRun(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (in
plugin.Logger(ctx).Error("tfe_run.getRun", "connection_error", err)
return nil, err
}
include := "plan,apply,created_by,cost_estimate,configuration_version,configuration_version.ingress_attributes,workspace"
include := []tfe.RunIncludeOpt{"plan", "apply", "created_by", "cost_estimate", "configuration_version", "configuration_version.ingress_attributes"}
result, err := conn.Runs.ReadWithOptions(ctx, d.EqualsQuals["id"].GetStringValue(), &tfe.RunReadOptions{Include: include})
if err != nil {
plugin.Logger(ctx).Error("tfe_run.getRun", "query_error", err)
Expand Down
2 changes: 1 addition & 1 deletion tfe/table_tfe_sentinel_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func listSentinelPolicy(ctx context.Context, d *plugin.QueryData, h *plugin.Hydr

pagesLeft := true
for pagesLeft {
result, err := conn.Policies.List(ctx, organizationName, options)
result, err := conn.Policies.List(ctx, organizationName, &options)
if err != nil {
if isNotFoundError(err) {
return nil, nil
Expand Down
2 changes: 1 addition & 1 deletion tfe/table_tfe_ssh_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func listSshKey(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData)

pagesLeft := true
for pagesLeft {
result, err := conn.SSHKeys.List(ctx, organizationName, options)
result, err := conn.SSHKeys.List(ctx, organizationName, &options)
if err != nil {
if isNotFoundError(err) {
return nil, nil
Expand Down
2 changes: 1 addition & 1 deletion tfe/table_tfe_team.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func listTeam(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (
}
pagesLeft := true
for pagesLeft {
result, err := conn.Teams.List(ctx, organizationName, options)
result, err := conn.Teams.List(ctx, organizationName, &options)
if err != nil {
if isNotFoundError(err) {
return nil, nil
Expand Down
2 changes: 1 addition & 1 deletion tfe/table_tfe_variable.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func listVariable(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateDat

pagesLeft := true
for pagesLeft {
result, err := conn.Variables.List(ctx, d.EqualsQuals["workspace_id"].GetStringValue(), options)
result, err := conn.Variables.List(ctx, d.EqualsQuals["workspace_id"].GetStringValue(), &options)
if err != nil {
plugin.Logger(ctx).Error("tfe_variable.listVariable", "query_error", err)
return nil, err
Expand Down
Loading

0 comments on commit 231e873

Please sign in to comment.