terraform-aviatrix-modules / terraform-aviatrix-mc-overlap-nat-spoke

This configures Aviatrix spoke gateways to deal with IP overlap in the spoke VNET/VPC by adding NAT rules and route propagation
Apache License 2.0
0 stars 7 forks source link

Unable to deploy along with single spoke (nonHA) deployment - "Gateway with dummy does not exist" #8

Open patelalbg opened 5 months ago

patelalbg commented 5 months ago

Env: Aviatrix nonHA spoke deployment (mc-spoke) + NAT (mc-overlap-nat-spoke) Module 1.1.1 TF 1.5.2 Controller 7.1.x

Issue: Following error noted during Terraform run :

Error: failed to configure policies for 'customized_snat' mode due to: rest API edit_gw_customized_snat_config Post failed: Gateway with name dummy does not exist
│
│   with module.spoke1_nat[0].aviatrix_gateway_snat.gw_2[0],
│   on .terraform/modules/spoke1_nat/main.tf line 43, in resource "aviatrix_gateway_snat" "gw_2":
│   43: resource "aviatrix_gateway_snat" "gw_2" {
│
╵
╷
│ Error: failed to update DNAT for gateway(name: ) due to: rest API update_dnat_config Post failed: following parameters are required: gateway_name, policy_list
│
│   with module.spoke1_nat[0].aviatrix_gateway_dnat.dnat_rules_gw2[0],
│   on .terraform/modules/spoke1_nat/main.tf line 118, in resource "aviatrix_gateway_dnat" "dnat_rules_gw2":
│  118: resource "aviatrix_gateway_dnat" "dnat_rules_gw2" {
│

Observations:

Issue with single spoke (non HA); the NAT resource blocks for gw2 still being parsed, HOWEVER, the single spoke snat and dnat is provisioned correctly, though ERROR above is still seen.

Deploying spokegw HA works fine.

patelavtx commented 1 month ago

The 'test-non-ha' branch change helped deploy Avtx spoke + nat module without errors as before. HOWEVER, if a 2nd 'terraform apply' is run, the same error is reported:

(1)

module.spoke1_nat[0].aviatrix_gateway_dnat.dnat_rules_gw2[0]: Creating...
╷
│ Error: failed to configure policies for 'customized_snat' mode due to: rest API edit_gw_customized_snat_config Post failed: following parameters are required: gateway_name
│ 
│   with module.spoke1_nat[0].aviatrix_gateway_snat.gw_2[0],
│   on .terraform/modules/spoke1_nat/main.tf line 43, in resource "aviatrix_gateway_snat" "gw_2":
│   43: resource "aviatrix_gateway_snat" "gw_2" {
│ 
╵
╷
│ Error: failed to update DNAT for gateway(name: ) due to: rest API update_dnat_config Post failed: following parameters are required: gateway_name, policy_list
│ 
│   with module.spoke1_nat[0].aviatrix_gateway_dnat.dnat_rules_gw2[0],
│   on .terraform/modules/spoke1_nat/main.tf line 118, in resource "aviatrix_gateway_dnat" "dnat_rules_gw2":
│  118: resource "aviatrix_gateway_dnat" "dnat_rules_gw2" {
│ 

2 If the variables.tf file for the NAT module is set as below (same error):

_locals { is_ha = (var.spoke_gw_object.ha_gw_size != null) || (var.spoke_gw_object.ha_gwsize != "") }

3 if the variables.tf file for the NAT module is set with this:

locals { _is_ha = var.spoke_gw_object.ha_gwsize != "" }

'Terraform apply works without any issues and shows 'no changes'