Skip to content

Commit

Permalink
rename to azurerm_application_load_balancer
Browse files Browse the repository at this point in the history
Signed-off-by: ziyeqf <51212351+ziyeqf@users.noreply.github.com>
  • Loading branch information
ziyeqf committed Aug 24, 2023
1 parent 3ee9ba1 commit 00c7715
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/labeler-issue-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ service/service-fabric-managed-cluster:
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_service_fabric_managed_cluster((.|\n)*)###'

service/service-networking:
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_alb((.|\n)*)###'
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_application_load_balancer((.|\n)*)###'

service/signalr:
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(signalr_s|web_pubsub)((.|\n)*)###'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
)

type ALBResource struct{}
type ApplicationLoadBalancerResource struct{}

type ContainerApplicationGatewayModel struct {
type ApplicationLoadBalancerModel struct {
Name string `tfschema:"name"`
ResourceGroupName string `tfschema:"resource_group_name"`
Location string `tfschema:"location"`
ConfigurationEndpoints []string `tfschema:"configuration_endpoint"`
Tags map[string]string `tfschema:"tags"`
}

var _ sdk.ResourceWithUpdate = ALBResource{}
var _ sdk.ResourceWithUpdate = ApplicationLoadBalancerResource{}

func (t ALBResource) Arguments() map[string]*schema.Schema {
func (t ApplicationLoadBalancerResource) Arguments() map[string]*schema.Schema {
return map[string]*schema.Schema{
"name": {
Type: pluginsdk.TypeString,
Expand All @@ -44,7 +44,7 @@ func (t ALBResource) Arguments() map[string]*schema.Schema {
}
}

func (t ALBResource) Attributes() map[string]*schema.Schema {
func (t ApplicationLoadBalancerResource) Attributes() map[string]*schema.Schema {
return map[string]*schema.Schema{
"configuration_endpoint": {
Type: pluginsdk.TypeList,
Expand All @@ -56,23 +56,23 @@ func (t ALBResource) Attributes() map[string]*schema.Schema {
}
}

func (t ALBResource) ModelObject() interface{} {
return &ContainerApplicationGatewayModel{}
func (t ApplicationLoadBalancerResource) ModelObject() interface{} {
return &ApplicationLoadBalancerModel{}
}

func (t ALBResource) ResourceType() string {
return "azurerm_alb"
func (t ApplicationLoadBalancerResource) ResourceType() string {
return "azurerm_application_load_balancer"
}

func (t ALBResource) IDValidationFunc() pluginsdk.SchemaValidateFunc {
func (t ApplicationLoadBalancerResource) IDValidationFunc() pluginsdk.SchemaValidateFunc {
return trafficcontrollerinterface.ValidateTrafficControllerID
}

func (t ALBResource) Create() sdk.ResourceFunc {
func (t ApplicationLoadBalancerResource) Create() sdk.ResourceFunc {
return sdk.ResourceFunc{
Timeout: 30 * time.Minute,
Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error {
var plan ContainerApplicationGatewayModel
var plan ApplicationLoadBalancerModel
if err := metadata.Decode(&plan); err != nil {
return fmt.Errorf("decoding %v", err)
}
Expand Down Expand Up @@ -108,7 +108,7 @@ func (t ALBResource) Create() sdk.ResourceFunc {
}
}

func (t ALBResource) Read() sdk.ResourceFunc {
func (t ApplicationLoadBalancerResource) Read() sdk.ResourceFunc {
return sdk.ResourceFunc{
Timeout: 5 * time.Minute,
Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error {
Expand All @@ -127,7 +127,7 @@ func (t ALBResource) Read() sdk.ResourceFunc {
return fmt.Errorf("reading %s: %+v", metadata.ResourceData.Id(), err)
}

state := ContainerApplicationGatewayModel{
state := ApplicationLoadBalancerModel{
Name: id.TrafficControllerName,
ResourceGroupName: id.ResourceGroupName,
}
Expand All @@ -146,11 +146,11 @@ func (t ALBResource) Read() sdk.ResourceFunc {
}
}

func (t ALBResource) Update() sdk.ResourceFunc {
func (t ApplicationLoadBalancerResource) Update() sdk.ResourceFunc {
return sdk.ResourceFunc{
Timeout: 30 * time.Minute,
Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error {
var plan ContainerApplicationGatewayModel
var plan ApplicationLoadBalancerModel
if err := metadata.Decode(&plan); err != nil {
return fmt.Errorf("decoding %v", err)
}
Expand Down Expand Up @@ -189,7 +189,7 @@ func (t ALBResource) Update() sdk.ResourceFunc {
}
}

func (t ALBResource) Delete() sdk.ResourceFunc {
func (t ApplicationLoadBalancerResource) Delete() sdk.ResourceFunc {
return sdk.ResourceFunc{
Timeout: 30 * time.Minute,
Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
)

type AlbResource struct{}
type ApplicationLoadBalancerResource struct{}

func (r AlbResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) {
func (r ApplicationLoadBalancerResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) {
id, err := trafficcontrollerinterface.ParseTrafficControllerID(state.ID)
if err != nil {
return nil, fmt.Errorf("while parsing resource ID: %+v", err)
Expand All @@ -33,11 +33,11 @@ func (r AlbResource) Exists(ctx context.Context, clients *clients.Client, state
}

func TestAccServiceNetworkingALB_basic(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_alb", "test")
data := acceptance.BuildTestData(t, "azurerm_application_load_balancer", "test")

// it's available on limited regions.
data.Locations.Primary = "northeurope"
r := AlbResource{}
r := ApplicationLoadBalancerResource{}
data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.basic(data),
Expand All @@ -51,11 +51,11 @@ func TestAccServiceNetworkingALB_basic(t *testing.T) {
}

func TestAccServiceNetworkingALB_complete(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_alb", "test")
data := acceptance.BuildTestData(t, "azurerm_application_load_balancer", "test")

// it's available on limited regions.
data.Locations.Primary = "northeurope"
r := AlbResource{}
r := ApplicationLoadBalancerResource{}
data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.complete(data),
Expand All @@ -69,11 +69,11 @@ func TestAccServiceNetworkingALB_complete(t *testing.T) {
}

func TestAccServiceNetworkingALB_update(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_alb", "test")
data := acceptance.BuildTestData(t, "azurerm_application_load_balancer", "test")

// it's available on limited regions.
data.Locations.Primary = "northeurope"
r := AlbResource{}
r := ApplicationLoadBalancerResource{}
data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.basic(data),
Expand All @@ -94,7 +94,7 @@ func TestAccServiceNetworkingALB_update(t *testing.T) {
})
}

func (r AlbResource) template(data acceptance.TestData) string {
func (r ApplicationLoadBalancerResource) template(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {
Expand All @@ -108,23 +108,23 @@ resource "azurerm_resource_group" "test" {
`, data.RandomInteger, data.Locations.Primary)
}

func (r AlbResource) basic(data acceptance.TestData) string {
func (r ApplicationLoadBalancerResource) basic(data acceptance.TestData) string {
return fmt.Sprintf(`
%s
resource "azurerm_alb" "test" {
resource "azurerm_application_load_balancer" "test" {
name = "acct-%d"
location = "%s"
resource_group_name = azurerm_resource_group.test.name
}
`, r.template(data), data.RandomInteger, data.Locations.Primary)
}

func (r AlbResource) complete(data acceptance.TestData) string {
func (r ApplicationLoadBalancerResource) complete(data acceptance.TestData) string {
return fmt.Sprintf(`
%s
resource "azurerm_alb" "test" {
resource "azurerm_application_load_balancer" "test" {
name = "acct-%d"
location = "%s"
resource_group_name = azurerm_resource_group.test.name
Expand Down
2 changes: 1 addition & 1 deletion internal/services/servicenetworking/registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (r Registration) DataSources() []sdk.DataSource {

func (r Registration) Resources() []sdk.Resource {
return []sdk.Resource{
ALBResource{},
ApplicationLoadBalancerResource{},
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
subcategory: "Service Networking"
layout: "azurerm"
page_title: "Azure Resource Manager: azurerm_alb"
page_title: "Azure Resource Manager: azurerm_application_load_balancer"
description: |-
Manages an Application Load Balancer.
Manages an Application Gateway for Containers (ALB).
---

# azurerm_alb

Manages an Application Load Balancer.
Manages an Application Gateway for Containers (ALB).

## Example Usage

```hcl
resource "azurerm_alb" "example" {
resource "azurerm_application_load_balancer" "example" {
name = "example"
resource_group_name = "example"
location = "West Europe"
Expand All @@ -24,11 +24,11 @@ resource "azurerm_alb" "example" {

The following arguments are supported:

* `name` - (Required) The name which should be used for this Application Load Balancer. Changing this forces a new Application Load Balancer to be created.
* `name` - (Required) The name which should be used for this resource. Changing this forces a new resource to be created.

* `resource_group_name` - (Required) The name of the Resource Group where the Application Load Balancer should exist. Changing this forces a new Application Load Balancer to be created.
* `resource_group_name` - (Required) The name of the Resource Group where the resource should exist. Changing this forces a new resource to be created.

* `location` - (Required) The Azure Region where the Application Load Balancer should exist. Changing this forces a new Application Load Balancer to be created.
* `location` - (Required) The Azure Region where the resource should exist. Changing this forces a new resource to be created.

**Note:** The available values of `location` are `northeurope` and `north central us`.

Expand All @@ -40,9 +40,9 @@ The following arguments are supported:

In addition to the Arguments listed above - the following Attributes are exported:

* `id` - The ID of the Application Load Balancer.
* `id` - The ID of the resource.

* `configuration_endpoint` - The list of configuration endpoints for the Application Load Balancer.
* `configuration_endpoint` - The list of configuration endpoints for the resource.

## Timeouts

Expand All @@ -55,8 +55,8 @@ The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/l

## Import

Application Load Balancers can be imported using the `resource id`, e.g.
Application Gateway for Containers (ALB) can be imported using the `resource id`, e.g.

```shell
terraform import azurerm_alb.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ServiceNetworking/trafficControllers/alb1
terraform import azurerm_application_load_balancer.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ServiceNetworking/trafficControllers/alb1
```

0 comments on commit 00c7715

Please sign in to comment.