From f334e462e2a7548d82f82b22d3a0c225e616e434 Mon Sep 17 00:00:00 2001 From: EC2 Default User Date: Sun, 12 Jun 2022 10:57:34 +0000 Subject: [PATCH 1/4] Initial Commit - for aws internal review --- internal/service/ec2/ipam_pool_cidr.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/service/ec2/ipam_pool_cidr.go b/internal/service/ec2/ipam_pool_cidr.go index bd23ef9ee04..808d2b5b692 100644 --- a/internal/service/ec2/ipam_pool_cidr.go +++ b/internal/service/ec2/ipam_pool_cidr.go @@ -97,8 +97,10 @@ func resourceIPAMPoolCIDRCreate(d *schema.ResourceData, meta interface{}) error cidr := aws.StringValue(output.IpamPoolCidr.Cidr) id := encodeIPAMPoolCIDRId(cidr, pool_id) - if _, err = WaitIPAMPoolCIDRAvailable(conn, id, ipamPoolCIDRCreateTimeout); err != nil { - return fmt.Errorf("error waiting for IPAM Pool Cidr (%s) to be provision: %w", id, err) + v, err := WaitIPAMPoolCIDRAvailable(conn, id, ipamPoolCIDRCreateTimeout) + outval := aws.StringValue(v.FailureReason.Message) + if err != nil { + return fmt.Errorf("error waiting for IPAM Pool Cidr (%s) to be provision: %w", outval, err) } d.SetId(id) From 8decba23ac519ddf1ea0f22975ce4b6eef061515 Mon Sep 17 00:00:00 2001 From: EC2 Default User Date: Mon, 13 Jun 2022 20:44:35 +0000 Subject: [PATCH 2/4] WIP - For Review --- internal/service/ec2/ipam_pool_cidr.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/ec2/ipam_pool_cidr.go b/internal/service/ec2/ipam_pool_cidr.go index 808d2b5b692..9fc4693eaac 100644 --- a/internal/service/ec2/ipam_pool_cidr.go +++ b/internal/service/ec2/ipam_pool_cidr.go @@ -98,8 +98,9 @@ func resourceIPAMPoolCIDRCreate(d *schema.ResourceData, meta interface{}) error id := encodeIPAMPoolCIDRId(cidr, pool_id) v, err := WaitIPAMPoolCIDRAvailable(conn, id, ipamPoolCIDRCreateTimeout) - outval := aws.StringValue(v.FailureReason.Message) + if err != nil { + outval := aws.StringValue(v.FailureReason.Message) return fmt.Errorf("error waiting for IPAM Pool Cidr (%s) to be provision: %w", outval, err) } From 01b8eb783147e0238e343153131da03db381e0b2 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 1 Jul 2022 10:49:41 -0400 Subject: [PATCH 3/4] Add CHANGELOG entry. --- .changelog/25287.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/25287.txt diff --git a/.changelog/25287.txt b/.changelog/25287.txt new file mode 100644 index 00000000000..8a381bdea39 --- /dev/null +++ b/.changelog/25287.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_vpc_ipam_pool_cidr: Better error reporting +``` \ No newline at end of file From e7c6db0dcafe217296733417e5c8b5d088351f01 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 1 Jul 2022 11:00:48 -0400 Subject: [PATCH 4/4] 'TestAccIPAMPool_cidrIPv4Basic' -> 'TestAccIPAMPoolCIDR_basic'. --- internal/service/ec2/ipam_pool_cidr_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ec2/ipam_pool_cidr_test.go b/internal/service/ec2/ipam_pool_cidr_test.go index ed09d68d353..4c8207a2c9f 100644 --- a/internal/service/ec2/ipam_pool_cidr_test.go +++ b/internal/service/ec2/ipam_pool_cidr_test.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/tfresource" ) -func TestAccIPAMPool_cidrIPv4Basic(t *testing.T) { +func TestAccIPAMPoolCIDR_basic(t *testing.T) { var cidr ec2.IpamPoolCidr resourceName := "aws_vpc_ipam_pool_cidr.test" cidr_range := "10.0.0.0/24"