azurermLb
Manages a Load Balancer Resource.
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");
Argument Reference
The following arguments are supported:
-
name
- (Required) Specifies the name of the Load Balancer. Changing this forces a new resource to be created. -
resourceGroupName
- (Required) The name of the Resource Group in which to create the Load Balancer. Changing this forces a new resource to be created. -
location
- (Required) Specifies the supported Azure Region where the Load Balancer should be created. Changing this forces a new resource to be created.
-
edgeZone
- (Optional) Specifies the Edge Zone within the Azure Region where this Load Balancer should exist. Changing this forces a new Load Balancer to be created. -
frontendIpConfiguration
- (Optional) One or multiplefrontendIpConfiguration
blocks as documented below. -
sku
- (Optional) The SKU of the Azure Load Balancer. Accepted values arebasic
,standard
andgateway
. Defaults tobasic
. Changing this forces a new resource to be created.
-> NOTE: The microsoftNetwork/allowGatewayLoadBalancer
feature is required to be registered in order to use the gateway
SKU. The feature can only be registered by the Azure service team, please submit an Azure support ticket for that.
skuTier
- (Optional)skuTier
- (Optional) The SKU tier of this Load Balancer. Possible values areglobal
andregional
. Defaults toregional
. Changing this forces a new resource to be created.tags
- (Optional) A mapping of tags to assign to the resource.
The frontendIpConfiguration
block supports the following:
-
name
- (Required) Specifies the name of the frontend IP configuration. -
zones
- (Optional) Specifies a list of Availability Zones in which the IP Address for this Load Balancer should be located.
-> NOTE: Availability Zones are only supported with a Standard SKU and in select regions at this time.
subnetId
- The ID of the Subnet which should be associated with the IP Configuration.gatewayLoadBalancerFrontendIpConfigurationId
- (Optional) The Frontend IP Configuration ID of a Gateway SKU Load Balancer.privateIpAddress
- (Optional) Private IP Address to assign to the Load Balancer. The last one and first four IPs in any range are reserved and cannot be manually assigned.privateIpAddressAllocation
- (Optional) The allocation method for the Private IP Address used by this Load Balancer. Possible values asdynamic
andstatic
.privateIpAddressVersion
- (Optional) The version of IP that the Private IP Address is. Possible values areiPv4
oriPv6
.publicIpAddressId
- (Optional) The ID of a Public IP Address which should be associated with the Load Balancer.publicIpPrefixId
- (Optional) The ID of a Public IP Prefix which should be associated with the Load Balancer. Public IP Prefix can only be used with outbound rules.
Attributes Reference
The following attributes are exported:
id
- The Load Balancer ID.frontendIpConfiguration
- AfrontendIpConfiguration
block as documented below.privateIpAddress
- The first private IP address assigned to the load balancer infrontendIpConfiguration
blocks, if any.privateIpAddresses
- The list of private IP address assigned to the load balancer infrontendIpConfiguration
blocks, if any.
A frontendIpConfiguration
block exports the following:
gatewayLoadBalancerFrontendIpConfigurationId
- The id of the Frontend IP Configuration of a Gateway Load Balancer that this Load Balancer points to.id
- The id of the Frontend IP Configuration.inboundNatRules
- The list of IDs of inbound rules that use this frontend IP.loadBalancerRules
- The list of IDs of load balancing rules that use this frontend IP.outboundRules
- The list of IDs outbound rules that use this frontend IP.privateIpAddress
- Private IP Address to assign to the Load Balancer.privateIpAddressAllocation
- The allocation method for the Private IP Address used by this Load Balancer. Possible values aredynamic
andstatic
.publicIpAddressId
- The ID of a Public IP Address which is associated with this Load Balancer.publicIpPrefixId
- The ID of a Public IP Prefix which is associated with the Load Balancer.subnetId
- The ID of the Subnet which is associated with the IP Configuration.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Load Balancer.update
- (Defaults to 30 minutes) Used when updating the Load Balancer.read
- (Defaults to 5 minutes) Used when retrieving the Load Balancer.delete
- (Defaults to 30 minutes) Used when deleting the Load Balancer.
Import
Load Balancers can be imported using the resourceId
, e.g.