Skip to content

Commit

Permalink
Merge pull request #22418 from rahul-amzn/f-ipam-update-validation
Browse files Browse the repository at this point in the history
fix validation parameter and style
  • Loading branch information
ewbankkit authored Jan 5, 2022
2 parents ae22c9b + 654b361 commit de66027
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .changelog/22418.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_vpc_ipam_pool_cidr_allocation: update `cidr` and `netmask_length` attributes netmask to a minimum of 0 and maximum of 32
```
18 changes: 9 additions & 9 deletions internal/service/ec2/vpc_ipam_pool_cidr_allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (

func ResourceVPCIpamPoolCidrAllocation() *schema.Resource {
return &schema.Resource{
Create: ResourceVPCIpamPoolCidrAllocationCreate,
Read: ResourceVPCIpamPoolCidrAllocationRead,
Delete: ResourceVPCIpamPoolCidrAllocationDelete,
Create: resourceVPCIpamPoolCidrAllocationCreate,
Read: resourceVPCIpamPoolCidrAllocationRead,
Delete: resourceVPCIpamPoolCidrAllocationDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Expand All @@ -32,7 +32,7 @@ func ResourceVPCIpamPoolCidrAllocation() *schema.Resource {
ConflictsWith: []string{"netmask_length"},
ValidateFunc: validation.Any(
verify.ValidIPv4CIDRNetworkAddress,
validation.IsCIDRNetwork(VPCCIDRMinIPv4, VPCCIDRMaxIPv4),
validation.IsCIDRNetwork(0, 32),
),
},
"description": {
Expand All @@ -53,7 +53,7 @@ func ResourceVPCIpamPoolCidrAllocation() *schema.Resource {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
ValidateFunc: validation.IntBetween(VPCCIDRMinIPv4, VPCCIDRMaxIPv4),
ValidateFunc: validation.IntBetween(0, 32),
ConflictsWith: []string{"cidr"},
},
"resource_id": {
Expand All @@ -76,7 +76,7 @@ const (
IpamPoolAllocationNotFound = "InvalidIpamPoolCidrAllocationId.NotFound"
)

func ResourceVPCIpamPoolCidrAllocationCreate(d *schema.ResourceData, meta interface{}) error {
func resourceVPCIpamPoolCidrAllocationCreate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*conns.AWSClient).EC2Conn
pool_id := d.Get("ipam_pool_id").(string)

Expand Down Expand Up @@ -104,10 +104,10 @@ func ResourceVPCIpamPoolCidrAllocationCreate(d *schema.ResourceData, meta interf
}
d.SetId(encodeIpamPoolCidrAllocationID(aws.StringValue(output.IpamPoolAllocation.IpamPoolAllocationId), pool_id))

return ResourceVPCIpamPoolCidrAllocationRead(d, meta)
return resourceVPCIpamPoolCidrAllocationRead(d, meta)
}

func ResourceVPCIpamPoolCidrAllocationRead(d *schema.ResourceData, meta interface{}) error {
func resourceVPCIpamPoolCidrAllocationRead(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*conns.AWSClient).EC2Conn

cidr_allocation, pool_id, err := FindIpamPoolCidrAllocation(conn, d.Id())
Expand Down Expand Up @@ -140,7 +140,7 @@ func ResourceVPCIpamPoolCidrAllocationRead(d *schema.ResourceData, meta interfac
return nil
}

func ResourceVPCIpamPoolCidrAllocationDelete(d *schema.ResourceData, meta interface{}) error {
func resourceVPCIpamPoolCidrAllocationDelete(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*conns.AWSClient).EC2Conn

input := &ec2.ReleaseIpamPoolAllocationInput{
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/vpc_ipam_pool_cidr_allocation.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The following arguments are supported:
* `cidr` - (Optional) The CIDR you want to assign to the pool.
* `description` - (Optional) The description for the allocation.
* `ipam_pool_id` - (Required) The ID of the pool to which you want to assign a CIDR.
* `netmask_length` - (Optional) The netmask length of the CIDR you would like to allocate to the IPAM pool.
* `netmask_length` - (Optional) The netmask length of the CIDR you would like to allocate to the IPAM pool. Valid Values: `0-32`.

## Attributes Reference

Expand Down

0 comments on commit de66027

Please sign in to comment.