-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API Refactoring for VPN resources #866
Conversation
@2ez4szliu, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
bd4b211
to
e76f703
Compare
@2ez4szliu, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
e76f703
to
5f8c3ef
Compare
aca6719
to
2dc6a62
Compare
localeServicePath := d.Get("locale_service_path").(string) | ||
if gatewayPath == "" && localeServicePath == "" { | ||
return fmt.Errorf("At least one of gateway path and locale service path should be provided for VPN resources") | ||
} | ||
isT0, gwID, localeServiceID, err := parseLocaleServicePolicyPath(localeServicePath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this block is repeated below, can we move it to a function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
d.Set("locale_service_path", s[0]) | ||
} else { | ||
d.Set("gateway_path", s[0]) | ||
} | ||
return []*schema.ResourceData{d}, nil | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like new support is missing in deleteNsxtPolicyIPSecVpnService
below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, seems it's also missing in getNsxtPolicyIPSecVpnService, now fixed
977150a
to
776658a
Compare
/test-all |
1 similar comment
/test-all |
@@ -142,7 +142,7 @@ func TestAccResourceNsxtPolicyL2VpnSession_tier1(t *testing.T) { | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason this test is only running for versions below 3.2.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be "version higher than 3.2.0", now fixed
testResourceName := "nsxt_policy_ipsec_vpn_service.test" | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t); testAccOnlyLocalManager(t) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think version check is needed here, since GW api was not exposed for early versions (3.2.0?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, same change is made in l2_vpn_service_test
@@ -37,7 +37,8 @@ The following arguments are supported: | |||
* `description` - (Optional) Description of the resource. | |||
* `tag` - (Optional) A list of scope + tag pairs to associate with this resource. | |||
* `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the resource. | |||
* `locale_service_path` - (Required) Path of the gateway locale service associated with the IPSec VPN Service. | |||
* `locale_service_path` - (Optional) Path of the gateway locale service associated with the IPSec VPN Service. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should mark this as Deprecated (same for other resources)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -41,7 +43,8 @@ func resourceNsxtPolicyIPSecVpnService() *schema.Resource { | |||
"description": getDescriptionSchema(), | |||
"revision": getRevisionSchema(), | |||
"tag": getTagsSchema(), | |||
"locale_service_path": getPolicyPathSchema(true, false, "Polciy path for the locale service."), | |||
"locale_service_path": getPolicyPathSchema(false, false, "Polciy path for the locale service."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should mark this as Deprecated (same for other resources)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
776658a
to
69b91c2
Compare
/test-all |
0c507d7
to
8ead01c
Compare
/test-all |
Type: schema.TypeString, | ||
Description: "Polciy path for the locale service.", | ||
Optional: true, | ||
ForceNew: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ForceNew needs to be true
here, since different API path would be used for updated locale service
Type: schema.TypeString, | ||
Description: "Polciy path for the locale service.", | ||
Optional: true, | ||
ForceNew: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
LGTM, only small comment about |
NSX API that uses locale service path of VPN resources will be deprecated, this PR adds support for the new API that uses gateway path. The change in this PR includes: (1) Support for configuring VPN Resource with gateway path. (2) change data_source_nsxt_policy_ipsec_vpn_local_endpoint to use regex-based search API. (3) For VPN Sessions, if only specify the direction of Tcp Mss Clampling, the provider will use the auto-assigned value for the Maximum Segment Size. Signed-off-by: Shizhao Liu <lshizhao@vmware.com>
8ead01c
to
515cf3e
Compare
Added test case TestAccResourceNsxtPolicyIPSecVpnService_updateFromlocaleServicePathToGatewayPath and TestAccResourceNsxtPolicyL2VpnService_updateFromlocaleServicePathToGatewayPath |
/test-all |
1 similar comment
/test-all |
Great, thanks! |
NSX API that uses locale service path of VPN resources will be deprecated this PR adds support for the new API that uses gateway path.
Also change data_source_nsxt_policy_ipsec_vpn_local_endpoint to use regex-based search API.
Signed-off-by: Shizhao Liu lshizhao@vmware.com