in teamcity/group.go [308:338]
func (r *groupResource) readState(actual *client.Group) groupResourceModel {
var newState groupResourceModel
newState.Id = types.StringValue(actual.Key)
newState.Key = types.StringValue(actual.Key)
newState.Name = types.StringValue(actual.Name)
if actual.Roles != nil && len(actual.Roles.RoleAssignment) > 0 {
newState.Roles = []roleAssignment{}
for _, role := range actual.Roles.RoleAssignment {
assignment := roleAssignment{
Id: types.StringValue(role.Id),
}
if role.Scope == "g" {
assignment.Global = types.BoolValue(role.Scope == "g")
} else {
assignment.Project = types.StringValue(role.Scope[2:])
}
newState.Roles = append(newState.Roles, assignment)
}
}
newState.ParentGroups = types.SetNull(types.StringType)
for _, parent := range actual.Parents.Group {
newState.ParentGroups, _ = types.SetValue(
types.StringType,
append(newState.ParentGroups.Elements(), types.StringValue(parent.Key)),
)
}
return newState
}