TF - improve wait times EC2/Route53 (#5274)

This commit is contained in:
Bert Blommers 2022-06-28 14:39:50 +00:00 committed by GitHub
parent 4115031594
commit 4d84f84ffc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 96 additions and 18 deletions

View File

@ -10,6 +10,7 @@ PATCH="etc/0001-Patch-Hardcode-endpoints-to-local-server.patch"
(git apply $pwd/etc/0002-EC2-reduce-wait-times.patch > /dev/null 2>&1 && echo "Patched EC2") || echo "Not patching EC2 - Directory was probably already patched."
(git apply $pwd/etc/0003-Patch-IAM-wait-times.patch > /dev/null 2>&1 && echo "Patched IAM") || echo "Not patching IAM - Directory was probably already patched."
(git apply $pwd/etc/0004-DAX-Reduce-wait-times.patch > /dev/null 2>&1 && echo "Patched DAX") || echo "Not patching DAX - Directory was probably already patched."
(git apply $pwd/etc/0005-Route53-Reduce-wait-times.patch > /dev/null 2>&1 && echo "Patched Route53") || echo "Not patching Route53 - Directory was probably already patched."
)
(

View File

@ -552,8 +552,8 @@ index 01e170d231..10bc05b4b6 100644
Timeouts: &schema.ResourceTimeout{
- Create: schema.DefaultTimeout(2 * time.Minute),
- Update: schema.DefaultTimeout(2 * time.Minute),
+ Create: schema.DefaultTimeout(2 * time.Second),
+ Update: schema.DefaultTimeout(2 * time.Second),
+ Create: schema.DefaultTimeout(20 * time.Second),
+ Update: schema.DefaultTimeout(20 * time.Second),
},
//
@ -567,7 +567,7 @@ index 9a0a8151e2..8bcd1eb537 100644
Timeouts: &schema.ResourceTimeout{
- Create: schema.DefaultTimeout(10 * time.Minute),
- Delete: schema.DefaultTimeout(20 * time.Minute),
+ Create: schema.DefaultTimeout(10 * time.Second),
+ Create: schema.DefaultTimeout(20 * time.Second),
+ Delete: schema.DefaultTimeout(20 * time.Second),
},
@ -581,7 +581,7 @@ index bc03d302e0..76ae4c7554 100644
const (
// Maximum amount of time to wait for VPC Endpoint creation
- VPCEndpointCreationTimeout = 10 * time.Minute
+ VPCEndpointCreationTimeout = 10 * time.Second
+ VPCEndpointCreationTimeout = 20 * time.Second
)
func ResourceVPCEndpoint() *schema.Resource {
@ -591,8 +591,8 @@ index bc03d302e0..76ae4c7554 100644
Create: schema.DefaultTimeout(VPCEndpointCreationTimeout),
- Update: schema.DefaultTimeout(10 * time.Minute),
- Delete: schema.DefaultTimeout(10 * time.Minute),
+ Update: schema.DefaultTimeout(10 * time.Second),
+ Delete: schema.DefaultTimeout(10 * time.Second),
+ Update: schema.DefaultTimeout(20 * time.Second),
+ Delete: schema.DefaultTimeout(20 * time.Second),
},
CustomizeDiff: verify.SetTagsDiff,
@ -606,8 +606,8 @@ index 98ba994861..f653423ae1 100644
Timeouts: &schema.ResourceTimeout{
- Create: schema.DefaultTimeout(10 * time.Minute),
- Delete: schema.DefaultTimeout(10 * time.Minute),
+ Create: schema.DefaultTimeout(10 * time.Second),
+ Delete: schema.DefaultTimeout(10 * time.Second),
+ Create: schema.DefaultTimeout(20 * time.Second),
+ Delete: schema.DefaultTimeout(20 * time.Second),
},
}
}
@ -620,7 +620,7 @@ index 5e38bebaca..cf4e397598 100644
Target: []string{ec2.ServiceStateAvailable},
Refresh: vpcEndpointServiceStateRefresh(conn, d.Id()),
- Timeout: 10 * time.Minute,
+ Timeout: 10 * time.Second,
+ Timeout: 20 * time.Second,
Delay: 5 * time.Second,
MinTimeout: 5 * time.Second,
}
@ -629,7 +629,7 @@ index 5e38bebaca..cf4e397598 100644
Target: []string{ec2.ServiceStateDeleted},
Refresh: vpcEndpointServiceStateRefresh(conn, serviceID),
- Timeout: 10 * time.Minute,
+ Timeout: 10 * time.Second,
+ Timeout: 20 * time.Second,
Delay: 5 * time.Second,
MinTimeout: 5 * time.Second,
}
@ -655,7 +655,7 @@ index 793eea6ef2..b9b5b062d1 100644
- Delay: 1 * time.Minute,
- Timeout: 3 * time.Minute,
+ Delay: 1 * time.Second,
+ Timeout: 3 * time.Second,
+ Timeout: 10 * time.Second,
Target: []string{"ok"},
Refresh: func() (interface{}, string, error) {
output, err := conn.ModifyVpcEndpoint(input)
@ -700,9 +700,9 @@ index 7ed8ec448c..d74eef1bc9 100644
- Create: schema.DefaultTimeout(1 * time.Minute),
- Update: schema.DefaultTimeout(1 * time.Minute),
- Delete: schema.DefaultTimeout(1 * time.Minute),
+ Create: schema.DefaultTimeout(1 * time.Second),
+ Update: schema.DefaultTimeout(1 * time.Second),
+ Delete: schema.DefaultTimeout(1 * time.Second),
+ Create: schema.DefaultTimeout(10 * time.Second),
+ Update: schema.DefaultTimeout(10 * time.Second),
+ Delete: schema.DefaultTimeout(10 * time.Second),
},
// Keep in sync with aws_vpc_peering_connection_accepter's schema.
@ -716,8 +716,8 @@ index 5fb1bcb194..2b00ab82d0 100644
Timeouts: &schema.ResourceTimeout{
- Create: schema.DefaultTimeout(1 * time.Minute),
- Update: schema.DefaultTimeout(1 * time.Minute),
+ Create: schema.DefaultTimeout(1 * time.Second),
+ Update: schema.DefaultTimeout(1 * time.Second),
+ Create: schema.DefaultTimeout(10 * time.Second),
+ Update: schema.DefaultTimeout(10 * time.Second),
},
Importer: &schema.ResourceImporter{
@ -733,7 +733,7 @@ index b81c585ac3..5b5eebd83b 100644
- Update: schema.DefaultTimeout(2 * time.Minute),
- Delete: schema.DefaultTimeout(5 * time.Minute),
+ Create: schema.DefaultTimeout(5 * time.Second),
+ Update: schema.DefaultTimeout(2 * time.Second),
+ Update: schema.DefaultTimeout(5 * time.Second),
+ Delete: schema.DefaultTimeout(5 * time.Second),
},
@ -750,7 +750,7 @@ index 5a7b5d36ac..e228b3da4a 100644
- Update: schema.DefaultTimeout(2 * time.Minute),
- Delete: schema.DefaultTimeout(5 * time.Minute),
+ Create: schema.DefaultTimeout(5 * time.Second),
+ Update: schema.DefaultTimeout(2 * time.Second),
+ Update: schema.DefaultTimeout(5 * time.Second),
+ Delete: schema.DefaultTimeout(5 * time.Second),
},

View File

@ -0,0 +1,77 @@
From 455475a4dbd9143605320fbcab748a569efecbcd Mon Sep 17 00:00:00 2001
From: Bert Blommers <info@bertblommers.nl>
Date: Tue, 28 Jun 2022 11:17:35 +0000
Subject: [PATCH] Route53 - wait times
---
internal/service/route53/record.go | 4 ++--
internal/service/route53/wait.go | 6 +++---
internal/service/route53/zone.go | 2 +-
internal/service/route53/zone_association.go | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/internal/service/route53/record.go b/internal/service/route53/record.go
index 689d21387b..771d863a31 100644
--- a/internal/service/route53/record.go
+++ b/internal/service/route53/record.go
@@ -490,8 +490,8 @@ func WaitForRecordSetToSync(conn *route53.Route53, requestId string) error {
Target: []string{route53.ChangeStatusInsync},
Delay: time.Duration(rand.Int63n(recordSetSyncMaxDelay-recordSetSyncMinDelay)+recordSetSyncMinDelay) * time.Second,
MinTimeout: 5 * time.Second,
- PollInterval: 20 * time.Second,
- Timeout: 30 * time.Minute,
+ PollInterval: 5 * time.Second,
+ Timeout: 3 * time.Minute,
Refresh: func() (result interface{}, state string, err error) {
changeRequest := &route53.GetChangeInput{
Id: aws.String(requestId),
diff --git a/internal/service/route53/wait.go b/internal/service/route53/wait.go
index c47a81ef03..98c21e6b8e 100644
--- a/internal/service/route53/wait.go
+++ b/internal/service/route53/wait.go
@@ -13,13 +13,13 @@ import (
)
const (
- changeTimeout = 30 * time.Minute
+ changeTimeout = 3 * time.Minute
changeMinTimeout = 5 * time.Second
- changePollInterval = 15 * time.Second
+ changePollInterval = 5 * time.Second
changeMinDelay = 10
changeMaxDelay = 30
- hostedZoneDNSSECStatusTimeout = 5 * time.Minute
+ hostedZoneDNSSECStatusTimeout = 1 * time.Minute
keySigningKeyStatusTimeout = 5 * time.Minute
diff --git a/internal/service/route53/zone.go b/internal/service/route53/zone.go
index d91b13f953..eed86ef027 100644
--- a/internal/service/route53/zone.go
+++ b/internal/service/route53/zone.go
@@ -698,7 +698,7 @@ func waitForChangeSynchronization(conn *route53.Route53, changeID string) error
Delay: time.Duration(rand.Int63n(zoneChangeSyncMaxDelay-zoneChangeSyncMinDelay)+zoneChangeSyncMinDelay) * time.Second,
MinTimeout: 5 * time.Second,
PollInterval: time.Duration(rand.Int63n(zoneChangeSyncMaxPollInterval-zoneChangeSyncMinPollInterval)+zoneChangeSyncMinPollInterval) * time.Second,
- Timeout: 15 * time.Minute,
+ Timeout: 1 * time.Minute,
Refresh: func() (result interface{}, state string, err error) {
input := &route53.GetChangeInput{
Id: aws.String(changeID),
diff --git a/internal/service/route53/zone_association.go b/internal/service/route53/zone_association.go
index c11188caa9..0103797de7 100644
--- a/internal/service/route53/zone_association.go
+++ b/internal/service/route53/zone_association.go
@@ -84,7 +84,7 @@ func resourceZoneAssociationCreate(d *schema.ResourceData, meta interface{}) err
Delay: 30 * time.Second,
Pending: []string{route53.ChangeStatusPending},
Target: []string{route53.ChangeStatusInsync},
- Timeout: 10 * time.Minute,
+ Timeout: 1 * time.Minute,
MinTimeout: 2 * time.Second,
Refresh: resourceZoneAssociationRefreshFunc(conn, CleanChangeID(aws.StringValue(output.ChangeInfo.Id)), d.Id()),
}
--
2.25.1