Allow managing members in the project resource (#480)
* Extend resource and datasource * Adapt acc test to work without members * Extend acc test and adjust resource * Generate docs * Fix lint * Fix unit test * Uniformize description with datasource and extend unit test * Improve role field description * Update TF state before adding/removing members * Remove unused function * Move intermediate map top state to mapProjectFields * Improve code
This commit is contained in:
parent
af7d789945
commit
31ce9ab36d
16 changed files with 1195 additions and 169 deletions
|
|
@ -14,6 +14,7 @@ import (
|
|||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
|
||||
"github.com/teambition/rrule-go"
|
||||
)
|
||||
|
||||
|
|
@ -137,6 +138,23 @@ func NoSeparator() *Validator {
|
|||
}
|
||||
}
|
||||
|
||||
func NonLegacyProjectRole() *Validator {
|
||||
description := "legacy roles are not supported"
|
||||
|
||||
return &Validator{
|
||||
description: description,
|
||||
validate: func(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
||||
if utils.IsLegacyProjectRole(req.ConfigValue.ValueString()) {
|
||||
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
|
||||
req.Path,
|
||||
description,
|
||||
req.ConfigValue.ValueString(),
|
||||
))
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func MinorVersionNumber() *Validator {
|
||||
description := "value must be a minor version number, without a leading 'v': '[MAJOR].[MINOR]'"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue