Skip to content

Commit c8a9807

Browse files
add runtime-environment resource to permissions
1 parent a705dd1 commit c8a9807

File tree

7 files changed

+15
-18
lines changed

7 files changed

+15
-18
lines changed

codefresh/data_current_account_user.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ func mapDataCurrentAccountUserToResource(currentAccount *cfclient.CurrentAccount
7878
return err
7979
}
8080

81-
8281
err = d.Set("email", user.Email)
8382

8483
if err != nil {

codefresh/data_idps.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,19 +147,19 @@ func mapDataIdpToResource(idp cfclient.IDP, d *schema.ResourceData) error {
147147
//d.Set("apiURL", idp.ApiURL) // string `json:"apiURL,omitempty"`
148148
//d.Set("appId", idp.AppId) // string `json:"appId,omitempty"`
149149
//d.Set("authURL", idp.AuthURL) // string `json:"authURL,omitempty"`
150-
err = d.Set("client_host", idp.ClientHost) // string `json:"clientHost,omitempty"`
150+
err = d.Set("client_host", idp.ClientHost) // string `json:"clientHost,omitempty"`
151151

152152
if err != nil {
153153
return err
154154
}
155155

156-
err = d.Set("client_id", idp.ClientId) // string `json:"clientId,omitempty"`
156+
err = d.Set("client_id", idp.ClientId) // string `json:"clientId,omitempty"`
157157

158158
if err != nil {
159159
return err
160160
}
161161

162-
err = d.Set("client_name", idp.ClientName) // string `json:"clientName,omitempty"`
162+
err = d.Set("client_name", idp.ClientName) // string `json:"clientName,omitempty"`
163163

164164
if err != nil {
165165
return err
@@ -171,32 +171,31 @@ func mapDataIdpToResource(idp cfclient.IDP, d *schema.ResourceData) error {
171171
return err
172172
}
173173

174-
err = d.Set("client_type", idp.ClientType) // string `json:"clientType,omitempty"`
174+
err = d.Set("client_type", idp.ClientType) // string `json:"clientType,omitempty"`
175175

176176
if err != nil {
177177
return err
178178
}
179179

180-
181-
err = d.Set("cookie_iv", idp.CookieIv) // string `json:"cookieIv,omitempty"`
180+
err = d.Set("cookie_iv", idp.CookieIv) // string `json:"cookieIv,omitempty"`
182181

183182
if err != nil {
184183
return err
185184
}
186185

187-
err = d.Set("cookie_key", idp.CookieKey) // string `json:"cookieKey,omitempty"`
186+
err = d.Set("cookie_key", idp.CookieKey) // string `json:"cookieKey,omitempty"`
188187

189188
if err != nil {
190189
return err
191190
}
192191

193-
err = d.Set("display_name", idp.DisplayName) // string `json:"displayName,omitempty"`
192+
err = d.Set("display_name", idp.DisplayName) // string `json:"displayName,omitempty"`
194193

195194
if err != nil {
196195
return err
197196
}
198197

199-
err = d.Set("_id", idp.ID) // string `json:"_id,omitempty"`
198+
err = d.Set("_id", idp.ID) // string `json:"_id,omitempty"`
200199

201200
if err != nil {
202201
return err
@@ -212,7 +211,7 @@ func mapDataIdpToResource(idp cfclient.IDP, d *schema.ResourceData) error {
212211
return err
213212
}
214213

215-
err = d.Set("tenant", idp.Tenant) // string `json:"tenant,omitempty"`
214+
err = d.Set("tenant", idp.Tenant) // string `json:"tenant,omitempty"`
216215

217216
if err != nil {
218217
return err

codefresh/internal/datautil/yaml.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package datautil
22

33
import (
4-
"io"
5-
"strings"
64
"github.com/mikefarah/yq/v4/pkg/yqlib"
75
"gopkg.in/op/go-logging.v1"
6+
"io"
7+
"strings"
88
)
99

1010
const (

codefresh/resource_account_user_association.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ func resourceAccountUserAssociationRead(d *schema.ResourceData, meta interface{}
9898
if userID == "" {
9999
d.SetId("")
100100

101-
102101
return nil
103102
}
104103

codefresh/resource_permission.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff"
1111
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1212
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
13-
funk "github.com/thoas/go-funk"
1413
)
1514

1615
func resourcePermission() *schema.Resource {
@@ -112,7 +111,7 @@ func resourcePermissionCustomDiff(ctx context.Context, diff *schema.ResourceDiff
112111
}
113112
}
114113
if diff.HasChanges("resource", "action") {
115-
if funk.Contains([]string{"run", "approve", "debug"}, diff.Get("action").(string)) && diff.Get("resource").(string) != "pipeline" {
114+
if contains([]string{"run", "approve", "debug"}, diff.Get("action").(string)) && diff.Get("resource").(string) != "pipeline" {
116115
return fmt.Errorf("action %v is only valid when resource is 'pipeline'", diff.Get("action").(string))
117116
}
118117
}

codefresh/resource_step_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010

1111
"github.com/Masterminds/semver"
1212
"github.com/codefresh-io/terraform-provider-codefresh/codefresh/cfclient"
13-
"github.com/codefresh-io/terraform-provider-codefresh/codefresh/internal/schemautil"
1413
"github.com/codefresh-io/terraform-provider-codefresh/codefresh/internal/datautil"
14+
"github.com/codefresh-io/terraform-provider-codefresh/codefresh/internal/schemautil"
1515
ghodss "github.com/ghodss/yaml"
1616
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1717
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

docs/resources/permission.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ resource "codefresh_permission" "developers" {
4242

4343
- `action` (String) Action to be allowed. Possible values:
4444
* create
45-
* read
45+
* read (For runtime-environment resource, 'read' means 'assign')
4646
* update
4747
* delete
4848
* run (Only valid for pipeline resource)
@@ -52,6 +52,7 @@ resource "codefresh_permission" "developers" {
5252
* pipeline
5353
* cluster
5454
* project
55+
* runtime-environment
5556
- `team` (String) The Id of the team the permissions apply to.
5657

5758
### Optional

0 commit comments

Comments
 (0)