From 871d33d90d9c0c7189e4ff4efc0bd264b7e7428b Mon Sep 17 00:00:00 2001 From: Jake Champlin Date: Wed, 5 Apr 2017 18:14:11 -0400 Subject: [PATCH] Fix instance attributes --- builtin/providers/opc/resource_instance.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/builtin/providers/opc/resource_instance.go b/builtin/providers/opc/resource_instance.go index 2744edd5a..8157835ad 100644 --- a/builtin/providers/opc/resource_instance.go +++ b/builtin/providers/opc/resource_instance.go @@ -51,12 +51,10 @@ func resourceInstance() *schema.Resource { // Optional Attributes // ///////////////////////// "instance_attributes": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { - return true - }, + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.ValidateJsonString, }, "boot_order": { @@ -367,7 +365,12 @@ func resourceInstanceCreate(d *schema.ResourceData, meta interface{}) error { } // Get optional instance attributes - if attributes, err := getInstanceAttributes(d); err != nil && attributes != nil { + attributes, attrErr := getInstanceAttributes(d) + if attrErr != nil { + return attrErr + } + + if attributes != nil { input.Attributes = attributes }