Skip to content

Commit

Permalink
Remove the extra ID variable for v1 specs
Browse files Browse the repository at this point in the history
  • Loading branch information
jleeh committed Dec 16, 2020
1 parent 252db18 commit 063bbd9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
15 changes: 2 additions & 13 deletions chainlink/resource_chainlink_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ func ResourceChainlinkSpec() *schema.Resource {
Update: resourceSpecUpdate,

Schema: mergeSchemaWithNodeProperties(map[string]*schema.Schema{
"spec_id": {
Type: schema.TypeString,
Computed: true,
ForceNew: true,
},
"json": {
Type: schema.TypeString,
Required: true,
Expand All @@ -41,9 +36,6 @@ func resourceSpecCreate(d *schema.ResourceData, m interface{}) error {
}

d.SetId(id)
if err := d.Set("spec_id", id); err != nil {
return err
}
return nil
}

Expand All @@ -53,15 +45,12 @@ func resourceSpecRead(d *schema.ResourceData, m interface{}) error {
return err
}

spec, err := c.ReadSpec(d.Get("spec_id").(string))

_, err = c.ReadSpec(d.Id())
if err == client.ErrNotFound {
d.SetId("")
} else if err != nil {
d.SetId("")
return err
} else if err := d.Set("spec_id", spec.Data["id"]); err != nil {
return err
}
return nil
}
Expand All @@ -79,5 +68,5 @@ func resourceSpecDelete(d *schema.ResourceData, m interface{}) error {
return err
}

return c.DeleteSpec(d.Get("spec_id").(string))
return c.DeleteSpec(d.Id())
}
2 changes: 1 addition & 1 deletion docs/resources/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ resource "chainlink_spec" "vrf" {

### Read-only

- **spec_id** (String, Read-only) the ID of the job spec
- **id** (String, Read-only) the ID of the job spec

0 comments on commit 063bbd9

Please sign in to comment.