Skip to content

Commit ac71542

Browse files
committed
fix: incorrectly accepted empty arns
1 parent 684c385 commit ac71542

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

internal/service/ram/principal_association.go

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ func resourcePrincipalAssociation() *schema.Resource {
4545
Required: true,
4646
ForceNew: true,
4747
ValidateFunc: validation.Any(
48-
validation.StringIsNotEmpty,
4948
verify.ValidAccountID,
5049
verify.ValidARN,
5150
),

internal/verify/validate.go

+2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ type ARNCheckFunc func(any, string, arn.ARN) ([]string, []error)
7878
// ValidARNCheck validates that a string value matches an ARN format with additional validation on the parsed ARN value
7979
// It must:
8080
// * Be parseable as an ARN
81+
// * Have a non-empty value
8182
// * Have a valid partition
8283
// * Have a valid region
8384
// * Have either an empty or valid account ID
@@ -92,6 +93,7 @@ func ValidARNCheck(f ...ARNCheckFunc) schema.SchemaValidateFunc {
9293
}
9394

9495
if value == "" {
96+
errors = append(errors, fmt.Errorf("%s cannot be empty", k))
9597
return ws, errors
9698
}
9799

0 commit comments

Comments
 (0)