Skip to content

Commit

Permalink
removed kind
Browse files Browse the repository at this point in the history
  • Loading branch information
absolutelightning committed Sep 27, 2023
1 parent 1e5a15c commit 8fd2c0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
14 changes: 3 additions & 11 deletions consul/resource_consul_service_defaults_config_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,6 @@ var upstreamConfigSchema = &schema.Resource{
}

var serviceDefaultsConfigEntrySchema = map[string]*schema.Schema{
"kind": {
Type: schema.TypeString,
Required: false,
ForceNew: true,
Computed: true,
},

"name": {
Type: schema.TypeString,
Expand Down Expand Up @@ -334,23 +328,21 @@ func resourceServiceDefaultsConfigEntry() *schema.Resource {
Importer: &schema.ResourceImporter{
State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
parts := strings.Split(d.Id(), "/")
var kind, name, partition, namespace string
var name, partition, namespace string
switch len(parts) {
case 2:
kind = parts[0]
name = parts[1]
case 4:
partition = parts[0]
namespace = parts[1]
kind = parts[2]
name = parts[3]
default:
return nil, fmt.Errorf(`expected path of the form "<kind>/<name>" or "<partition>/<namespace>/<kind>/<name>"`)
}

d.SetId(fmt.Sprintf("%s-%s", kind, name))
d.SetId(fmt.Sprintf("%s-%s", KindServiceDefaults, name))
sw := newStateWriter(d)
sw.set("kind", kind)
sw.set("kind", KindServiceDefaults)
sw.set("name", name)
sw.set("partition", partition)
sw.set("namespace", namespace)
Expand Down
14 changes: 3 additions & 11 deletions consul/resource_consul_service_splitter_config_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ var serviceSplitterConfigEntrySchema = map[string]*schema.Schema{
Required: true,
ForceNew: true,
},
"kind": {
Type: schema.TypeString,
Required: false,
ForceNew: true,
Computed: true,
},
"partition": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -126,23 +120,21 @@ func resourceServiceSplitterConfigEntry() *schema.Resource {
Importer: &schema.ResourceImporter{
State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
parts := strings.Split(d.Id(), "/")
var kind, name, partition, namespace string
var name, partition, namespace string
switch len(parts) {
case 2:
kind = parts[0]
name = parts[1]
case 4:
partition = parts[0]
namespace = parts[1]
kind = parts[2]
name = parts[3]
default:
return nil, fmt.Errorf(`expected path of the form "<kind>/<name>" or "<partition>/<namespace>/<kind>/<name>"`)
}

d.SetId(fmt.Sprintf("%s-%s", kind, name))
d.SetId(fmt.Sprintf("%s-%s", KindServiceSplitter, name))
sw := newStateWriter(d)
sw.set("kind", kind)
sw.set("kind", KindServiceSplitter)
sw.set("name", name)
sw.set("partition", partition)
sw.set("namespace", namespace)
Expand Down

0 comments on commit 8fd2c0a

Please sign in to comment.