From 62bc73cd1c2f6caef0f27664ad39a84d5b2cea2f Mon Sep 17 00:00:00 2001 From: Nills Franssens Date: Fri, 14 Jun 2019 13:07:34 -0700 Subject: [PATCH] made the changes. lot of files changes - do to running make fmt. --- azurerm/resource_arm_loadbalancer.go | 17 +++++++++++++++++ azurerm/resource_arm_loadbalancer_rule.go | 19 +++++++++++++++---- azurerm/resource_arm_loadbalancer_test.go | 2 +- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/azurerm/resource_arm_loadbalancer.go b/azurerm/resource_arm_loadbalancer.go index 469c446490f7..b315af2068df 100644 --- a/azurerm/resource_arm_loadbalancer.go +++ b/azurerm/resource_arm_loadbalancer.go @@ -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, @@ -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, @@ -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 { diff --git a/azurerm/resource_arm_loadbalancer_rule.go b/azurerm/resource_arm_loadbalancer_rule.go index 394ac46c4530..4bd9a67b5acd 100644 --- a/azurerm/resource_arm_loadbalancer_rule.go +++ b/azurerm/resource_arm_loadbalancer_rule.go @@ -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, @@ -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) } @@ -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 { diff --git a/azurerm/resource_arm_loadbalancer_test.go b/azurerm/resource_arm_loadbalancer_test.go index a03428e4de53..0b67aa7068f9 100644 --- a/azurerm/resource_arm_loadbalancer_test.go +++ b/azurerm/resource_arm_loadbalancer_test.go @@ -426,7 +426,7 @@ resource "azurerm_lb" "test" { `, rInt, location, rInt, rInt, rInt, rInt) } -func testAccAzureRMLoadBalancer_frontEndConfigRemoval(rInt int, location string) string { +func testAccAzureRMLoadBalancer_ftestAccrontEndConfigRemoval(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { name = "acctestRG-%d"