Skip to content

Commit

Permalink
r/aws_ec2_capacity_reservation: Use '_Values' functions (hashicorp#14601
Browse files Browse the repository at this point in the history
).
  • Loading branch information
ewbankkit committed Mar 18, 2022
1 parent 36871b9 commit 06697ac
Showing 1 changed file with 22 additions and 43 deletions.
65 changes: 22 additions & 43 deletions internal/service/ec2/capacity_reservation.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ func ResourceCapacityReservation() *schema.Resource {
CustomizeDiff: verify.SetTagsDiff,

Schema: map[string]*schema.Schema{
"arn": {
Type: schema.TypeString,
Computed: true,
},
"availability_zone": {
Type: schema.TypeString,
Required: true,
Expand All @@ -50,13 +54,10 @@ func ResourceCapacityReservation() *schema.Resource {
ValidateFunc: validation.IsRFC3339Time,
},
"end_date_type": {
Type: schema.TypeString,
Optional: true,
Default: ec2.EndDateTypeUnlimited,
ValidateFunc: validation.StringInSlice([]string{
ec2.EndDateTypeUnlimited,
ec2.EndDateTypeLimited,
}, false),
Type: schema.TypeString,
Optional: true,
Default: ec2.EndDateTypeUnlimited,
ValidateFunc: validation.StringInSlice(ec2.EndDateType_Values(), false),
},
"ephemeral_storage": {
Type: schema.TypeBool,
Expand All @@ -69,32 +70,17 @@ func ResourceCapacityReservation() *schema.Resource {
Required: true,
},
"instance_match_criteria": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Default: ec2.InstanceMatchCriteriaOpen,
ValidateFunc: validation.StringInSlice([]string{
ec2.InstanceMatchCriteriaOpen,
ec2.InstanceMatchCriteriaTargeted,
}, false),
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Default: ec2.InstanceMatchCriteriaOpen,
ValidateFunc: validation.StringInSlice(ec2.InstanceMatchCriteria_Values(), false),
},
"instance_platform": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
ec2.CapacityReservationInstancePlatformLinuxUnix,
ec2.CapacityReservationInstancePlatformRedHatEnterpriseLinux,
ec2.CapacityReservationInstancePlatformSuselinux,
ec2.CapacityReservationInstancePlatformWindows,
ec2.CapacityReservationInstancePlatformWindowswithSqlserver,
ec2.CapacityReservationInstancePlatformWindowswithSqlserverEnterprise,
ec2.CapacityReservationInstancePlatformWindowswithSqlserverStandard,
ec2.CapacityReservationInstancePlatformWindowswithSqlserverWeb,
ec2.CapacityReservationInstancePlatformLinuxwithSqlserverStandard,
ec2.CapacityReservationInstancePlatformLinuxwithSqlserverWeb,
ec2.CapacityReservationInstancePlatformLinuxwithSqlserverEnterprise,
}, false),
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice(ec2.CapacityReservationInstancePlatform_Values(), false),
},
"instance_type": {
Type: schema.TypeString,
Expand All @@ -113,18 +99,11 @@ func ResourceCapacityReservation() *schema.Resource {
"tags": tftags.TagsSchema(),
"tags_all": tftags.TagsSchemaComputed(),
"tenancy": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Default: ec2.CapacityReservationTenancyDefault,
ValidateFunc: validation.StringInSlice([]string{
ec2.CapacityReservationTenancyDefault,
ec2.CapacityReservationTenancyDedicated,
}, false),
},
"arn": {
Type: schema.TypeString,
Computed: true,
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Default: ec2.CapacityReservationTenancyDefault,
ValidateFunc: validation.StringInSlice(ec2.CapacityReservationTenancy_Values(), false),
},
},
}
Expand Down

0 comments on commit 06697ac

Please sign in to comment.