Skip to content

Commit

Permalink
made the changes. lot of files changes - do to running make fmt.
Browse files Browse the repository at this point in the history
  • Loading branch information
NillsF committed Jun 14, 2019
1 parent 4320131 commit 62bc73c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
17 changes: 17 additions & 0 deletions azurerm/resource_arm_loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ func resourceArmLoadBalancer() *schema.Resource {
ValidateFunc: azure.ValidateResourceIDOrEmpty,
},

"public_ip_prefix_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: azure.ValidateResourceIDOrEmpty,
},

"private_ip_address_allocation": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -311,6 +318,12 @@ func expandAzureRmLoadBalancerFrontendIpConfigurations(d *schema.ResourceData) *
}
}

if v := data["public_ip_prefix_id"].(string); v != "" {
properties.PublicIPPrefix = &network.SubResource{
ID: &v,
}
}

if v := data["subnet_id"].(string); v != "" {
properties.Subnet = &network.Subnet{
ID: &v,
Expand Down Expand Up @@ -365,6 +378,10 @@ func flattenLoadBalancerFrontendIpConfiguration(ipConfigs *[]network.FrontendIPC
ipConfig["public_ip_address_id"] = *pip.ID
}

if pip := props.PublicIPPrefix; pip != nil {
ipConfig["public_ip_prefix_id"] = *pip.ID
}

loadBalancingRules := make([]interface{}, 0)
if rules := props.LoadBalancingRules; rules != nil {
for _, rule := range *rules {
Expand Down
19 changes: 15 additions & 4 deletions azurerm/resource_arm_loadbalancer_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ func resourceArmLoadBalancerRule() *schema.Resource {
Default: false,
},

"disable_outbound_snat": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},

"idle_timeout_in_minutes": {
Type: schema.TypeInt,
Optional: true,
Expand Down Expand Up @@ -227,6 +233,10 @@ func resourceArmLoadBalancerRuleRead(d *schema.ResourceData, meta interface{}) e
d.Set("enable_floating_ip", properties.EnableFloatingIP)
}

if properties.DisableOutboundSnat != nil {
d.Set("disable_outbound_snat", properties.DisableOutboundSnat)
}

if properties.IdleTimeoutInMinutes != nil {
d.Set("idle_timeout_in_minutes", properties.IdleTimeoutInMinutes)
}
Expand Down Expand Up @@ -311,10 +321,11 @@ func resourceArmLoadBalancerRuleDelete(d *schema.ResourceData, meta interface{})
func expandAzureRmLoadBalancerRule(d *schema.ResourceData, lb *network.LoadBalancer) (*network.LoadBalancingRule, error) {

properties := network.LoadBalancingRulePropertiesFormat{
Protocol: network.TransportProtocol(d.Get("protocol").(string)),
FrontendPort: utils.Int32(int32(d.Get("frontend_port").(int))),
BackendPort: utils.Int32(int32(d.Get("backend_port").(int))),
EnableFloatingIP: utils.Bool(d.Get("enable_floating_ip").(bool)),
Protocol: network.TransportProtocol(d.Get("protocol").(string)),
FrontendPort: utils.Int32(int32(d.Get("frontend_port").(int))),
BackendPort: utils.Int32(int32(d.Get("backend_port").(int))),
EnableFloatingIP: utils.Bool(d.Get("enable_floating_ip").(bool)),
DisableOutboundSnat: utils.Bool(d.Get("disable_outbound_snat").(bool)),
}

if v, ok := d.GetOk("idle_timeout_in_minutes"); ok {
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_loadbalancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ resource "azurerm_lb" "test" {
`, rInt, location, rInt, rInt, rInt, rInt)
}

func testAccAzureRMLoadBalancer_frontEndConfigRemoval(rInt int, location string) string {

This comment has been minimized.

Copy link
@NillsF

NillsF Jun 15, 2019

Author Contributor

Apprently this commit contains a change that couldn't have made it to source control. The change in line 429 is totally unnecessary and a mistake.

func testAccAzureRMLoadBalancer_ftestAccrontEndConfigRemoval(rInt int, location string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
Expand Down

0 comments on commit 62bc73c

Please sign in to comment.