diff --git a/.changelog/22418.txt b/.changelog/22418.txt new file mode 100644 index 00000000000..8c80fcf1302 --- /dev/null +++ b/.changelog/22418.txt @@ -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 +``` \ No newline at end of file diff --git a/internal/service/ec2/vpc_ipam_pool_cidr_allocation.go b/internal/service/ec2/vpc_ipam_pool_cidr_allocation.go index c4fff108ba2..cd54b0c133d 100644 --- a/internal/service/ec2/vpc_ipam_pool_cidr_allocation.go +++ b/internal/service/ec2/vpc_ipam_pool_cidr_allocation.go @@ -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, }, @@ -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": { @@ -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": { @@ -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) @@ -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()) @@ -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{ diff --git a/website/docs/r/vpc_ipam_pool_cidr_allocation.html.markdown b/website/docs/r/vpc_ipam_pool_cidr_allocation.html.markdown index a278dd31c16..070255fad1a 100644 --- a/website/docs/r/vpc_ipam_pool_cidr_allocation.html.markdown +++ b/website/docs/r/vpc_ipam_pool_cidr_allocation.html.markdown @@ -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