Description
We currently don't have any Validators on our resource schemas, setting these in the schema will allow for users to fail fast and not have to wait through a whole terraform apply to determine an error.
Failures here without validators can also put the terraform state file into a corrupted state which will be a huge burden on users.
Here's an example of what this looks like in repos:
"name": schema.StringAttribute{
MarkdownDescription: "Repository name",
Required: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Validators: []validator.String{
stringvalidator.RegexMatches(
regexp.MustCompile(`^[a-zA-Z0-9]([-.a-zA-Z0-9]*[a-zA-Z0-9])?$`),
"Name must only contain alphanumeric characters, '.', or '-', and must start and end with an alphanumeric character",
),
},
},
Affected Resource(s) and/or Data Source(s)
resource_access_token.go
resource_org_setting_image_access_management.go
resource_org_setting_registry_access_management.go
resource_org_team.go
resource_org_team_member_association.go
resource_repository.go
resource_repository_team_permission.go
Potential Terraform Configuration
No response
References
https://developer.hashicorp.com/terraform/plugin/framework/validation#parameter-validation
Would you like to implement a fix?
None
Description
We currently don't have any
Validatorson our resource schemas, setting these in the schema will allow for users to fail fast and not have to wait through a whole terraform apply to determine an error.Failures here without validators can also put the terraform state file into a corrupted state which will be a huge burden on users.
Here's an example of what this looks like in repos:
Affected Resource(s) and/or Data Source(s)
resource_access_token.go
resource_org_setting_image_access_management.go
resource_org_setting_registry_access_management.go
resource_org_team.go
resource_org_team_member_association.go
resource_repository.go
resource_repository_team_permission.go
Potential Terraform Configuration
No response
References
https://developer.hashicorp.com/terraform/plugin/framework/validation#parameter-validation
Would you like to implement a fix?
None