-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
New Resource & Data Source: azurerm_app_service_virtual_network_connection_gateway
#4458
New Resource & Data Source: azurerm_app_service_virtual_network_connection_gateway
#4458
Conversation
87bfcc6
to
5259d19
Compare
2a91ccb
to
aac30f1
Compare
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.
Hi @njuCZ,
I started reviewing this and have left a bunch of comments inline. While going through the create function it appears we are calling a bunch of different APIs. Would this resource make more sense a a few individual ones that combine for the same affect? possible a virtual_network_gateway_connection
and a virtual_network_gateway_connection_app_service_association
resource?
azurerm/data_source_app_service_virtual_network_connection_test.go
Outdated
Show resolved
Hide resolved
website/docs/r/app_service_virtual_network_connection.html.markdown
Outdated
Show resolved
Hide resolved
website/docs/r/app_service_virtual_network_connection.html.markdown
Outdated
Show resolved
Hide resolved
website/docs/r/app_service_virtual_network_connection.html.markdown
Outdated
Show resolved
Hide resolved
this resource is to intergrate an app service with a virtual network. It's one whole function in the azure portal, though it needs call two different api. there is no need to separate into two different resources |
@katbyte I have modified my codes according to your suggestion, could you kindly review my codes once more? |
f0adece
to
cbcb1bb
Compare
azurerm_app_service_virtual_network_connection
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.
Thanks for the revisions @njuCZ,
In addition to the comments i've left i'm wondering if it makes sense to export all those properties? are they available via the app service or vnet resource/data sources? because if they are it might make sense to leave them out with a comment stating as such and users can just instead use those, wdyt?
azurerm/resource_arm_app_service_virtual_network_connection_test.go
Outdated
Show resolved
Hide resolved
website/docs/d/app_service_virtual_network_connection.html.markdown
Outdated
Show resolved
Hide resolved
website/docs/r/app_service_virtual_network_connection.html.markdown
Outdated
Show resolved
Hide resolved
website/docs/r/app_service_virtual_network_connection.html.markdown
Outdated
Show resolved
Hide resolved
website/docs/r/app_service_virtual_network_connection.html.markdown
Outdated
Show resolved
Hide resolved
Also we are getting test failures:
|
@katbyte thank you for your suggestion, I have fixed them |
b0b358d
to
36c8020
Compare
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.
thanks for the updates @njuCZ, i've left some more comments inline that need to be addressed before merge.
website/docs/r/app_service_virtual_network_connection.html.markdown
Outdated
Show resolved
Hide resolved
website/docs/r/app_service_virtual_network_connection.html.markdown
Outdated
Show resolved
Hide resolved
website/docs/r/app_service_virtual_network_connection.html.markdown
Outdated
Show resolved
Hide resolved
website/docs/r/app_service_virtual_network_connection.html.markdown
Outdated
Show resolved
Hide resolved
website/docs/r/app_service_virtual_network_connection.html.markdown
Outdated
Show resolved
Hide resolved
website/docs/r/app_service_virtual_network_connection.html.markdown
Outdated
Show resolved
Hide resolved
7c66d8f
to
ce14e3f
Compare
hi @katbyte I have refactored to |
ff6f8c9
to
4c97eac
Compare
azurerm_app_service_virtual_network_connection
azurerm_app_service_virtual_network_connection_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.
Hi @njuCZ,
I've given this another review and left my comments inline. I'd really like some additional detail in comments about the workflow of the create function and the steps its taking. Thanks!
return fmt.Errorf("this gateways %q under vnet %q (Resource Group %q) does not have a Point-to-site Address Range. Please specify one in CIDR notation, e.g. 10.0.0.0/8", gatewayName, vnetName, vnetResGroup) | ||
} | ||
|
||
isRelated, err := checkGatewayInVirtualNetwork(virtualNetworkGateway, vnetId) |
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.
Could we get some comments explaining what the workflow is here and these function calls aredoing?
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 have left some comments in the codes for the steps. At first I want to find the virtual network gateway from the virtual network, now we have both parameters: virtual_network_id
and virtual_network_gateway_id
, so I first check whether they are related. (thus virtual network gateway should located in a gateway
subnet in the virtual network)
azurerm/internal/services/web/data_source_app_service_virtual_network_connection_gateway.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/web/resource_arm_app_service_virtual_network_connection_gateway.go
Outdated
Show resolved
Hide resolved
...ernal/services/web/tests/resource_arm_app_service_virtual_network_connection_gateway_test.go
Show resolved
Hide resolved
|
||
lifecycle { | ||
ignore_changes = [ | ||
vpn_client_configuration.0.root_certificate, |
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.
Why are we ignoring lifecycle changes on this property? it might want to be computed if its being updated externally now
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.
Because the steps are
- CreateOrUpdateVnetConnection
- result of step 1 contains cert infomation, we should set the cert to virtual network gateway (check duplicate)
- generate vpn package uri
- CreateOrUpdateVnetConnectionGateway using step 3's result
a gateway required virtual network integration needs these four steps. In this process, we need update certificate of the virtual network gateway.
I think there is no means to split this process.
I have added computed: true
in the newest codes for virtual network gateway
website/docs/r/app_service_virtual_network_connection_gateway.html.markdown
Outdated
Show resolved
Hide resolved
website/docs/r/app_service_virtual_network_connection_gateway.html.markdown
Outdated
Show resolved
Hide resolved
website/docs/r/app_service_virtual_network_connection_gateway.html.markdown
Outdated
Show resolved
Hide resolved
* `routes` - (Array) One or more `route` block defined below. | ||
|
||
--- | ||
|
||
A `route` block supports the following: | ||
* `name` - Resource Name. | ||
* `route_type` - The type of route this is: DEFAULT - By default, every app has routes to the local address ranges specified by RFC1918 INHERITED - Routes inherited from the real Virtual Network routes STATIC - Static route set on the app only. Valid values are `DEFAULT`, `INHERITED`, `STATIC` | ||
* `start_address` The starting address for the route. | ||
* `end_address` - The ending address for the route. |
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.
these are exported so could we word them as such?
website/docs/r/app_service_virtual_network_connection_gateway.html.markdown
Outdated
Show resolved
Hide resolved
e44f494
to
2f5a478
Compare
2f5a478
to
65716b0
Compare
@katbyte sorry for late reply. I have refined my codes. Thanks again for your patience reviewing this PR! |
Hi @njuCZ It feels like things are confused (and confusing) as there should be two resources (with data sources) here, I think a redesign into 2 will simplify things, give better focus to each part, and help us get this through. WDYT? |
Based on this comment there's some design questions which need to be addressed here - rather than leaving this open whilst that's happening I'm going to close this PR for the moment, but once those have been resolved we can circle back around and take another look here |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Add new resource and data source for Gateway Required App Service Virtual Network Connection
(fix [#4333, #4332])