Skip to content

Commit

Permalink
r/aws_acmpca_certificate_authority: Use '_Values()' function (hashico…
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Oct 27, 2022
1 parent 0601c6c commit e890ab9
Showing 1 changed file with 13 additions and 28 deletions.
41 changes: 13 additions & 28 deletions internal/service/acmpca/certificate_authority.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,16 @@ func ResourceCertificateAuthority() *schema.Resource {
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"key_algorithm": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
acmpca.KeyAlgorithmEcPrime256v1,
acmpca.KeyAlgorithmEcSecp384r1,
acmpca.KeyAlgorithmRsa2048,
acmpca.KeyAlgorithmRsa4096,
}, false),
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice(acmpca.KeyAlgorithm_Values(), false),
},
"signing_algorithm": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
acmpca.SigningAlgorithmSha256withecdsa,
acmpca.SigningAlgorithmSha256withrsa,
acmpca.SigningAlgorithmSha384withecdsa,
acmpca.SigningAlgorithmSha384withrsa,
acmpca.SigningAlgorithmSha512withecdsa,
acmpca.SigningAlgorithmSha512withrsa,
}, false),
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice(acmpca.SigningAlgorithm_Values(), false),
},
// https://docs.aws.amazon.com/privateca/latest/APIReference/API_ASN1Subject.html
"subject": {
Expand Down Expand Up @@ -308,14 +296,11 @@ func ResourceCertificateAuthority() *schema.Resource {
"tags": tftags.TagsSchema(),
"tags_all": tftags.TagsSchemaComputed(),
"type": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Default: acmpca.CertificateAuthorityTypeSubordinate,
ValidateFunc: validation.StringInSlice([]string{
acmpca.CertificateAuthorityTypeRoot,
acmpca.CertificateAuthorityTypeSubordinate,
}, false),
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Default: acmpca.CertificateAuthorityTypeSubordinate,
ValidateFunc: validation.StringInSlice(acmpca.CertificateAuthorityType_Values(), false),
},
"usage_mode": {
Type: schema.TypeString,
Expand Down

0 comments on commit e890ab9

Please sign in to comment.