sureshanaparti commented on code in PR #332:
URL: 
https://github.com/apache/cloudstack-terraform-provider/pull/332#discussion_r3893498720


##########
cloudstack/resource_cloudstack_project.go:
##########
@@ -76,12 +84,32 @@ func resourceCloudStackProject() *schema.Resource {
        }
 }
 
+// projectDisplayText resolves the effective display text from the new
+// display_text field and the deprecated displaytext field. Both fields are
+// Computed, so on an update only the one actually edited in config should
+// win; GetOk alone can't tell a real edit from a stale Computed value left
+// over from the last refresh, so HasChange is checked first. display_text
+// wins when both are freshly set (e.g. on create), since it's the field new
+// configs should use.
+func projectDisplayText(d *schema.ResourceData) string {
+       if d.HasChange("display_text") {
+               return d.Get("display_text").(string)
+       }
+       if d.HasChange("displaytext") {
+               return d.Get("displaytext").(string)
+       }
+       if v, ok := d.GetOk("display_text"); ok {
+               return v.(string)
+       }
+       return d.Get("displaytext").(string)
+}

Review Comment:
   @sudo87 when display_text, displaytext are passed, display_text takes 
priority, right?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to