Skip to content

Commit d5e5a8f

Browse files
Fix port forwarding to update state only if there are no errors
1 parent b79468a commit d5e5a8f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

cloudstack/resource_cloudstack_port_forward.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,12 @@ func resourceCloudStackPortForwardCreate(d *schema.ResourceData, meta interface{
109109
forwards := resourceCloudStackPortForward().Schema["forward"].ZeroValue().(*schema.Set)
110110

111111
err := createPortForwards(d, meta, forwards, nrs)
112-
113-
// We need to update this first to preserve the correct state
114-
d.Set("forward", forwards)
115-
116112
if err != nil {
117113
return err
118114
}
115+
116+
// We need to update this first to preserve the correct state
117+
d.Set("forward", forwards)
119118
}
120119

121120
return resourceCloudStackPortForwardRead(d, meta)

0 commit comments

Comments
 (0)