From f657dad90c49b5671fd529b4aa09706a6860bbb6 Mon Sep 17 00:00:00 2001 From: Alena Varkockova Date: Wed, 26 Apr 2023 13:16:09 +0200 Subject: [PATCH 1/2] Fix inconsistent read after create for vpc_endpoint_route_table_association --- internal/service/ec2/vpc_endpoint_route_table_association.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/service/ec2/vpc_endpoint_route_table_association.go b/internal/service/ec2/vpc_endpoint_route_table_association.go index 722aef8ec66f..03dc85761e8a 100644 --- a/internal/service/ec2/vpc_endpoint_route_table_association.go +++ b/internal/service/ec2/vpc_endpoint_route_table_association.go @@ -57,7 +57,6 @@ func resourceVPCEndpointRouteTableAssociationCreate(ctx context.Context, d *sche log.Printf("[DEBUG] Creating VPC Endpoint Route Table Association: %s", input) _, err := conn.ModifyVpcEndpointWithContext(ctx, input) - if err != nil { return sdkdiag.AppendErrorf(diags, "creating VPC Endpoint Route Table Association (%s): %s", id, err) } @@ -82,7 +81,9 @@ func resourceVPCEndpointRouteTableAssociationRead(ctx context.Context, d *schema // Human friendly ID for error messages since d.Id() is non-descriptive id := fmt.Sprintf("%s/%s", endpointID, routeTableID) - err := FindVPCEndpointRouteTableAssociationExists(ctx, conn, endpointID, routeTableID) + _, err := tfresource.RetryWhenNewResourceNotFound(ctx, RouteTableAssociationPropagationTimeout, func() (interface{}, error) { + return nil, FindVPCEndpointRouteTableAssociationExists(ctx, conn, endpointID, routeTableID) + }, d.IsNewResource()) if !d.IsNewResource() && tfresource.NotFound(err) { log.Printf("[WARN] VPC Endpoint Route Table Association (%s) not found, removing from state", id) From 3f1945fbbc469ef1ca73a15a0d1f82b3f61a5d25 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 26 Apr 2023 11:34:11 -0400 Subject: [PATCH 2/2] Add CHANGELOG entry. --- .changelog/30994.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/30994.txt diff --git a/.changelog/30994.txt b/.changelog/30994.txt new file mode 100644 index 000000000000..31c204dca833 --- /dev/null +++ b/.changelog/30994.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_vpc_endpoint_route_table_association: Retry resource Create for EC2 eventual consistency +``` \ No newline at end of file