Skip to content

Commit

Permalink
resource/alicloud_alb_acl: modify acl_name to optional
Browse files Browse the repository at this point in the history
  • Loading branch information
shanye997 authored and ChenHanZhang committed Sep 24, 2024
1 parent 56dc53e commit aed7d02
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 1 addition & 3 deletions alicloud/resource_alicloud_alb_acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package alicloud
import (
"fmt"
"log"
"regexp"
"time"

"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
Expand Down Expand Up @@ -56,8 +55,7 @@ func resourceAlicloudAlbAcl() *schema.Resource {
},
"acl_name": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-Z][A-Za-z0-9._-]{2,128}$`), "The name must be `2` to `128` characters in length, and can contain letters, digits, hyphens (-) and underscores (_). It must start with a letter."),
Optional: true,
},
"dry_run": {
Type: schema.TypeBool,
Expand Down
10 changes: 8 additions & 2 deletions alicloud/resource_alicloud_alb_acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func testSweepAlbAcl(region string) error {
return nil
}

func TestAccAlicloudALBAcl_basic0(t *testing.T) {
func TestAccAliCloudALBAcl_basic0(t *testing.T) {
var v map[string]interface{}
resourceId := "alicloud_alb_acl.default"
ra := resourceAttrInit(resourceId, AlicloudALBAclMap0)
Expand All @@ -130,6 +130,12 @@ func TestAccAlicloudALBAcl_basic0(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: rac.checkResourceDestroy(),
Steps: []resource.TestStep{
{
Config: testAccConfig(map[string]interface{}{}),
Check: resource.ComposeTestCheckFunc(
testAccCheck(map[string]string{}),
),
},
{
Config: testAccConfig(map[string]interface{}{
"acl_name": "${var.name}",
Expand Down Expand Up @@ -380,7 +386,7 @@ func TestAccAlicloudALBAcl_basic0(t *testing.T) {
})
}

func TestAccAlicloudALBAcl_basic1(t *testing.T) {
func TestAccAliCloudALBAcl_basic1(t *testing.T) {
var v map[string]interface{}
resourceId := "alicloud_alb_acl.default"
ra := resourceAttrInit(resourceId, AlicloudALBAclMap0)
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/alb_acl.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The following arguments are supported:

* `acl_entries` - (Optional, Deprecated from v1.166.0+) The list of the ACL entries. You can add up to `20` entries in each call. See [`acl_entries`](#acl_entries) below for details.
**NOTE:** "Field 'acl_entries' has been deprecated from provider version 1.166.0 and it will be removed in the future version. Please use the new resource 'alicloud_alb_acl_entry_attachment'.",
* `acl_name` - (Required) The name of the ACL. The name must be `2` to `128` characters in length, and can contain letters, digits, hyphens (-) and underscores (_). It must start with a letter.
* `acl_name` - (Optional) The name of the ACL. The name must be `2` to `128` characters in length, and can contain letters, digits, hyphens (-) and underscores (_). It must start with a letter.
* `dry_run` - (Optional) Specifies whether to precheck the API request.
* `resource_group_id` - (Optional, ForceNew) The ID of the resource group.
* `tags` - (Optional) A mapping of tags to assign to the resource.
Expand Down

0 comments on commit aed7d02

Please sign in to comment.