diff --git a/decort/resource_pfw.go b/decort/resource_pfw.go index fce1ff5..b5c72bf 100644 --- a/decort/resource_pfw.go +++ b/decort/resource_pfw.go @@ -25,6 +25,7 @@ Visit https://github.com/rudecs/terraform-provider-decort for full source code p package decort import ( + "fmt" "net/url" "strconv" @@ -52,7 +53,7 @@ func resourcePfwCreate(d *schema.ResourceData, m interface{}) error { return err } - d.SetId(pfwId) + d.SetId(fmt.Sprintf("%d-%s", d.Get("compute_id").(int), pfwId)) pfw, err := utilityPfwCheckPresence(d, m) if err != nil { diff --git a/decort/utility_pfw.go b/decort/utility_pfw.go index 65f4e11..aef06bf 100644 --- a/decort/utility_pfw.go +++ b/decort/utility_pfw.go @@ -4,6 +4,7 @@ import ( "encoding/json" "net/url" "strconv" + "strings" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) @@ -22,7 +23,7 @@ func utilityPfwCheckPresence(d *schema.ResourceData, m interface{}) (*PfwRecord, return nil, nil } - idS := d.Id() + idS := strings.Split(d.Id(), "-")[1] id, err := strconv.Atoi(idS) if err != nil { return nil, err