You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ha...@apache.org on 2021/12/07 09:13:23 UTC
[cloudstack-terraform-provider] 01/01: Fix port forwarding to update state only if there are no errors
This is an automated email from the ASF dual-hosted git repository.
harikrishna pushed a commit to branch FixPFUpdateState
in repository https://gitbox.apache.org/repos/asf/cloudstack-terraform-provider.git
commit 1ece5d9ad26d1287f5026ddd888db24917ea9029
Author: Harikrishna Patnala <ha...@gmail.com>
AuthorDate: Tue Dec 7 14:39:52 2021 +0530
Fix port forwarding to update state only if there are no errors
---
cloudstack/resource_cloudstack_port_forward.go | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/cloudstack/resource_cloudstack_port_forward.go b/cloudstack/resource_cloudstack_port_forward.go
index b8ec6eb..ecdf0e9 100644
--- a/cloudstack/resource_cloudstack_port_forward.go
+++ b/cloudstack/resource_cloudstack_port_forward.go
@@ -109,13 +109,12 @@ func resourceCloudStackPortForwardCreate(d *schema.ResourceData, meta interface{
forwards := resourceCloudStackPortForward().Schema["forward"].ZeroValue().(*schema.Set)
err := createPortForwards(d, meta, forwards, nrs)
-
- // We need to update this first to preserve the correct state
- d.Set("forward", forwards)
-
- if err != nil {
+ if err != nil {
return err
}
+
+ // We need to update this first to preserve the correct state
+ d.Set("forward", forwards)
}
return resourceCloudStackPortForwardRead(d, meta)