0

I want to create an Azure Application Gateway with Pulumi.(Document) In some parts of the code, I should add id for example in backend_pool or etc. This idis related to the application gateway that should be created. But when I run pulumi run I received the below error:

error: Code="InvalidResourceReference" Message="Resource /subscriptions/**/resourceGroups/RG-WAF**-GX/providers/Microsoft.Network/applicationGateways/APPGW-TEST7581 referenced by resource /subscriptions/***/resourceGroups/rg-waf645-gx/providers/Microsoft.Network/applicationGateways/application_gateway_waf82529b3f was not found. Please make sure that the referenced resource exists, and that both resources are in the same region." Details=[{"code":"NotFound","message":"Resource /subscriptions/***/resourceGroups/RG-WAF**-GX/providers/Microsoft.Network/applicationGateways/APPGW-TEST7581 not found."}]

my code is:

 application_gateway_waf = network.ApplicationGateway("application_gateway_waf",                                                                                                                                                                                                         
                                                      location="eastus",                                                                                                                                                                                                                 
                                                      sku=network.ApplicationGatewaySkuArgs(                                                                                                                                                                                             
                                                          capacity=2,                                                                                                                                                                                                                    
                                                          name="Standard_v2",                                                                                                                                                                                                            
                                                          tier="Standard_v2",                                                                                                                                                                                                            
                                                      ),                                                                                                                                                                                                                                 
                                                      resource_group_name='rg-waf-gx',                                                                                                                                                                                                
                                                      gateway_ip_configurations=[network.ApplicationGatewayIPConfigurationArgs(                                                                                                                                                          
                                                          name="appwg_ip_config",                                                                                                                                                                                                        
                                                          subnet=network.SubResourceArgs(                                                                                                                                                                                                
                                                              id="/subscriptions/***/resourceGroups/rg-waf645-gx/providers/Microsoft.Network/virtualNetworks/test-waf-vnet7581/subnets/appgw-subnet",                                                   
                                                          ),                                                                                                                                                                                                                             
                                                      )],                                                                                                                                                                                                                                
                                                      frontend_ip_configurations=[network.ApplicationGatewayFrontendIPConfigurationArgs(                                                                                                                                                 
                                                          name="appgw_front_ip_config",                                                                                                                                                                                                  
                                                          public_ip_address=network.SubResourceArgs(                                                                                                                                                                                     
                                                              id="/subscriptions/***/resourceGroups/rg-waf645-gx/providers/Microsoft.Network/publicIPAddresses/pip-appgw-waf7581",                                                                      
                                                          ),                                                                                                                                                                                                                             
                                                      )],                                                                                                                                                                                                                                
                                                      frontend_ports=[network.ApplicationGatewayFrontendPortArgs(                                                                                                                                                                        
                                                          name="appgw_front_port",                                                                                                                                                                                                       
                                                          port=80,                                                                                                                                                                                                                       
                                                      )],                                                                                                                                                                                                                                
                                                      backend_address_pools=[network.ApplicationGatewayBackendAddressPoolArgs(                                                                                                                                                           
                                                          backend_addresses=[network.ApplicationGatewayBackendAddressArgs(                                                                                                                                                               
                                                              fqdn = "web-app-waf7581.azurewebsites.net",                                                                                                                                                                                
                                                          )],                                                                                                                                                                                                                            
                                                          name="backend_portal",                                                                                                                                                                                                         
                                                      )],                                                                                                                                                                                                                                
                                                      backend_http_settings_collection=[network.ApplicationGatewayBackendHttpSettingsArgs(                                                                                                                                               
                                                          name="backend_portal_http_setting",                                                                                                                                                                                            
                                                          protocol="http",                                                                                                                                                                                                               
                                                          port=80,                                                                                                                                                                                                                       
                                                          cookie_based_affinity="Disabled",                                                                                                                                                                                              
                                                          request_timeout=20,                                                                                                                                                                                                            
                                                          pick_host_name_from_backend_address=True,                                                                                                                                                                                      
                                                          probe=network.SubResourceArgs(                                                                                                                                                                                                 
                                                              id="/subscriptions/***/resourceGroups/rg-waf645-gx/providers/Microsoft.Network/applicationGateways/appgw-test7581/probes/probe_portal_backend_setting4848488484"                          
                                                          ),                                                                                                                                                                                                                             
                                                      )],                                                                                                                                                                                                                                
                                                      http_listeners=[network.ApplicationGatewayHttpListenerArgs(                                                                                                                                                                        
                                                          name="listener_portal",                                                                                                                                                                                                        
                                                          frontend_ip_configuration=network.SubResourceArgs(                                                                                                                                                                             
                                                              id= "/subscriptions/****/resourceGroups/rg-waf645-gx/providers/Microsoft.Network/applicationGateways/appgw-test7581/frontendIPConfigurations/appgw_front_ip_config",                       
                                                          ),                                                                                                                                                                                                                             
                                                          frontend_port=network.SubResourceArgs(                                                                                                                                                                                         
                                                              id="/subscriptions/***/resourceGroups/rg-waf645-gx/providers/Microsoft.Network/applicationGateways/appgw-test7581/frontendPorts/appgw_front_port",                                        
                                                          ),                                                                                                                                                                                                                             
                                                          protocol="http",                                                                                                                                                                                                               
                                                          ssl_certificate= None,                                                                                                                                                                                                         
                                                          host_name="portal1.mohsenakhavan.com",                                                                                                                                                                                         
                                                          require_server_name_indication= False,                                                                                                                                                                                         
                                                      )],                                                                                                                                                                                                                                
                                                      request_routing_rules=[network.ApplicationGatewayRequestRoutingRuleArgs(                                                                                                                                                           
                                                          name="rule_portal",                                                                                                                                                                                                            
                                                          backend_address_pool=network.SubResourceArgs(                                                                                                                                                                                  
                                                              id="/subscriptions/****/resourceGroups/rg-waf645-gx/providers/Microsoft.Network/applicationGateways/appgw-test7581/backendAddressPools/backend_portal",                                    
                                                          ),                                                                                                                                                                                                                             
                                                          http_listener=network.SubResourceArgs(                                                                                                                                                                                         
                                                              id="/subscriptions/***/resourceGroups/rg-waf645-gx/providers/Microsoft.Network/applicationGateways/appgw-test7581/httpListeners/linstener",                                               
                                                          ),                                                                                                                                                                                                                             
                                                          backend_http_settings=network.SubResourceArgs(                                                                                                                                                                                 
                                                              id="/subscriptions/***/resourceGroups/rg-waf645-gx/providers/Microsoft.Network/applicationGateways/appgw-test7581/backendHttpSettingsCollection/backend_portal_http_setting",             
                                                          ),                                                                                                                                                                                                                             
                                                          priority=100,                                                                                                                                                                                                                  
                                                      )],                                                                                                                                                                                                                                
                                                      enable_http2=False,                                                                                                                                                                                                                
                                                      probes=[network.ApplicationGatewayProbeArgs(                                                                                                                                                                                       
                                                          name="probe_portal_backend_setting",                                                                                                                                                                                           
                                                          id="/subscriptions/**/resourceGroups/rg-waf645-gx/providers/Microsoft.Network/applicationGateways/appgw-test7581/backendHttpSettingsCollection/backend_portal_http_setting",                 
                                                          interval=30,                                                                                                                                                                                                                   
                                                          min_servers=0,                                                                                                                                                                                                                 
                                                          path="/",                                                                                                                                                                                                                      
                                                          protocol="Http",                                                                                                                                                                                                               
                                                          timeout=30,                                                                                                                                                                                                                    
                                                          unhealthy_threshold=20,                                                                                                                                                                                                        
                                                          pick_host_name_from_backend_http_settings=True,                                                                                                                                                                                
                                                      )],                                                                                                                                                                                                                                
                                                      )                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                           
Shadi
  • 193
  • 2
  • 12

1 Answers1

0

My problem was solved. I missed adding application_gateway_name item to my code. Regarding this issue, the Application Gateway return wrong name in id filed.

Shadi
  • 193
  • 2
  • 12