Implement Secrets Manager ACL (#93)

* Add CIDR validator

* Implement `syncACL`, add it to creation

* Rename function

* Rename variables

* Add mapACLs

* Implement instance update

* Add ACLs to acc test

* Add ACL to schema

* Add new line

* Fix not using the ACLs read from config

* Add test case where ACLs aren't set

* Fix lint

* Generate docs

* Add uniqueness check for ACLs

* Add repeated ACLs test cases

* Remove debug leftover

* Change test cases

* Rename data

* Add ACL description

* Generate docs

* Change ACL attribute type

* Remove test case

---------

Co-authored-by: Henrique Santos <henrique.santos@freiheit.com>
This commit is contained in:
Henrique Santos 2023-10-18 13:25:54 +01:00 committed by GitHub
parent 3c6748545d
commit e1265578ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 770 additions and 13 deletions

View file

@ -137,3 +137,21 @@ func RFC3339SecondsOnly() *Validator {
},
}
}
func CIDR() *Validator {
description := "value must be in CIDR notation"
return &Validator{
description: description,
validate: func(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse) {
_, _, err := net.ParseCIDR(req.ConfigValue.ValueString())
if err != nil {
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
req.Path,
fmt.Sprintf("parsing value in CIDR notation: %s", err.Error()),
req.ConfigValue.ValueString(),
))
}
},
}
}