Fixing assigning ssl certificate to http listener in app gateway (#45830)

* fixed ssl certificate reference

* modified test
pull/45857/merge
Zim Kalinowski 6 years ago committed by Matt Davis
parent 16fa49a894
commit 83645963fb

@ -577,6 +577,12 @@ class AzureRMApplicationGateways(AzureRMModuleBase):
kwargs['name'], kwargs['name'],
item['frontend_port']) item['frontend_port'])
item['frontend_port'] = {'id': id} item['frontend_port'] = {'id': id}
if 'ssl_certificate' in item:
id = ssl_certificate_id(self.subscription_id,
kwargs['resource_group'],
kwargs['name'],
item['ssl_certificate'])
item['ssl_certificate'] = {'id': id}
if 'protocol' in item: if 'protocol' in item:
item['protocol'] = _snake_to_camel(item['protocol'], True) item['protocol'] = _snake_to_camel(item['protocol'], True)
ev[i] = item ev[i] = item
@ -781,6 +787,16 @@ def frontend_port_id(subscription_id, resource_group_name, appgateway_name, name
) )
def ssl_certificate_id(subscription_id, resource_group_name, ssl_certificate_name, name):
"""Generate the id for a frontend port"""
return '/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/applicationGateways/{2}/sslCertificates/{3}'.format(
subscription_id,
resource_group_name,
ssl_certificate_name,
name
)
def backend_address_pool_id(subscription_id, resource_group_name, appgateway_name, name): def backend_address_pool_id(subscription_id, resource_group_name, appgateway_name, name):
"""Generate the id for an address pool""" """Generate the id for an address pool"""
return '/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/applicationGateways/{2}/backendAddressPools/{3}'.format( return '/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/applicationGateways/{2}/backendAddressPools/{3}'.format(

@ -66,6 +66,8 @@
http_listeners: http_listeners:
- frontend_ip_configuration: sample_gateway_frontend_ip_config - frontend_ip_configuration: sample_gateway_frontend_ip_config
frontend_port: ag_frontend_port frontend_port: ag_frontend_port
protocol: https
ssl_certificate: cert2
name: sample_http_listener name: sample_http_listener
request_routing_rules: request_routing_rules:
- rule_type: basic - rule_type: basic
@ -129,6 +131,8 @@
http_listeners: http_listeners:
- frontend_ip_configuration: sample_gateway_frontend_ip_config - frontend_ip_configuration: sample_gateway_frontend_ip_config
frontend_port: ag_frontend_port frontend_port: ag_frontend_port
protocol: https
ssl_certificate: cert2
name: sample_http_listener name: sample_http_listener
request_routing_rules: request_routing_rules:
- rule_type: Basic - rule_type: Basic
@ -187,6 +191,8 @@
http_listeners: http_listeners:
- frontend_ip_configuration: sample_gateway_frontend_ip_config - frontend_ip_configuration: sample_gateway_frontend_ip_config
frontend_port: ag_frontend_port frontend_port: ag_frontend_port
protocol: https
ssl_certificate: cert2
name: sample_http_listener name: sample_http_listener
request_routing_rules: request_routing_rules:
- rule_type: Basic - rule_type: Basic
@ -245,6 +251,8 @@
http_listeners: http_listeners:
- frontend_ip_configuration: sample_gateway_frontend_ip_config - frontend_ip_configuration: sample_gateway_frontend_ip_config
frontend_port: ag_frontend_port frontend_port: ag_frontend_port
protocol: https
ssl_certificate: cert2
name: sample_http_listener name: sample_http_listener
request_routing_rules: request_routing_rules:
- rule_type: Basic - rule_type: Basic

Loading…
Cancel
Save