in teamcity/user.go [89:120]
func (r *userResource) ValidateConfig(ctx context.Context, req resource.ValidateConfigRequest, resp *resource.ValidateConfigResponse) {
var config userResourceModel
diags := req.Config.Get(ctx, &config)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
}
for _, role := range config.Roles {
if role.Global.IsNull() && role.Project.IsNull() {
resp.Diagnostics.AddAttributeError(
path.Root("roles"), //TODO path to specific set item
"Either 'global' or 'project' must be specified",
"",
)
}
if !role.Global.IsNull() && !role.Project.IsNull() {
resp.Diagnostics.AddAttributeError(
path.Root("roles"), //TODO path to specific set item
"'global' and 'project' cannot be specified together",
"",
)
}
if !role.Global.ValueBool() {
resp.Diagnostics.AddAttributeError(
path.Root("roles"), //TODO path to specific set item
"'global' must be set to 'true'",
"",
)
}
}
}