Skip to content

Commit

Permalink
azurerm_lb_rule - remove Computed from idle_timeout_in_minutes,…
Browse files Browse the repository at this point in the history
… `load_distribution` and `probe_id` (#26616)

* azurerm_lb_rule - remove Computed from idle_timeout_in_minutes, load_distribution and probe_id

* update schema

* sort pkgs
  • Loading branch information
neil-yechenwei authored Jul 12, 2024
1 parent 2d439f8 commit e30eaac
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
25 changes: 21 additions & 4 deletions internal/services/loadbalancer/rule_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/helpers/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/locks"
loadBalancerValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
Expand Down Expand Up @@ -326,7 +327,7 @@ func expandAzureRmLoadBalancerRule(d *pluginsdk.ResourceData, lb *loadbalancers.
}

func resourceArmLoadBalancerRuleSchema() map[string]*pluginsdk.Schema {
return map[string]*pluginsdk.Schema{
resource := map[string]*pluginsdk.Schema{
"name": {
Type: pluginsdk.TypeString,
Required: true,
Expand Down Expand Up @@ -389,7 +390,6 @@ func resourceArmLoadBalancerRuleSchema() map[string]*pluginsdk.Schema {
"probe_id": {
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
},

// TODO 4.0: change this from enable_* to *_enabled
Expand All @@ -414,14 +414,31 @@ func resourceArmLoadBalancerRuleSchema() map[string]*pluginsdk.Schema {
"idle_timeout_in_minutes": {
Type: pluginsdk.TypeInt,
Optional: true,
Computed: true,
Default: 4,
ValidateFunc: validation.IntBetween(4, 100),
},

"load_distribution": {
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
Default: string(loadbalancers.LoadDistributionDefault),
},
}

if !features.FourPointOhBeta() {
resource["idle_timeout_in_minutes"] = &pluginsdk.Schema{
Type: pluginsdk.TypeInt,
Optional: true,
Computed: true,
ValidateFunc: validation.IntBetween(4, 100),
}

resource["load_distribution"] = &pluginsdk.Schema{
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
}
}

return resource
}
2 changes: 1 addition & 1 deletion website/docs/r/lb_rule.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ The following arguments are supported:
* `probe_id` - (Optional) A reference to a Probe used by this Load Balancing Rule.
* `enable_floating_ip` - (Optional) Are the Floating IPs enabled for this Load Balancer Rule? A "floating” IP is reassigned to a secondary server in case the primary server fails. Required to configure a SQL AlwaysOn Availability Group. Defaults to `false`.
* `idle_timeout_in_minutes` - (Optional) Specifies the idle timeout in minutes for TCP connections. Valid values are between `4` and `100` minutes. Defaults to `4` minutes.
* `load_distribution` - (Optional) Specifies the load balancing distribution type to be used by the Load Balancer. Possible values are: `Default` – The load balancer is configured to use a 5 tuple hash to map traffic to available servers. `SourceIP` – The load balancer is configured to use a 2 tuple hash to map traffic to available servers. `SourceIPProtocol` – The load balancer is configured to use a 3 tuple hash to map traffic to available servers. Also known as Session Persistence, where in the Azure portal the options are called `None`, `Client IP` and `Client IP and Protocol` respectively.
* `load_distribution` - (Optional) Specifies the load balancing distribution type to be used by the Load Balancer. Possible values are: `Default` – The load balancer is configured to use a 5 tuple hash to map traffic to available servers. `SourceIP` – The load balancer is configured to use a 2 tuple hash to map traffic to available servers. `SourceIPProtocol` – The load balancer is configured to use a 3 tuple hash to map traffic to available servers. Also known as Session Persistence, where in the Azure portal the options are called `None`, `Client IP` and `Client IP and Protocol` respectively. Defaults to `Default`.
* `disable_outbound_snat` - (Optional) Is snat enabled for this Load Balancer Rule? Default `false`.
* `enable_tcp_reset` - (Optional) Is TCP Reset enabled for this Load Balancer Rule?

Expand Down

0 comments on commit e30eaac

Please sign in to comment.