Skip to content

Commit

Permalink
Replace custom regex through validARN function
Browse files Browse the repository at this point in the history
  • Loading branch information
Baachi committed Jan 3, 2024
1 parent ca733e1 commit ebf44a4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions internal/service/ecr/pull_through_cache_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package ecr

import (
"context"
"github.com/hashicorp/terraform-provider-aws/internal/verify"
"log"

"github.com/YakDriver/regexache"
Expand Down Expand Up @@ -52,12 +53,9 @@ func ResourcePullThroughCacheRule() *schema.Resource {
ForceNew: true,
},
"credential_arn": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringMatch(
regexache.MustCompile(`^arn:aws:secretsmanager:[a-zA-Z0-9-:]+:secret:ecr\-pullthroughcache\/[a-zA-Z0-9\/_+=.@-]+$`),
"must be an arn",
),
Type: schema.TypeString,
Optional: true,
ValidateFunc: verify.ValidARN,
},
},
}
Expand Down

0 comments on commit ebf44a4

Please sign in to comment.