-
Notifications
You must be signed in to change notification settings - Fork 112
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
Improved VM network to allow reference vApp routed network #472
Conversation
Signed-off-by: Vaidotas Bauzys <[email protected]>
…roviders/terraform-provider-vcd
Merge branch 'master' of github.com:terraform-providers/terraform-provider-vcd
…roviders/terraform-provider-vcd
…roviders/terraform-provider-vcd
…roviders/terraform-provider-vcd
…roviders/terraform-provider-vcd
…roviders/terraform-provider-vcd
…roviders/terraform-provider-vcd
…roviders/terraform-provider-vcd
…roviders/terraform-provider-vcd
Merge branch 'master' of github.com:terraform-providers/terraform-provider-vcd
…roviders/terraform-provider-vcd
…roviders/terraform-provider-vcd
…roviders/terraform-provider-vcd
Merge branch 'master' of github.com:terraform-providers/terraform-provider-vcd
…roviders/terraform-provider-vcd
…roviders/terraform-provider-vcd
…roviders/terraform-provider-vcd
…roviders/terraform-provider-vcd
…roviders/terraform-provider-vcd
…roviders/terraform-provider-vcd
…roviders/terraform-provider-vcd
Signed-off-by: Vaidotas Bauzys <[email protected]>
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.
First pass.
I confirm that with this fix I was able to update VM config to add vApp routed network!
|
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.
Some changes required
vcd/resource_vcd_vapp_network.go
Outdated
@@ -515,7 +515,7 @@ func resourceVcdVappNetworkImport(d *schema.ResourceData, meta interface{}) ([]* | |||
} | |||
|
|||
if vappNetworkToImport.Configuration.FenceMode == types.FenceModeBridged || | |||
(vappNetworkToImport.Configuration.FenceMode == types.FenceModeNAT && vappNetworkToImport.Configuration.Features.DhcpService == nil) { | |||
(vappNetworkToImport.Configuration.FenceMode == types.FenceModeNAT && vappNetworkToImport.Configuration.IPScopes.IPScope[0].IsInherited == true) { |
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 check for vappNetworkToImport.Configuration.IPScopes
to be not nil , and for vappNetworkToImport.Configuration.IPScopes.IPScope
to have elements
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 always return, but added
vcd/resource_vcd_vapp_org_network.go
Outdated
@@ -300,7 +300,7 @@ func resourceVcdVappOrgNetworkImport(d *schema.ResourceData, meta interface{}) ( | |||
} | |||
|
|||
if vappNetworkToImport.Configuration.FenceMode == types.FenceModeIsolated || | |||
(vappNetworkToImport.Configuration.FenceMode == types.FenceModeNAT && vappNetworkToImport.Configuration.Features.DhcpService != nil) { | |||
(vappNetworkToImport.Configuration.FenceMode == types.FenceModeNAT && vappNetworkToImport.Configuration.IPScopes.IPScope[0].IsInherited == 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.
We should check for vappNetworkToImport.Configuration.IPScopes
to be not nil , and for vappNetworkToImport.Configuration.IPScopes.IPScope
to have elements
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.
Also wondering what is the impact (or maybe none) of NetworkConfiguration.ParentNetwork
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 always return, but added
vcd/resource_vcd_vapp_vm.go
Outdated
if networkConfig.NetworkName == vAppNetworkName && | ||
networkConfig.Configuration.FenceMode == types.FenceModeIsolated || | ||
(networkConfig.Configuration.FenceMode == types.FenceModeNAT && | ||
networkConfig.Configuration.IPScopes.IPScope[0].IsInherited == 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.
We should check for networkConfig.Configuration.IPScopes
to be not nil , and for networkConfig.Configuration.IPScopes.IPScope
to have elements
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, and also this check needs an explanation comment, explaining what is the meaning of it.
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 always return, but added
org = "{{.Org}}" | ||
vdc = "{{.Vdc}}" | ||
|
||
vapp_name = vcd_vapp.{{.VAppName}}.name |
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 HCL block is not formatted
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.
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.
Good one :) Also changelog needs a note or at least mentioning this PR on the other attachment resources.
vcd/resource_vcd_vapp_org_network.go
Outdated
@@ -300,7 +300,7 @@ func resourceVcdVappOrgNetworkImport(d *schema.ResourceData, meta interface{}) ( | |||
} | |||
|
|||
if vappNetworkToImport.Configuration.FenceMode == types.FenceModeIsolated || | |||
(vappNetworkToImport.Configuration.FenceMode == types.FenceModeNAT && vappNetworkToImport.Configuration.Features.DhcpService != nil) { | |||
(vappNetworkToImport.Configuration.FenceMode == types.FenceModeNAT && vappNetworkToImport.Configuration.IPScopes.IPScope[0].IsInherited == 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.
Also wondering what is the impact (or maybe none) of NetworkConfiguration.ParentNetwork
vcd/resource_vcd_vapp_vm.go
Outdated
if networkConfig.NetworkName == vAppNetworkName && | ||
networkConfig.Configuration.FenceMode == types.FenceModeIsolated || | ||
(networkConfig.Configuration.FenceMode == types.FenceModeNAT && | ||
networkConfig.Configuration.IPScopes.IPScope[0].IsInherited == 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.
Yes, and also this check needs an explanation comment, explaining what is the meaning of it.
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
CHANGELOG.md
Outdated
* `vcd_vapp_vm` allows to add routed vApp network, not only isolated one. `network.name` can be reference | ||
`vcd_vapp_network.name` [GH-472] |
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.
* `vcd_vapp_vm` allows to add routed vApp network, not only isolated one. `network.name` can be reference | |
`vcd_vapp_network.name` [GH-472] | |
* `vcd_vapp_vm` allows to add routed vApp network, not only isolated one. `network.name` can reference | |
`vcd_vapp_network.name` of a vApp network with `org_network_name` set [GH-472] |
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.
updated
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
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.
Thank you for a quick & needed addition!
Signed-off-by: Vaidotas Bauzys <[email protected]>
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.
LGTM
Ref: https://github.com/terraform-providers/terraform-provider-vcd/issues/471