Skip to content

Commit e4857b9

Browse files
Gattuso, Sandrosandrogattuso
Gattuso, Sandro
authored andcommitted
Add support for debug permission and update documentation
1 parent e791f82 commit e4857b9

File tree

2 files changed

+48
-4
lines changed

2 files changed

+48
-4
lines changed

codefresh/resource_permission.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ package codefresh
22

33
import (
44
"fmt"
5+
"log"
6+
57
cfClient "github.com/codefresh-io/terraform-provider-codefresh/client"
68
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
7-
"log"
89
)
910

1011
func resourcePermission() *schema.Resource {
@@ -42,8 +43,8 @@ func resourcePermission() *schema.Resource {
4243
Required: true,
4344
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) {
4445
v := val.(string)
45-
if v != "create" && v != "read" && v != "update" && v != "delete" && v != "run" && v != "approve" {
46-
errs = append(errs, fmt.Errorf("%q must be between one of create,read,update,delete,approve, got: %s", key, v))
46+
if v != "create" && v != "read" && v != "update" && v != "delete" && v != "run" && v != "approve" && v != "debug" {
47+
errs = append(errs, fmt.Errorf("%q must be between one of create,read,update,delete,approve,debug got: %s", key, v))
4748
}
4849
return
4950
},

docs/resources/permissions.md

+44-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,49 @@
11
# resource codefresh_permission
2+
Permission are used to setup access control and allow to define which teams have access to which clusters and pipelines based on tags
3+
See the [documentation](https://codefresh.io/docs/docs/administration/access-control/).
24

5+
## Example usage
6+
7+
```hcl
8+
resource "codefresh_team" "developers" {
9+
name = "developers"
10+
11+
users = [
12+
"5efc3cb6355c6647041b6e49",
13+
"59009221c102763beda7cf04"
14+
]
15+
}
16+
17+
resource "codefresh_permission" "developers" {
18+
19+
team = codefresh_team.developers.id
20+
resource = "pipeline"
21+
action = "run"
22+
tags = [
23+
"demo",
24+
"test"
25+
]
26+
}
327
```
428

29+
## Argument Reference
30+
31+
- `action` - (Required) Action to be allowed. Possible values:
32+
- __create__
33+
- __read__
34+
- __update__
35+
- __delete__
36+
- __run__ (Only valid for `pipeline` resource)
37+
- __approve__ (Only valid for `pipeline` resource)
38+
- __debug__ (Only valid for `pipeline` resource)
39+
- `resource` - (Required) The type of resource the permission applies to. Possible values:
40+
- __pipeline__
41+
- __cluster__
42+
- `team` - (Required) The Id of the team the permissions apply to.
43+
- `tags` - (Optional) The effective tags to apply the permission. It supports 2 custom tags:
44+
- __untagged__ is a “tag” which refers to all clusters that don’t have any tag.
45+
- __*__ (the star character) means all tags.
46+
47+
## Attributes Reference
548

6-
```
49+
- `id` - The permission ID.

0 commit comments

Comments
 (0)