Skip to content

azurermLbOutboundRule

Manages a Load Balancer Outbound Rule.

\~> NOTE When using this resource, the Load Balancer needs to have a FrontEnd IP Configuration and a Backend Address Pool Attached.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "LoadBalancerRG",
  }
);
const azurermPublicIpExample = new azurerm.publicIp.PublicIp(
  this,
  "example_1",
  {
    allocation_method: "Static",
    location: azurermResourceGroupExample.location,
    name: "PublicIPForLB",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermPublicIpExample.overrideLogicalId("example");
const azurermLbExample = new azurerm.lb.Lb(this, "example_2", {
  frontend_ip_configuration: [
    {
      name: "PublicIPAddress",
      public_ip_address_id: azurermPublicIpExample.id,
    },
  ],
  location: azurermResourceGroupExample.location,
  name: "TestLoadBalancer",
  resource_group_name: azurermResourceGroupExample.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermLbExample.overrideLogicalId("example");
const azurermLbBackendAddressPoolExample =
  new azurerm.lbBackendAddressPool.LbBackendAddressPool(this, "example_3", {
    loadbalancer_id: azurermLbExample.id,
    name: "example",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermLbBackendAddressPoolExample.overrideLogicalId("example");
const azurermLbOutboundRuleExample = new azurerm.lbOutboundRule.LbOutboundRule(
  this,
  "example_4",
  {
    backend_address_pool_id: azurermLbBackendAddressPoolExample.id,
    frontend_ip_configuration: [
      {
        name: "PublicIPAddress",
      },
    ],
    loadbalancer_id: azurermLbExample.id,
    name: "OutboundRule",
    protocol: "Tcp",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermLbOutboundRuleExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the Outbound Rule. Changing this forces a new resource to be created.
  • loadbalancerId - (Required) The ID of the Load Balancer in which to create the Outbound Rule. Changing this forces a new resource to be created.
  • frontendIpConfiguration - (Optional) One or more frontendIpConfiguration blocks as defined below.
  • backendAddressPoolId - (Required) The ID of the Backend Address Pool. Outbound traffic is randomly load balanced across IPs in the backend IPs.
  • protocol - (Required) The transport protocol for the external endpoint. Possible values are udp, tcp or all.
  • enableTcpReset - (Optional) Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP.
  • allocatedOutboundPorts - (Optional) The number of outbound ports to be used for NAT. Defaults to 1024.
  • idleTimeoutInMinutes - (Optional) The timeout for the TCP idle connection Defaults to 4.

A frontendIpConfiguration block supports the following:

  • name - (Required) The name of the Frontend IP Configuration.

Attributes Reference

The following attributes are exported:

  • id - The ID of the Load Balancer Outbound Rule.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Load Balancer Outbound Rule.
  • update - (Defaults to 30 minutes) Used when updating the Load Balancer Outbound Rule.
  • read - (Defaults to 5 minutes) Used when retrieving the Load Balancer Outbound Rule.
  • delete - (Defaults to 30 minutes) Used when deleting the Load Balancer Outbound Rule.

Import

Load Balancer Outbound Rules can be imported using the resourceId, e.g.

terraform import azurerm_lb_outbound_rule.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/loadBalancers/lb1/outboundRules/rule1