|
8 | 8 | "github.com/coder/coder/v2/codersdk"
|
9 | 9 | "github.com/coder/terraform-provider-coderd/internal/codersdkvalidator"
|
10 | 10 | "github.com/google/uuid"
|
| 11 | + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" |
11 | 12 | "github.com/hashicorp/terraform-plugin-framework/path"
|
12 | 13 | "github.com/hashicorp/terraform-plugin-framework/resource"
|
13 | 14 | "github.com/hashicorp/terraform-plugin-framework/resource/schema"
|
@@ -87,12 +88,57 @@ func (r *OrganizationResource) Schema(ctx context.Context, req resource.SchemaRe
|
87 | 88 | Computed: true,
|
88 | 89 | Default: stringdefault.StaticString(""),
|
89 | 90 | },
|
| 91 | + }, |
90 | 92 |
|
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 | + }, |
93 | 124 | },
|
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 | + }, |
96 | 142 | },
|
97 | 143 | },
|
98 | 144 | }
|
|
0 commit comments