Open carmine73 opened 3 years ago
Importing an edge gateway does not pupulate the external_network
list in the state file, so every subsequent action on that edge forces the replacement, even if the configuration of the external network is unchanged.
Here you can see the state file vdc_edgegateway
block (after import and refresh) with "external_network": []
{
"mode": "managed",
"type": "vcd_edgegateway",
"name": "edge1",
"provider": "provider[\"registry.terraform.io/vmware/vcd\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"configuration": "compact",
"default_external_network_ip": "10.10.10.11",
"description": "edge gw created by terraform",
"distributed_routing": false,
"external_network": [],
"external_network_ips": [
"10.10.10.11"
],
"fips_mode_enabled": false,
"fw_default_rule_action": "deny",
"fw_default_rule_logging_enabled": false,
"fw_enabled": true,
"ha_enabled": false,
"id": "urn:vcloud:gateway:1cd610f1-24f0-4f41-a3a8-dcffg00a1458",
"lb_acceleration_enabled": false,
"lb_enabled": false,
"lb_logging_enabled": false,
"lb_loglevel": "info",
"name": "org-template_1_edge_1",
"org": "org-template_1",
"use_default_route_for_dns_relay": false,
"vdc": "org-template_1_ALL_1"
},
"sensitive_attributes": [],
"private": "eyJzY2hlbWFfaaVzb2lvbiI6IjAifQ==",
"dependencies": [
"data.vcd_edgegateway.my-edge1",
"data.vcd_org.my-org1",
"data.vcd_org_vdc.my-vdc1",
"vcd_org.org1",
"vcd_org_vdc.vdc1"
]
}
]
},
Just a note: extending the edge suballocate_pool is a quite frequent operation done by vcloud sys admins and should be done in place. I'm sorry nobody add comments on this issue after 1 month :-(
Sorry for the extended silence. We are dealing with different priorities at the moment, and this issue has not made the cut yet.
I've realized that every change on a NSX-v edge gateway requires the edge to be replaced, even the description
Terraform will perform the following actions:
# vcd_edgegateway.edge1 must be replaced
-/+ resource "vcd_edgegateway" "edge1" {
~ default_external_network_ip = "10.23.96.115" -> (known after apply)
~ description = "edge gw created by terraform" -> "edge gw created/modified by terraform" # forces replacement
~ external_network_ips = [
- "10.23.96.115",
] -> (known after apply)
~ id = "urn:vcloud:gateway:158b72e9-9b35-47d2-ad02-63c45956d0cdc" -> (known after apply)
name = "org-testcoll_3_edge_1"
~ use_default_route_for_dns_relay = false -> (known after apply)
# (13 unchanged attributes hidden)
# (1 unchanged block hidden)
}
while almost every change on edge gateway can be done with:
PUT https://<VCD>/network/edges/{id}
Terraform Version
Affected Resource(s)
Terraform Configuration Files
Steps to Reproduce
terraform plan
terraform apply
end_address = "10.10.10.13" -> "10.10.10.14"
terraform plan
Debug Output
The edge creation is ok, but when I try to update the configuration I got:
Expected Behavior
Suballocated pool is changed in place
Actual Behavior
Edge is going to be replaced. Since there are routed networks attached, I got an error:
References
@didainius, we talked about this at the end of 2019 https://github.com/vmware/terraform-provider-vcd/issues/323#issuecomment-562034891