Skip to content

Commit

Permalink
lb: Add sku parameter to support LB Standard
Browse files Browse the repository at this point in the history
  • Loading branch information
justaugustus committed Jan 5, 2018
1 parent f878bd9 commit c433c26
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions azurerm/resource_arm_loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ func resourceArmLoadBalancer() *schema.Resource {
},
},

"sku": {
Type: schema.TypeString,
Required: true,
},

"tags": tagsSchema(),
},
}
Expand All @@ -114,6 +119,7 @@ func resourceArmLoadBalancerCreate(d *schema.ResourceData, meta interface{}) err
name := d.Get("name").(string)
location := d.Get("location").(string)
resGroup := d.Get("resource_group_name").(string)
sku := convertSkuStringToLoadBalancerSku(d.Get("sku").(string))
tags := d.Get("tags").(map[string]interface{})
expandedTags := expandTags(tags)

Expand All @@ -127,6 +133,7 @@ func resourceArmLoadBalancerCreate(d *schema.ResourceData, meta interface{}) err
Name: utils.String(name),
Location: utils.String(location),
Tags: expandedTags,
Sku: &sku,
LoadBalancerPropertiesFormat: &properties,
}

Expand Down Expand Up @@ -225,6 +232,17 @@ func resourceArmLoadBalancerDelete(d *schema.ResourceData, meta interface{}) err
return nil
}

func convertSkuStringToLoadBalancerSku(s string) network.LoadBalancerSku {
skuNames := map[string]network.LoadBalancerSkuName{
"basic": network.LoadBalancerSkuNameBasic,
"standard": network.LoadBalancerSkuNameStandard,
}

return network.LoadBalancerSku{
Name: skuNames[s],
}
}

func expandAzureRmLoadBalancerFrontendIpConfigurations(d *schema.ResourceData) *[]network.FrontendIPConfiguration {
configs := d.Get("frontend_ip_configuration").([]interface{})
frontEndConfigs := make([]network.FrontendIPConfiguration, 0, len(configs))
Expand Down

0 comments on commit c433c26

Please sign in to comment.