Skip to content

Commit 69ebed9

Browse files
committed
get the attribute definitions out there
1 parent 39da842 commit 69ebed9

File tree

3 files changed

+50
-4
lines changed

3 files changed

+50
-4
lines changed

internal/provider/organization_resource.go

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/coder/coder/v2/codersdk"
99
"github.com/coder/terraform-provider-coderd/internal/codersdkvalidator"
1010
"github.com/google/uuid"
11+
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
1112
"github.com/hashicorp/terraform-plugin-framework/path"
1213
"github.com/hashicorp/terraform-plugin-framework/resource"
1314
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
@@ -87,12 +88,57 @@ func (r *OrganizationResource) Schema(ctx context.Context, req resource.SchemaRe
8788
Computed: true,
8889
Default: stringdefault.StaticString(""),
8990
},
91+
},
9092

91-
"group_sync": schema.ObjectAttribute{
92-
Optional: true,
93+
Blocks: map[string]schema.Block{
94+
"group_sync": schema.SingleNestedBlock{
95+
Attributes: map[string]schema.Attribute{
96+
"field": schema.StringAttribute{
97+
Required: true,
98+
MarkdownDescription: "The claim field that specifies what groups " +
99+
"a user should be in.",
100+
Validators: []validator.String{
101+
stringvalidator.LengthAtLeast(1),
102+
},
103+
},
104+
"regex": schema.StringAttribute{
105+
Required: true,
106+
MarkdownDescription: "A regular expression that will be used to " +
107+
"filter the groups returned by the OIDC provider. Any group " +
108+
"not matched will be ignored.",
109+
Validators: []validator.String{
110+
stringvalidator.LengthAtLeast(1),
111+
},
112+
},
113+
"auto_create_missing": schema.BoolAttribute{
114+
Required: true,
115+
MarkdownDescription: "Controls whether groups will be created if " +
116+
"they are missing.",
117+
},
118+
"mapping": schema.MapAttribute{
119+
ElementType: UUIDType,
120+
Required: true,
121+
MarkdownDescription: "A map from OIDC group name to Coder group ID.",
122+
},
123+
},
93124
},
94-
"role_sync": schema.ObjectAttribute{
95-
Optional: true,
125+
"role_sync": schema.SingleNestedBlock{
126+
Attributes: map[string]schema.Attribute{
127+
"field": schema.StringAttribute{
128+
Required: true,
129+
MarkdownDescription: "The claim field that specifies what " +
130+
"organization roles a user should be given.",
131+
Validators: []validator.String{
132+
stringvalidator.LengthAtLeast(1),
133+
},
134+
},
135+
"mapping": schema.MapAttribute{
136+
ElementType: UUIDType,
137+
Required: true,
138+
MarkdownDescription: "A map from OIDC group name to Coder " +
139+
"organization role.",
140+
},
141+
},
96142
},
97143
},
98144
}
File renamed without changes.

0 commit comments

Comments
 (0)