@@ -2,8 +2,11 @@ package action_permissions
2
2
3
3
import (
4
4
"context"
5
+ "github.com/hashicorp/terraform-plugin-framework/attr"
5
6
"github.com/hashicorp/terraform-plugin-framework/resource"
6
7
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
8
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
9
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/listdefault"
7
10
"github.com/hashicorp/terraform-plugin-framework/types"
8
11
)
9
12
@@ -22,30 +25,38 @@ func ActionPermissionsSchema() map[string]schema.Attribute {
22
25
},
23
26
"permissions" : schema.SingleNestedAttribute {
24
27
MarkdownDescription : "The permissions for the action" ,
25
- Optional : true ,
28
+ Required : true ,
26
29
Attributes : map [string ]schema.Attribute {
27
30
"execute" : schema.SingleNestedAttribute {
28
31
MarkdownDescription : "The permission to execute the action" ,
29
- Optional : true ,
32
+ Required : true ,
30
33
Attributes : map [string ]schema.Attribute {
31
34
"users" : schema.ListAttribute {
32
35
MarkdownDescription : "The users with execution permission" ,
33
36
Optional : true ,
37
+ Computed : true ,
38
+ Default : listdefault .StaticValue (types .ListValueMust (types .StringType , []attr.Value {})),
34
39
ElementType : types .StringType ,
35
40
},
36
41
"roles" : schema.ListAttribute {
37
42
MarkdownDescription : "The roles with execution permission" ,
38
43
Optional : true ,
44
+ Computed : true ,
45
+ Default : listdefault .StaticValue (types .ListValueMust (types .StringType , []attr.Value {})),
39
46
ElementType : types .StringType ,
40
47
},
41
48
"teams" : schema.ListAttribute {
42
49
MarkdownDescription : "The teams with execution permission" ,
43
50
Optional : true ,
51
+ Computed : true ,
52
+ Default : listdefault .StaticValue (types .ListValueMust (types .StringType , []attr.Value {})),
44
53
ElementType : types .StringType ,
45
54
},
46
55
"owned_by_team" : schema.BoolAttribute {
47
56
MarkdownDescription : "Give execution permission to the teams who own the entity" ,
48
57
Optional : true ,
58
+ Computed : true ,
59
+ Default : booldefault .StaticBool (true ),
49
60
},
50
61
"policy" : schema.StringAttribute {
51
62
MarkdownDescription : "The policy to use for execution" ,
@@ -55,21 +66,27 @@ func ActionPermissionsSchema() map[string]schema.Attribute {
55
66
},
56
67
"approve" : schema.SingleNestedAttribute {
57
68
MarkdownDescription : "The permission to approve the action's runs" ,
58
- Optional : true ,
69
+ Required : true ,
59
70
Attributes : map [string ]schema.Attribute {
60
71
"users" : schema.ListAttribute {
61
72
MarkdownDescription : "The users with approval permission" ,
62
73
Optional : true ,
74
+ Computed : true ,
75
+ Default : listdefault .StaticValue (types .ListValueMust (types .StringType , []attr.Value {})),
63
76
ElementType : types .StringType ,
64
77
},
65
78
"roles" : schema.ListAttribute {
66
79
MarkdownDescription : "The roles with approval permission" ,
67
80
Optional : true ,
81
+ Computed : true ,
82
+ Default : listdefault .StaticValue (types .ListValueMust (types .StringType , []attr.Value {})),
68
83
ElementType : types .StringType ,
69
84
},
70
85
"teams" : schema.ListAttribute {
71
86
MarkdownDescription : "The teams with approval permission" ,
72
87
Optional : true ,
88
+ Computed : true ,
89
+ Default : listdefault .StaticValue (types .ListValueMust (types .StringType , []attr.Value {})),
73
90
ElementType : types .StringType ,
74
91
},
75
92
"policy" : schema.StringAttribute {
0 commit comments