Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix validation parameter and style #22418

Merged
merged 3 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:enhancement
rahul-amzn marked this conversation as resolved.
Show resolved Hide resolved
resource/aws_vpc_ipam_pool_cidr_allocation: update validation function range to 0 and 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