Skip to content

Commit

Permalink
Use '_Values()' (hashicorp#14601).
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Aug 31, 2021
1 parent 143da73 commit 8b3d8f8
Showing 1 changed file with 34 additions and 46 deletions.
80 changes: 34 additions & 46 deletions aws/resource_aws_service_discovery_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,20 @@ func resourceAwsServiceDiscoveryService() *schema.Resource {
},

Schema: map[string]*schema.Schema{
"name": {
"arn": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Computed: true,
},
"description": {
Type: schema.TypeString,
Optional: true,
},
"force_destroy": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"namespace_id": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
"dns_config": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"namespace_id": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"dns_records": {
Type: schema.TypeList,
Required: true,
Expand All @@ -66,32 +49,34 @@ func resourceAwsServiceDiscoveryService() *schema.Resource {
Required: true,
},
"type": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
servicediscovery.RecordTypeSrv,
servicediscovery.RecordTypeA,
servicediscovery.RecordTypeAaaa,
servicediscovery.RecordTypeCname,
}, false),
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice(servicediscovery.RecordType_Values(), false),
},
},
},
},
"routing_policy": {
"namespace_id": {
Type: schema.TypeString,
Optional: true,
Required: true,
ForceNew: true,
Default: servicediscovery.RoutingPolicyMultivalue,
ValidateFunc: validation.StringInSlice([]string{
servicediscovery.RoutingPolicyMultivalue,
servicediscovery.RoutingPolicyWeighted,
}, false),
},
"routing_policy": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Default: servicediscovery.RoutingPolicyMultivalue,
ValidateFunc: validation.StringInSlice(servicediscovery.RoutingPolicy_Values(), false),
},
},
},
},
"force_destroy": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"health_check_config": {
Type: schema.TypeList,
Optional: true,
Expand All @@ -107,14 +92,10 @@ func resourceAwsServiceDiscoveryService() *schema.Resource {
Optional: true,
},
"type": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
servicediscovery.HealthCheckTypeHttp,
servicediscovery.HealthCheckTypeHttps,
servicediscovery.HealthCheckTypeTcp,
}, false),
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice(servicediscovery.HealthCheckType_Values(), false),
},
},
},
Expand All @@ -134,12 +115,19 @@ func resourceAwsServiceDiscoveryService() *schema.Resource {
},
},
},
"tags": tagsSchema(),
"tags_all": tagsSchemaComputed(),
"arn": {
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"namespace_id": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
"tags": tagsSchema(),
"tags_all": tagsSchemaComputed(),
},

CustomizeDiff: SetTagsDiff,
Expand Down

0 comments on commit 8b3d8f8

Please sign in to comment.