-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Secure Web Proxy fields gatewaySecurityPolicy and certificateUrls supports updates. #10549
Conversation
Hello! I am a robot. Tests will require approval from a repository maintainer to run. @roaks3, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
|
Tests analyticsTotal tests: Click here to see the affected service packagesall service packages are affected Action takenFound 47 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccNetworkServicesEdgeCacheKeyset_networkServicesEdgeCacheKeysetBasicExample|TestAccNetworkServicesEdgeCacheKeyset_networkServicesEdgeCacheKeysetDualTokenExample|TestAccNetworkServicesEdgeCacheKeyset_update|TestAccNetworkServicesEdgeCacheOrigin_networkServicesEdgeCacheOriginAdvancedExample|TestAccNetworkServicesEdgeCacheOrigin_networkServicesEdgeCacheOriginBasicExample|TestAccNetworkServicesEdgeCacheOrigin_networkServicesEdgeCacheOriginV4authExample|TestAccNetworkServicesEdgeCacheOrigin_updateAndImport|TestAccNetworkServicesEdgeCacheService_networkServicesEdgeCacheServiceAdvancedExample|TestAccNetworkServicesEdgeCacheService_networkServicesEdgeCacheServiceBasicExample|TestAccNetworkServicesEdgeCacheService_networkServicesEdgeCacheServiceDualTokenExample|TestAccNetworkServicesEdgeCacheService_updateAndImport|TestAccNetworkServicesEndpointPolicy_networkServicesEndpointPolicyBasicExample|TestAccNetworkServicesEndpointPolicy_networkServicesEndpointPolicyEmptyMatchExample|TestAccNetworkServicesEndpointPolicy_update|TestAccNetworkServicesGateway_minimalSwp|TestAccNetworkServicesGateway_multipleSwpGatewaysDifferentNetwork|TestAccNetworkServicesGateway_multipleSwpGatewaysDifferentSubnetwork|TestAccNetworkServicesGateway_networkServicesGatewayAdvancedExample|TestAccNetworkServicesGateway_networkServicesGatewayBasicExample|TestAccNetworkServicesGateway_networkServicesGatewayMultipleSwpSameNetworkExample|TestAccNetworkServicesGateway_networkServicesGatewaySecureWebProxyExample|TestAccNetworkServicesGateway_networkServicesGatewaySecureWebProxyWithoutAddresses|TestAccNetworkServicesGateway_update|TestAccNetworkServicesGateway_updateSwp|TestAccNetworkServicesGrpcRoute_networkServicesGrpcRouteActionsExample|TestAccNetworkServicesGrpcRoute_networkServicesGrpcRouteBasicExample|TestAccNetworkServicesGrpcRoute_networkServicesGrpcRouteMatchesAndActionsExample|TestAccNetworkServicesGrpcRoute_update|TestAccNetworkServicesHttpRoute_networkServicesHttpRouteActionsExample|TestAccNetworkServicesHttpRoute_networkServicesHttpRouteBasicExample|TestAccNetworkServicesHttpRoute_networkServicesHttpRouteMatchesAndActionsExample|TestAccNetworkServicesHttpRoute_networkServicesHttpRouteMeshBasicExample|TestAccNetworkServicesHttpRoute_update|TestAccNetworkServicesMesh_networkServicesMeshBasicExample|TestAccNetworkServicesMesh_networkServicesMeshNoPortExample|TestAccNetworkServicesMesh_update|TestAccNetworkServicesServiceBinding_networkServicesServiceBindingBasicExample|TestAccNetworkServicesServiceBinding_update|TestAccNetworkServicesTcpRoute_networkServicesTcpRouteActionsExample|TestAccNetworkServicesTcpRoute_networkServicesTcpRouteBasicExample|TestAccNetworkServicesTcpRoute_networkServicesTcpRouteGatewayBasicExample|TestAccNetworkServicesTcpRoute_networkServicesTcpRouteMeshBasicExample|TestAccNetworkServicesTcpRoute_update|TestAccNetworkServicesTlsRoute_networkServicesTlsRouteBasicExample|TestAccNetworkServicesTlsRoute_networkServicesTlsRouteGatewayBasicExample|TestAccNetworkServicesTlsRoute_networkServicesTlsRouteMeshBasicExample|TestAccNetworkServicesTlsRoute_update |
|
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 haven't given a full review yet, but it looks like there are a few different changes to existing behavior, and we would need to make sure this doesn't break users.
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
|
Tests analyticsTotal tests: Click here to see the affected service packages
Action takenFound 35 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccNetworkServicesEndpointPolicy_networkServicesEndpointPolicyBasicExample|TestAccNetworkServicesEndpointPolicy_networkServicesEndpointPolicyEmptyMatchExample|TestAccNetworkServicesEndpointPolicy_update|TestAccNetworkServicesGateway_minimalSwp|TestAccNetworkServicesGateway_multipleSwpGatewaysDifferentNetwork|TestAccNetworkServicesGateway_multipleSwpGatewaysDifferentSubnetwork|TestAccNetworkServicesGateway_networkServicesGatewayAdvancedExample|TestAccNetworkServicesGateway_networkServicesGatewayBasicExample|TestAccNetworkServicesGateway_networkServicesGatewayMultipleSwpSameNetworkExample|TestAccNetworkServicesGateway_networkServicesGatewaySecureWebProxyExample|TestAccNetworkServicesGateway_networkServicesGatewaySecureWebProxyWithoutAddresses|TestAccNetworkServicesGateway_update|TestAccNetworkServicesGateway_updateSwp|TestAccNetworkServicesGrpcRoute_networkServicesGrpcRouteActionsExample|TestAccNetworkServicesGrpcRoute_networkServicesGrpcRouteBasicExample|TestAccNetworkServicesGrpcRoute_networkServicesGrpcRouteMatchesAndActionsExample|TestAccNetworkServicesGrpcRoute_update|TestAccNetworkServicesHttpRoute_networkServicesHttpRouteActionsExample|TestAccNetworkServicesHttpRoute_networkServicesHttpRouteBasicExample|TestAccNetworkServicesHttpRoute_networkServicesHttpRouteMatchesAndActionsExample|TestAccNetworkServicesHttpRoute_networkServicesHttpRouteMeshBasicExample|TestAccNetworkServicesHttpRoute_update|TestAccNetworkServicesMesh_networkServicesMeshBasicExample|TestAccNetworkServicesMesh_networkServicesMeshNoPortExample|TestAccNetworkServicesMesh_update|TestAccNetworkServicesServiceBinding_networkServicesServiceBindingBasicExample|TestAccNetworkServicesServiceBinding_update|TestAccNetworkServicesTcpRoute_networkServicesTcpRouteActionsExample|TestAccNetworkServicesTcpRoute_networkServicesTcpRouteBasicExample|TestAccNetworkServicesTcpRoute_networkServicesTcpRouteGatewayBasicExample|TestAccNetworkServicesTcpRoute_networkServicesTcpRouteMeshBasicExample|TestAccNetworkServicesTcpRoute_update|TestAccNetworkServicesTlsRoute_networkServicesTlsRouteBasicExample|TestAccNetworkServicesTlsRoute_networkServicesTlsRouteMeshBasicExample|TestAccNetworkServicesTlsRoute_update |
|
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.
This looks good to me, I'm just wondering about the pre_update, so we have a clear understanding of the previous behavior and the new behavior.
Also, I don't know if this addresses everything in the issue, and I don't know if we want this PR to close it. Specifically, the updates to field descriptions. Are those no longer needed, or perhaps coming in another PR?
@@ -0,0 +1,4 @@ | |||
if d.Get("type") == "SECURE_WEB_GATEWAY" { |
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.
Can you explain what this is doing and why it was added? From what I can tell, it was previously possible for a user to have a google_network_services_gateway
with type = "SECURE_WEB_GATEWAY"
, and then change a field like server_tls_policy
or description
, which would trigger this condition, and presumably produce different results than before. Why do these 2 fields need to be set, and what happened before when they weren't set?
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 was just double checking with a terraform code using the actual provider and when trying to update the description of google_network_services_gateway
with type = SECURE_WEB_GATEWAY
it throw the following error:
Error: Error waiting for Updating Gateway: Error code 13, message: an internal error has occurred
The update send the name, the ID and the updated description fields only:
# google_network_services_gateway.foobar will be updated in-place
~ resource "google_network_services_gateway" "foobar" {
~ description = "my description" -> "new description"
id = "projects/{PROJECT}/locations/us-east1/gateways/{NAME}"
name = {NAME}
# (18 unchanged attributes hidden)
}
When updating through GCP console, the request sends all the fields that the Gateway contains:
gateway: {
addresses: [1]
certificate_urls: [1]
description: "new description"
gateway_security_policy: {POLICY}
name: "projects/{PROJECT}/locations/us-east1/gateways/{NAME}"
network: {NETWORK}
ports: [1]
subnetwork: {SUBNETWORK}
type: "SECURE_WEB_GATEWAY"
}
update_mask: {
paths: [
0: "certificate_urls"
1: "description"
2: "gateway_security_policy"
]}
Also, GCP Console uses API v1beta1
To update using the API Explorer first I used all fields and then I was removing one by one to check which fields are required and those 2 (name
and type
) were required to update the Gateway through API Explorer
PATCH https://networkservices.googleapis.com/v1/projects/{PROJECT}/locations/us-east1/gateways/{NAME}?updateMask=description&key=[YOUR_API_KEY] HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
Content-Type: application/json
{
"description": "new description",
"name": "{NAME}",
"type": "SECURE_WEB_GATEWAY"
}
Conclusion: Since GCP Console sends all fields it's able to update the gateway. So this modification that I did will send the required fields (name and type) to be able to update as well.
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.
Hmm ok, that's interesting behavior, but seems to match your logic. I suppose it's safer to stick with the condition you've included, but I do wonder if it might be cleaner to always include name and type in the request.
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.
At first I did that... But if the type
is other than SECURE_WEB_GATEWAY
the request fail.
That broke some tests when I was starting the development.
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.
@roaks3 regarding the fields description, it's still tracked on our radar but it was was deprioritized together with ngprabhu@
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.
Awesome, thanks for those answers!
This PR change the fields gatewaySecurityPolicy and certificateUrls on Secure Web Proxy (
google_network_services_gateway
) resource so both can be updatable.Fixes: hashicorp/terraform-provider-google#14600
Release Note Template for Downstream PRs (will be copied)