Skip to content

Commit 83b367c

Browse files
committed
rename go values to match
1 parent a8aceb7 commit 83b367c

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

internal/provider/organization_resource.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ type OrganizationResourceModel struct {
4141
Description types.String `tfsdk:"description"`
4242
Icon types.String `tfsdk:"icon"`
4343

44-
SyncMapping types.Set `tfsdk:"org_sync_idp_groups"`
45-
GroupSync types.Object `tfsdk:"group_sync"`
46-
RoleSync types.Object `tfsdk:"role_sync"`
44+
OrgSyncIdpGroups types.Set `tfsdk:"org_sync_idp_groups"`
45+
GroupSync types.Object `tfsdk:"group_sync"`
46+
RoleSync types.Object `tfsdk:"role_sync"`
4747
}
4848

4949
type GroupSyncModel struct {
@@ -372,13 +372,13 @@ func (r *OrganizationResource) Create(ctx context.Context, req resource.CreateRe
372372
orgID := data.ID.ValueUUID()
373373

374374
// Apply org sync patches, if specified
375-
if !data.SyncMapping.IsNull() {
375+
if !data.OrgSyncIdpGroups.IsNull() {
376376
tflog.Trace(ctx, "updating org sync", map[string]any{
377377
"orgID": orgID,
378378
})
379379

380380
var claims []string
381-
resp.Diagnostics.Append(data.SyncMapping.ElementsAs(ctx, &claims, false)...)
381+
resp.Diagnostics.Append(data.OrgSyncIdpGroups.ElementsAs(ctx, &claims, false)...)
382382
if resp.Diagnostics.HasError() {
383383
return
384384
}
@@ -449,18 +449,18 @@ func (r *OrganizationResource) Update(ctx context.Context, req resource.UpdateRe
449449
})
450450

451451
// Apply org sync patches, if specified
452-
if !data.SyncMapping.IsNull() {
452+
if !data.OrgSyncIdpGroups.IsNull() {
453453
tflog.Trace(ctx, "updating org sync mappings", map[string]any{
454454
"orgID": orgID,
455455
})
456456

457457
var state OrganizationResourceModel
458458
resp.Diagnostics.Append(req.State.Get(ctx, &state)...)
459459
var currentClaims []string
460-
resp.Diagnostics.Append(state.SyncMapping.ElementsAs(ctx, &currentClaims, false)...)
460+
resp.Diagnostics.Append(state.OrgSyncIdpGroups.ElementsAs(ctx, &currentClaims, false)...)
461461

462462
var plannedClaims []string
463-
resp.Diagnostics.Append(data.SyncMapping.ElementsAs(ctx, &plannedClaims, false)...)
463+
resp.Diagnostics.Append(data.OrgSyncIdpGroups.ElementsAs(ctx, &plannedClaims, false)...)
464464
if resp.Diagnostics.HasError() {
465465
return
466466
}
@@ -505,13 +505,13 @@ func (r *OrganizationResource) Delete(ctx context.Context, req resource.DeleteRe
505505
orgID := data.ID.ValueUUID()
506506

507507
// Remove org sync mappings, if we were managing them
508-
if !data.SyncMapping.IsNull() {
508+
if !data.OrgSyncIdpGroups.IsNull() {
509509
tflog.Trace(ctx, "deleting org sync mappings", map[string]any{
510510
"orgID": orgID,
511511
})
512512

513513
var claims []string
514-
resp.Diagnostics.Append(data.SyncMapping.ElementsAs(ctx, &claims, false)...)
514+
resp.Diagnostics.Append(data.OrgSyncIdpGroups.ElementsAs(ctx, &claims, false)...)
515515
if resp.Diagnostics.HasError() {
516516
return
517517
}

internal/provider/organization_resource_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ func TestAccOrganizationResource(t *testing.T) {
4242
cfg2.DisplayName = ptr.Ref("Example Organization New")
4343

4444
cfg3 := cfg2
45-
cfg3.SyncMapping = []string{"wibble", "wobble"}
45+
cfg3.OrgSyncIdpGroups = []string{"wibble", "wobble"}
4646

4747
cfg4 := cfg3
48-
cfg4.SyncMapping = []string{"wibbley", "wobbley"}
48+
cfg4.OrgSyncIdpGroups = []string{"wibbley", "wobbley"}
4949

5050
cfg5 := cfg4
5151
cfg5.GroupSync = ptr.Ref(codersdk.GroupSyncSettings{
@@ -132,9 +132,9 @@ type testAccOrganizationResourceConfig struct {
132132
Description *string
133133
Icon *string
134134

135-
SyncMapping []string
136-
GroupSync *codersdk.GroupSyncSettings
137-
RoleSync *codersdk.RoleSyncSettings
135+
OrgSyncIdpGroups []string
136+
GroupSync *codersdk.GroupSyncSettings
137+
RoleSync *codersdk.RoleSyncSettings
138138
}
139139

140140
func (c testAccOrganizationResourceConfig) String(t *testing.T) string {

0 commit comments

Comments
 (0)