diff --git a/moto/autoscaling/models.py b/moto/autoscaling/models.py index 25b1dace1..be9c6bae2 100644 --- a/moto/autoscaling/models.py +++ b/moto/autoscaling/models.py @@ -149,6 +149,10 @@ class FakeLaunchConfiguration(CloudFormationModel): self.spot_price = spot_price self.ebs_optimized = ebs_optimized self.associate_public_ip_address = associate_public_ip_address + if isinstance(associate_public_ip_address, str): + self.associate_public_ip_address = ( + associate_public_ip_address.lower() == "true" + ) self.block_device_mapping_dict = block_device_mapping_dict self.metadata_options = metadata_options self.classic_link_vpc_id = classic_link_vpc_id @@ -323,7 +327,7 @@ class FakeAutoScalingGroup(CloudFormationModel): self.load_balancers = load_balancers self.target_group_arns = target_group_arns self.placement_group = placement_group - self.termination_policies = termination_policies + self.termination_policies = termination_policies or ["Default"] self.new_instances_protected_from_scale_in = ( new_instances_protected_from_scale_in ) @@ -333,6 +337,8 @@ class FakeAutoScalingGroup(CloudFormationModel): self.tags = tags or [] self.set_desired_capacity(desired_capacity) + self.metrics = [] + @property def tags(self): return self._tags @@ -624,6 +630,17 @@ class FakeAutoScalingGroup(CloudFormationModel): def replace_autoscaling_group_instances(self, count_needed, propagated_tags): propagated_tags[ASG_NAME_TAG] = self.name + # VPCZoneIdentifier: + # A comma-separated list of subnet IDs for a virtual private cloud (VPC) where instances in the Auto Scaling group can be created. + # We'll create all instances in a single subnet to make things easier + subnet_id = ( + self.vpc_zone_identifier.split(",")[0] if self.vpc_zone_identifier else None + ) + associate_public_ip = ( + self.launch_config.associate_public_ip_address + if self.launch_config + else None + ) reservation = self.autoscaling_backend.ec2_backend.add_instances( self.image_id, count_needed, @@ -634,6 +651,8 @@ class FakeAutoScalingGroup(CloudFormationModel): placement=random.choice(self.availability_zones), launch_config=self.launch_config, is_instance_type_default=False, + associate_public_ip=associate_public_ip, + subnet_id=subnet_id, ) for instance in reservation.instances: instance.autoscaling_group = self @@ -648,6 +667,9 @@ class FakeAutoScalingGroup(CloudFormationModel): append = [x for x in target_group_arns if x not in self.target_group_arns] self.target_group_arns.extend(append) + def enable_metrics_collection(self, metrics): + self.metrics = metrics or [] + class AutoScalingBackend(BaseBackend): def __init__(self, region_name, account_id): @@ -859,7 +881,7 @@ class AutoScalingBackend(BaseBackend): ) return group - def describe_auto_scaling_groups(self, names): + def describe_auto_scaling_groups(self, names) -> [FakeAutoScalingGroup]: groups = self.autoscaling_groups.values() if names: return [group for group in groups if group.name in names] @@ -1267,5 +1289,9 @@ class AutoScalingBackend(BaseBackend): ] return tags + def enable_metrics_collection(self, group_name, metrics): + group = self.describe_auto_scaling_groups([group_name])[0] + group.enable_metrics_collection(metrics) + autoscaling_backends = BackendDict(AutoScalingBackend, "autoscaling") diff --git a/moto/autoscaling/responses.py b/moto/autoscaling/responses.py index cdfcc3444..aee9c00fc 100644 --- a/moto/autoscaling/responses.py +++ b/moto/autoscaling/responses.py @@ -439,6 +439,13 @@ class AutoScalingResponse(BaseResponse): template = self.response_template(DESCRIBE_TAGS_TEMPLATE) return template.render(tags=tags, next_token=None) + def enable_metrics_collection(self): + group_name = self._get_param("AutoScalingGroupName") + metrics = self._get_params().get("Metrics") + self.autoscaling_backend.enable_metrics_collection(group_name, metrics) + template = self.response_template(ENABLE_METRICS_COLLECTION_TEMPLATE) + return template.render() + CREATE_LAUNCH_CONFIGURATION_TEMPLATE = """ @@ -666,7 +673,6 @@ DESCRIBE_AUTOSCALING_GROUPS_TEMPLATE = """{{ group.name }} {{ group.health_check_type }} 2013-05-06T17:47:15.107Z - {% if group.launch_config_name %} {{ group.launch_config_name }} {% elif group.launch_template %} @@ -744,6 +750,16 @@ DESCRIBE_AUTOSCALING_GROUPS_TEMPLATE = """{{ group.placement_group }} {% endif %} {{ group.new_instances_protected_from_scale_in|string|lower }} + {% if group.metrics %} + + {% for met in group.metrics %} + + {{ met }} + 1Minute + + {% endfor %} + + {% endif %} {% endfor %} @@ -1219,3 +1235,10 @@ DESCRIBE_TAGS_TEMPLATE = """ + + + +""" diff --git a/moto/ec2/models/instances.py b/moto/ec2/models/instances.py index 5cd65990d..9424699b2 100644 --- a/moto/ec2/models/instances.py +++ b/moto/ec2/models/instances.py @@ -62,6 +62,7 @@ class Instance(TaggedEC2Resource, BotoInstance, CloudFormationModel): "groupSet", "ebsOptimized", "sriovNetSupport", + "disableApiStop", } def __init__(self, ec2_backend, image_id, user_data, security_groups, **kwargs): @@ -134,6 +135,7 @@ class Instance(TaggedEC2Resource, BotoInstance, CloudFormationModel): self.virtualization_type = ami.virtualization_type if ami else "paravirtual" self.architecture = ami.architecture if ami else "x86_64" self.root_device_name = ami.root_device_name if ami else None + self.disable_api_stop = False # handle weird bug around user_data -- something grabs the repr(), so # it must be clean @@ -543,7 +545,7 @@ class InstanceBackend: def __init__(self): self.reservations = OrderedDict() - def get_instance(self, instance_id): + def get_instance(self, instance_id) -> Instance: for instance in self.all_instances(): if instance.id == instance_id: return instance diff --git a/tests/terraformtests/etc/0001-Patch-Hardcode-endpoints-to-local-server.patch b/tests/terraformtests/etc/0001-Patch-Hardcode-endpoints-to-local-server.patch index 4abff23e9..ca32abf4b 100644 --- a/tests/terraformtests/etc/0001-Patch-Hardcode-endpoints-to-local-server.patch +++ b/tests/terraformtests/etc/0001-Patch-Hardcode-endpoints-to-local-server.patch @@ -1,26 +1,26 @@ -From ca8880871b241df7bdc9ea3cf0d13f816e815f16 Mon Sep 17 00:00:00 2001 +From 64093955e96cff42a797880b4a6921663af6040d Mon Sep 17 00:00:00 2001 From: Bert Blommers -Date: Wed, 13 Apr 2022 12:33:25 +0000 -Subject: [PATCH] Patch: Hardcode endpoints to local server +Date: Sun, 19 Jun 2022 19:32:26 +0000 +Subject: [PATCH] Patch: Hardcode endpoints --- - internal/conns/conns.go | 14 ++++++++++++++ + internal/conns/config.go | 15 +++++++++++++++ internal/provider/provider.go | 2 +- - 2 files changed, 15 insertions(+), 1 deletion(-) + 2 files changed, 16 insertions(+), 1 deletion(-) -diff --git a/internal/conns/conns.go b/internal/conns/conns.go -index 1feb0be2f1..9ed8a64776 100644 ---- a/internal/conns/conns.go -+++ b/internal/conns/conns.go -@@ -628,6 +628,16 @@ func (client *AWSClient) RegionalHostname(prefix string) string { - return fmt.Sprintf("%s.%s.%s", prefix, client.Region, client.DNSSuffix) +diff --git a/internal/conns/config.go b/internal/conns/config.go +index 7bfd3100fd..b59083068a 100644 +--- a/internal/conns/config.go ++++ b/internal/conns/config.go +@@ -78,8 +78,23 @@ type Config struct { + UseFIPSEndpoint bool } - + +// XXX: added by bblommers +func GetLocalEndpoints() map[string]string { + const localEndpoint = "http://localhost:4566" + var localEndpoints = map[string]string{} -+ for _, name := range names.HCLKeys() { ++ for _, name := range names.Aliases() { + localEndpoints[name] = localEndpoint + } + return localEndpoints @@ -28,23 +28,19 @@ index 1feb0be2f1..9ed8a64776 100644 + // Client configures and returns a fully initialized AWSClient func (c *Config) Client(ctx context.Context) (interface{}, diag.Diagnostics) { - awsbaseConfig := awsbase.Config{ -@@ -727,6 +737,10 @@ func (c *Config) Client(ctx context.Context) (interface{}, diag.Diagnostics) { - DNSSuffix = p.DNSSuffix() - } - -+ // XXX: added by bblommers -+ // insert custom endpoints -+ c.Endpoints = GetLocalEndpoints() + - client := &AWSClient{ - AccessAnalyzerConn: accessanalyzer.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints[names.AccessAnalyzer])})), - AccountConn: account.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints[names.Account])})), ++ // XXX: added by bblommers ++ // insert custom endpoints ++ c.Endpoints = GetLocalEndpoints() ++ + awsbaseConfig := awsbase.Config{ + AccessKey: c.AccessKey, + APNInfo: StdUserAgentProducts(c.TerraformVersion), diff --git a/internal/provider/provider.go b/internal/provider/provider.go -index df93e4b5c5..da009a9e4c 100644 +index 7e6200d9ac..7005caccd3 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go -@@ -2011,7 +2011,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, terraformVer +@@ -2082,7 +2082,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, terraformVer CustomCABundle: d.Get("custom_ca_bundle").(string), EC2MetadataServiceEndpoint: d.Get("ec2_metadata_service_endpoint").(string), EC2MetadataServiceEndpointMode: d.Get("ec2_metadata_service_endpoint_mode").(string), diff --git a/tests/terraformtests/etc/0002-EC2-reduce-wait-times.patch b/tests/terraformtests/etc/0002-EC2-reduce-wait-times.patch index ef599e580..49435d728 100644 --- a/tests/terraformtests/etc/0002-EC2-reduce-wait-times.patch +++ b/tests/terraformtests/etc/0002-EC2-reduce-wait-times.patch @@ -1,67 +1,52 @@ -From 23e30bd79328ae023a0a7c68cddaa891abf4c38e Mon Sep 17 00:00:00 2001 +From 7074c7dbf89a9aa796fbdc4a5132fca6b4bf5598 Mon Sep 17 00:00:00 2001 From: Bert Blommers -Date: Fri, 15 Apr 2022 19:04:54 +0000 -Subject: [PATCH] EC2 - reduce wait times +Date: Sun, 19 Jun 2022 19:37:57 +0000 +Subject: [PATCH] EC2: Reduce wait times --- - internal/service/ec2/ami.go | 4 +-- - internal/service/ec2/create_tags_gen.go | 2 +- - internal/service/ec2/default_route_table.go | 4 +-- - internal/service/ec2/default_subnet.go | 4 +-- - internal/service/ec2/ebs_snapshot_import.go | 4 +-- - internal/service/ec2/ebs_volume.go | 4 +-- - internal/service/ec2/eip.go | 8 +++--- - internal/service/ec2/eip_test.go | 2 +- - internal/service/ec2/fleet.go | 6 ++-- - .../service/ec2/generate/createtags/main.go | 2 +- - internal/service/ec2/instance.go | 2 +- - internal/service/ec2/local_gateway_route.go | 2 +- - internal/service/ec2/route.go | 4 +-- - internal/service/ec2/route_table.go | 6 ++-- - internal/service/ec2/route_table_test.go | 2 +- - internal/service/ec2/security_group.go | 4 +-- - internal/service/ec2/security_group_rule.go | 2 +- - .../ec2/snapshot_create_volume_permission.go | 4 +-- - internal/service/ec2/spot_fleet_request.go | 6 ++-- - internal/service/ec2/spot_instance_request.go | 4 +-- - internal/service/ec2/subnet.go | 4 +-- - internal/service/ec2/transit_gateway.go | 28 +++++++++---------- - .../service/ec2/transit_gateway_connect.go | 6 ++-- - .../ec2/transit_gateway_connect_peer.go | 4 +-- - .../ec2/transit_gateway_multicast_domain.go | 4 +-- - ...it_gateway_multicast_domain_association.go | 4 +-- - internal/service/ec2/volume_attachment.go | 6 ++-- - .../service/ec2/volume_attachment_test.go | 2 +- - internal/service/ec2/vpc_endpoint.go | 6 ++-- - internal/service/ec2/vpc_endpoint_policy.go | 4 +-- - internal/service/ec2/vpc_endpoint_service.go | 4 +-- - internal/service/ec2/vpc_ipam.go | 4 +-- - internal/service/ec2/vpc_ipam_pool.go | 6 ++-- - internal/service/ec2/vpc_ipam_pool_cidr.go | 4 +-- - internal/service/ec2/vpc_ipam_scope.go | 4 +-- - .../ec2/vpc_ipv4_cidr_block_association.go | 4 +-- - .../ec2/vpc_ipv6_cidr_block_association.go | 4 +-- - .../service/ec2/vpc_peering_connection.go | 6 ++-- - .../ec2/vpc_peering_connection_accepter.go | 4 +-- - .../ec2/vpn_gateway_route_propagation.go | 4 +-- - internal/service/ec2/wait.go | 20 ++++++------- - 41 files changed, 104 insertions(+), 104 deletions(-) + internal/service/ec2/create_tags_gen.go | 2 +- + internal/service/ec2/ebs_snapshot.go | 4 +- + internal/service/ec2/ebs_snapshot_copy.go | 4 +- + .../ebs_snapshot_create_volume_permission.go | 4 +- + internal/service/ec2/ebs_snapshot_import.go | 4 +- + internal/service/ec2/ebs_volume.go | 6 +- + internal/service/ec2/ebs_volume_attachment.go | 4 +- + internal/service/ec2/ec2_ami.go | 4 +- + internal/service/ec2/ec2_eip.go | 8 +- + internal/service/ec2/ec2_fleet.go | 6 +- + internal/service/ec2/ec2_instance.go | 6 +- + .../service/ec2/ec2_spot_fleet_request.go | 6 +- + .../ec2/ec2_spot_fleet_request_test.go | 2 +- + .../service/ec2/ec2_spot_instance_request.go | 4 +- + .../service/ec2/generate/createtags/main.go | 2 +- + internal/service/ec2/ipam_.go | 4 +- + internal/service/ec2/ipam_pool.go | 6 +- + internal/service/ec2/ipam_pool_cidr.go | 4 +- + internal/service/ec2/ipam_scope.go | 4 +- + .../ec2/outposts_local_gateway_route.go | 2 +- + internal/service/ec2/transitgateway_.go | 28 ++-- + .../service/ec2/transitgateway_connect.go | 6 +- + .../ec2/transitgateway_connect_peer.go | 4 +- + .../ec2/transitgateway_multicast_domain.go | 4 +- + ...sitgateway_multicast_domain_association.go | 4 +- + .../service/ec2/vpc_default_route_table.go | 4 +- + internal/service/ec2/vpc_default_subnet.go | 4 +- + internal/service/ec2/vpc_endpoint.go | 6 +- + internal/service/ec2/vpc_endpoint_policy.go | 4 +- + internal/service/ec2/vpc_endpoint_service.go | 4 +- + .../ec2/vpc_endpoint_subnet_association.go | 8 +- + .../ec2/vpc_ipv4_cidr_block_association.go | 4 +- + .../ec2/vpc_ipv6_cidr_block_association.go | 4 +- + .../service/ec2/vpc_peering_connection.go | 6 +- + .../ec2/vpc_peering_connection_accepter.go | 4 +- + internal/service/ec2/vpc_route.go | 6 +- + internal/service/ec2/vpc_route_table.go | 6 +- + internal/service/ec2/vpc_security_group.go | 6 +- + internal/service/ec2/vpc_subnet.go | 4 +- + .../ec2/vpnsite_gateway_route_propagation.go | 4 +- + internal/service/ec2/wait.go | 128 +++++++++--------- + 41 files changed, 167 insertions(+), 167 deletions(-) -diff --git a/internal/service/ec2/ami.go b/internal/service/ec2/ami.go -index 1a6fb3a67f..19d022732d 100644 ---- a/internal/service/ec2/ami.go -+++ b/internal/service/ec2/ami.go -@@ -23,8 +23,8 @@ import ( - ) - - const ( -- AWSAMIRetryTimeout = 40 * time.Minute -- AMIDeleteRetryTimeout = 90 * time.Minute -+ AWSAMIRetryTimeout = 40 * time.Second -+ AMIDeleteRetryTimeout = 90 * time.Second - AWSAMIRetryDelay = 5 * time.Second - AMIRetryMinTimeout = 3 * time.Second - ) diff --git a/internal/service/ec2/create_tags_gen.go b/internal/service/ec2/create_tags_gen.go index dede4649b4..c6d8d8db4e 100644 --- a/internal/service/ec2/create_tags_gen.go @@ -69,95 +54,135 @@ index dede4649b4..c6d8d8db4e 100644 @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/tfresource" ) - + -const EventualConsistencyTimeout = 5 * time.Minute +const EventualConsistencyTimeout = 5 * time.Second - + // CreateTags creates ec2 service tags for new resources. // The identifier is typically the Amazon Resource Name (ARN), although -diff --git a/internal/service/ec2/default_route_table.go b/internal/service/ec2/default_route_table.go -index 8fde169f64..bdc4104d07 100644 ---- a/internal/service/ec2/default_route_table.go -+++ b/internal/service/ec2/default_route_table.go -@@ -27,8 +27,8 @@ func ResourceDefaultRouteTable() *schema.Resource { - }, - - 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), - }, - - // -diff --git a/internal/service/ec2/default_subnet.go b/internal/service/ec2/default_subnet.go -index d3026f0cb9..954e64cda3 100644 ---- a/internal/service/ec2/default_subnet.go -+++ b/internal/service/ec2/default_subnet.go -@@ -30,8 +30,8 @@ func ResourceDefaultSubnet() *schema.Resource { +diff --git a/internal/service/ec2/ebs_snapshot.go b/internal/service/ec2/ebs_snapshot.go +index 38ecbd73ea..576203732e 100644 +--- a/internal/service/ec2/ebs_snapshot.go ++++ b/internal/service/ec2/ebs_snapshot.go +@@ -31,8 +31,8 @@ func ResourceEBSSnapshot() *schema.Resource { CustomizeDiff: verify.SetTagsDiff, - + Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(10 * time.Minute), -- Delete: schema.DefaultTimeout(20 * time.Minute), +- Delete: schema.DefaultTimeout(10 * time.Minute), + Create: schema.DefaultTimeout(10 * time.Second), -+ Delete: schema.DefaultTimeout(20 * time.Second), ++ Delete: schema.DefaultTimeout(10 * time.Second), }, - - SchemaVersion: 1, + + Schema: map[string]*schema.Schema{ +diff --git a/internal/service/ec2/ebs_snapshot_copy.go b/internal/service/ec2/ebs_snapshot_copy.go +index a1fccab1b9..0894e9f87b 100644 +--- a/internal/service/ec2/ebs_snapshot_copy.go ++++ b/internal/service/ec2/ebs_snapshot_copy.go +@@ -24,8 +24,8 @@ func ResourceEBSSnapshotCopy() *schema.Resource { + CustomizeDiff: verify.SetTagsDiff, + + 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), + }, + + Schema: map[string]*schema.Schema{ +diff --git a/internal/service/ec2/ebs_snapshot_create_volume_permission.go b/internal/service/ec2/ebs_snapshot_create_volume_permission.go +index f5e205f7b7..ffd26a66b5 100644 +--- a/internal/service/ec2/ebs_snapshot_create_volume_permission.go ++++ b/internal/service/ec2/ebs_snapshot_create_volume_permission.go +@@ -24,8 +24,8 @@ func ResourceSnapshotCreateVolumePermission() *schema.Resource { + CustomizeDiff: resourceSnapshotCreateVolumePermissionCustomizeDiff, + + Timeouts: &schema.ResourceTimeout{ +- Create: schema.DefaultTimeout(20 * time.Minute), +- Delete: schema.DefaultTimeout(5 * time.Minute), ++ Create: schema.DefaultTimeout(20 * time.Second), ++ Delete: schema.DefaultTimeout(5 * time.Second), + }, + + Schema: map[string]*schema.Schema{ diff --git a/internal/service/ec2/ebs_snapshot_import.go b/internal/service/ec2/ebs_snapshot_import.go -index cb53fe95dc..513110e656 100644 +index e2f487a7bc..eca3c7be12 100644 --- a/internal/service/ec2/ebs_snapshot_import.go +++ b/internal/service/ec2/ebs_snapshot_import.go @@ -27,8 +27,8 @@ func ResourceEBSSnapshotImport() *schema.Resource { CustomizeDiff: verify.SetTagsDiff, - + Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(60 * time.Minute), - Delete: schema.DefaultTimeout(10 * time.Minute), + Create: schema.DefaultTimeout(60 * time.Second), + Delete: schema.DefaultTimeout(10 * time.Second), }, - + Schema: map[string]*schema.Schema{ diff --git a/internal/service/ec2/ebs_volume.go b/internal/service/ec2/ebs_volume.go -index 6c2547cf06..eb01f1cedc 100644 +index 4fbdfb3ba7..e284717ee6 100644 --- a/internal/service/ec2/ebs_volume.go +++ b/internal/service/ec2/ebs_volume.go -@@ -154,7 +154,7 @@ func resourceEBSVolumeCreate(d *schema.ResourceData, meta interface{}) error { - Pending: []string{ec2.VolumeStateCreating}, - Target: []string{ec2.VolumeStateAvailable}, - Refresh: volumeStateRefreshFunc(conn, *result.VolumeId), -- Timeout: 5 * time.Minute, -+ Timeout: 5 * time.Second, - Delay: 10 * time.Second, - MinTimeout: 3 * time.Second, - } -@@ -207,7 +207,7 @@ func resourceEBSVolumeUpdate(d *schema.ResourceData, meta interface{}) error { - Pending: []string{ec2.VolumeStateCreating, ec2.VolumeModificationStateModifying}, - Target: []string{ec2.VolumeStateAvailable, ec2.VolumeStateInUse}, - Refresh: volumeStateRefreshFunc(conn, *result.VolumeModification.VolumeId), -- Timeout: 5 * time.Minute, -+ Timeout: 5 * time.Second, - Delay: 10 * time.Second, - MinTimeout: 3 * time.Second, - } -diff --git a/internal/service/ec2/eip.go b/internal/service/ec2/eip.go -index 31dec43d63..e9c1d8bd43 100644 ---- a/internal/service/ec2/eip.go -+++ b/internal/service/ec2/eip.go +@@ -31,9 +31,9 @@ func ResourceEBSVolume() *schema.Resource { + }, + + Timeouts: &schema.ResourceTimeout{ +- Create: schema.DefaultTimeout(5 * time.Minute), +- Update: schema.DefaultTimeout(5 * time.Minute), +- Delete: schema.DefaultTimeout(5 * time.Minute), ++ Create: schema.DefaultTimeout(5 * time.Second), ++ Update: schema.DefaultTimeout(5 * time.Second), ++ Delete: schema.DefaultTimeout(5 * time.Second), + }, + + CustomizeDiff: customdiff.Sequence( +diff --git a/internal/service/ec2/ebs_volume_attachment.go b/internal/service/ec2/ebs_volume_attachment.go +index 410c3b5107..0b31e4e618 100644 +--- a/internal/service/ec2/ebs_volume_attachment.go ++++ b/internal/service/ec2/ebs_volume_attachment.go +@@ -43,8 +43,8 @@ func ResourceVolumeAttachment() *schema.Resource { + }, + + Timeouts: &schema.ResourceTimeout{ +- Create: schema.DefaultTimeout(5 * time.Minute), +- Delete: schema.DefaultTimeout(5 * time.Minute), ++ Create: schema.DefaultTimeout(5 * time.Second), ++ Delete: schema.DefaultTimeout(5 * time.Second), + }, + + Schema: map[string]*schema.Schema{ +diff --git a/internal/service/ec2/ec2_ami.go b/internal/service/ec2/ec2_ami.go +index f2d401ce3d..ef399c8ce6 100644 +--- a/internal/service/ec2/ec2_ami.go ++++ b/internal/service/ec2/ec2_ami.go +@@ -22,8 +22,8 @@ import ( + ) + + const ( +- amiRetryTimeout = 40 * time.Minute +- amiDeleteTimeout = 90 * time.Minute ++ amiRetryTimeout = 40 * time.Second ++ amiDeleteTimeout = 90 * time.Second + amiRetryDelay = 5 * time.Second + amiRetryMinTimeout = 3 * time.Second + ) +diff --git a/internal/service/ec2/ec2_eip.go b/internal/service/ec2/ec2_eip.go +index aac7e3119c..300c97092e 100644 +--- a/internal/service/ec2/ec2_eip.go ++++ b/internal/service/ec2/ec2_eip.go @@ -21,7 +21,7 @@ import ( - + const ( // Maximum amount of time to wait for EIP association with EC2-Classic instances -- ec2AddressAssociationClassicTimeout = 2 * time.Minute -+ ec2AddressAssociationClassicTimeout = 2 * time.Second +- addressAssociationClassicTimeout = 2 * time.Minute ++ addressAssociationClassicTimeout = 2 * time.Second ) - + func ResourceEIP() *schema.Resource { @@ -37,9 +37,9 @@ func ResourceEIP() *schema.Resource { CustomizeDiff: verify.SetTagsDiff, - + Timeouts: &schema.ResourceTimeout{ - Read: schema.DefaultTimeout(15 * time.Minute), - Update: schema.DefaultTimeout(5 * time.Minute), @@ -166,28 +191,15 @@ index 31dec43d63..e9c1d8bd43 100644 + Update: schema.DefaultTimeout(5 * time.Second), + Delete: schema.DefaultTimeout(3 * time.Second), }, - + Schema: map[string]*schema.Schema{ -diff --git a/internal/service/ec2/eip_test.go b/internal/service/ec2/eip_test.go -index f65dc47d20..2e939e2286 100644 ---- a/internal/service/ec2/eip_test.go -+++ b/internal/service/ec2/eip_test.go -@@ -771,7 +771,7 @@ func testAccCheckEIPExists(n string, ec2classic bool, res *ec2.Address) resource - - var output *ec2.DescribeAddressesOutput - -- err := resource.Retry(15*time.Minute, func() *resource.RetryError { -+ err := resource.Retry(15*time.Second, func() *resource.RetryError { - var err error - - output, err = conn.DescribeAddresses(input) -diff --git a/internal/service/ec2/fleet.go b/internal/service/ec2/fleet.go -index 7f9133b4ff..48789a97e8 100644 ---- a/internal/service/ec2/fleet.go -+++ b/internal/service/ec2/fleet.go -@@ -29,9 +29,9 @@ func ResourceFleet() *schema.Resource { - - CustomizeDiff: verify.SetTagsDiff, +diff --git a/internal/service/ec2/ec2_fleet.go b/internal/service/ec2/ec2_fleet.go +index b4c4e161d3..c7cc4b394d 100644 +--- a/internal/service/ec2/ec2_fleet.go ++++ b/internal/service/ec2/ec2_fleet.go +@@ -33,9 +33,9 @@ func ResourceFleet() *schema.Resource { + }, + Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(10 * time.Minute), - Delete: schema.DefaultTimeout(10 * time.Minute), @@ -196,8 +208,70 @@ index 7f9133b4ff..48789a97e8 100644 + Delete: schema.DefaultTimeout(10 * time.Second), + Update: schema.DefaultTimeout(10 * time.Second), }, - + + CustomizeDiff: customdiff.All( +diff --git a/internal/service/ec2/ec2_instance.go b/internal/service/ec2/ec2_instance.go +index 268e49d0ef..097d80dcb2 100644 +--- a/internal/service/ec2/ec2_instance.go ++++ b/internal/service/ec2/ec2_instance.go +@@ -45,9 +45,9 @@ func ResourceInstance() *schema.Resource { + MigrateState: InstanceMigrateState, + + Timeouts: &schema.ResourceTimeout{ +- Create: schema.DefaultTimeout(10 * time.Minute), +- Update: schema.DefaultTimeout(10 * time.Minute), +- Delete: schema.DefaultTimeout(20 * time.Minute), ++ Create: schema.DefaultTimeout(10 * time.Second), ++ Update: schema.DefaultTimeout(10 * time.Second), ++ Delete: schema.DefaultTimeout(20 * time.Second), + }, + Schema: map[string]*schema.Schema{ +diff --git a/internal/service/ec2/ec2_spot_fleet_request.go b/internal/service/ec2/ec2_spot_fleet_request.go +index d47742a790..5db732e457 100644 +--- a/internal/service/ec2/ec2_spot_fleet_request.go ++++ b/internal/service/ec2/ec2_spot_fleet_request.go +@@ -38,9 +38,9 @@ func ResourceSpotFleetRequest() *schema.Resource { + }, + + Timeouts: &schema.ResourceTimeout{ +- Create: schema.DefaultTimeout(10 * time.Minute), +- Update: schema.DefaultTimeout(10 * time.Minute), +- Delete: schema.DefaultTimeout(15 * time.Minute), ++ Create: schema.DefaultTimeout(10 * time.Second), ++ Update: schema.DefaultTimeout(10 * time.Second), ++ Delete: schema.DefaultTimeout(15 * time.Second), + }, + + SchemaVersion: 1, +diff --git a/internal/service/ec2/ec2_spot_fleet_request_test.go b/internal/service/ec2/ec2_spot_fleet_request_test.go +index c3ae2845ce..6852b2df3b 100644 +--- a/internal/service/ec2/ec2_spot_fleet_request_test.go ++++ b/internal/service/ec2/ec2_spot_fleet_request_test.go +@@ -1141,7 +1141,7 @@ func TestAccEC2SpotFleetRequest_withWeightedCapacity(t *testing.T) { + // See https://github.com/hashicorp/terraform/pull/8938 + return func(s *terraform.State) error { + log.Print("[DEBUG] Test: Sleep to allow EC2 to actually begin fulfilling TestAccEC2SpotFleetRequest_withWeightedCapacity request") +- time.Sleep(1 * time.Minute) ++ time.Sleep(1 * time.Second) + return nil + } + } +diff --git a/internal/service/ec2/ec2_spot_instance_request.go b/internal/service/ec2/ec2_spot_instance_request.go +index 1cee62f547..2798d62577 100644 +--- a/internal/service/ec2/ec2_spot_instance_request.go ++++ b/internal/service/ec2/ec2_spot_instance_request.go +@@ -31,8 +31,8 @@ func ResourceSpotInstanceRequest() *schema.Resource { + }, + + Timeouts: &schema.ResourceTimeout{ +- Create: schema.DefaultTimeout(10 * time.Minute), +- Delete: schema.DefaultTimeout(20 * time.Minute), ++ Create: schema.DefaultTimeout(10 * time.Second), ++ Delete: schema.DefaultTimeout(20 * time.Second), + }, + + Schema: func() map[string]*schema.Schema { diff --git a/internal/service/ec2/generate/createtags/main.go b/internal/service/ec2/generate/createtags/main.go index d42232fc09..8f7f983957 100644 --- a/internal/service/ec2/generate/createtags/main.go @@ -205,194 +279,98 @@ index d42232fc09..8f7f983957 100644 @@ -133,7 +133,7 @@ import ( tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" ) - + -const EventualConsistencyTimeout = 5 * time.Minute +const EventualConsistencyTimeout = 5 * time.Second - + // CreateTags creates {{ .ServicePackage }} service tags for new resources. // The identifier is typically the Amazon Resource Name (ARN), although -diff --git a/internal/service/ec2/instance.go b/internal/service/ec2/instance.go -index d8fcdd5048..c22c80edc2 100644 ---- a/internal/service/ec2/instance.go -+++ b/internal/service/ec2/instance.go -@@ -2582,7 +2582,7 @@ func getInstancePasswordData(instanceID string, conn *ec2.EC2) (string, error) { - input := &ec2.GetPasswordDataInput{ - InstanceId: aws.String(instanceID), - } -- err := resource.Retry(15*time.Minute, func() *resource.RetryError { -+ err := resource.Retry(15*time.Second, func() *resource.RetryError { - var err error - resp, err = conn.GetPasswordData(input) - -diff --git a/internal/service/ec2/local_gateway_route.go b/internal/service/ec2/local_gateway_route.go -index 3035d7ecde..12c71aeec7 100644 ---- a/internal/service/ec2/local_gateway_route.go -+++ b/internal/service/ec2/local_gateway_route.go +diff --git a/internal/service/ec2/ipam_.go b/internal/service/ec2/ipam_.go +index 5bcdcbcefa..7e61d28cb0 100644 +--- a/internal/service/ec2/ipam_.go ++++ b/internal/service/ec2/ipam_.go +@@ -72,9 +72,9 @@ func ResourceIPAM() *schema.Resource { + + const ( + invalidIPAMIDNotFound = "InvalidIpamId.NotFound" +- ipamCreateTimeout = 3 * time.Minute ++ ipamCreateTimeout = 3 * time.Second + ipamCreateDelay = 5 * time.Second +- IPAMDeleteTimeout = 3 * time.Minute ++ IPAMDeleteTimeout = 3 * time.Second + ipamDeleteDelay = 5 * time.Second + ) + +diff --git a/internal/service/ec2/ipam_pool.go b/internal/service/ec2/ipam_pool.go +index 74b54d6c32..d7f4c2b8a1 100644 +--- a/internal/service/ec2/ipam_pool.go ++++ b/internal/service/ec2/ipam_pool.go +@@ -114,10 +114,10 @@ func ResourceIPAMPool() *schema.Resource { + } + + const ( +- ipamPoolCreateTimeout = 3 * time.Minute ++ ipamPoolCreateTimeout = 3 * time.Second + InvalidIPAMPoolIDNotFound = "InvalidIpamPoolId.NotFound" +- ipamPoolUpdateTimeout = 3 * time.Minute +- IPAMPoolDeleteTimeout = 3 * time.Minute ++ ipamPoolUpdateTimeout = 3 * time.Second ++ IPAMPoolDeleteTimeout = 3 * time.Second + ipamPoolAvailableDelay = 5 * time.Second + ipamPoolDeleteDelay = 5 * time.Second + ) +diff --git a/internal/service/ec2/ipam_pool_cidr.go b/internal/service/ec2/ipam_pool_cidr.go +index bd23ef9ee0..18a38fafa6 100644 +--- a/internal/service/ec2/ipam_pool_cidr.go ++++ b/internal/service/ec2/ipam_pool_cidr.go +@@ -65,9 +65,9 @@ func ResourceIPAMPoolCIDR() *schema.Resource { + } + + const ( +- ipamPoolCIDRCreateTimeout = 10 * time.Minute ++ ipamPoolCIDRCreateTimeout = 10 * time.Second + // allocations releases are eventually consistent with a max time of 20m +- ipamPoolCIDRDeleteTimeout = 32 * time.Minute ++ ipamPoolCIDRDeleteTimeout = 32 * time.Second + ipamPoolCIDRAvailableDelay = 5 * time.Second + ipamPoolCIDRDeleteDelay = 5 * time.Second + ) +diff --git a/internal/service/ec2/ipam_scope.go b/internal/service/ec2/ipam_scope.go +index c8121239c4..5f75fdee82 100644 +--- a/internal/service/ec2/ipam_scope.go ++++ b/internal/service/ec2/ipam_scope.go +@@ -64,9 +64,9 @@ func ResourceIPAMScope() *schema.Resource { + } + + const ( +- ipamScopeCreateTimeout = 3 * time.Minute ++ ipamScopeCreateTimeout = 3 * time.Second + ipamScopeCreateDeley = 5 * time.Second +- IPAMScopeDeleteTimeout = 3 * time.Minute ++ IPAMScopeDeleteTimeout = 3 * time.Second + ipamScopeDeleteDelay = 5 * time.Second + + invalidIPAMScopeIDNotFound = "InvalidIpamScopeId.NotFound" +diff --git a/internal/service/ec2/outposts_local_gateway_route.go b/internal/service/ec2/outposts_local_gateway_route.go +index b85beed092..dadbd1c35d 100644 +--- a/internal/service/ec2/outposts_local_gateway_route.go ++++ b/internal/service/ec2/outposts_local_gateway_route.go @@ -17,7 +17,7 @@ import ( ) - + const ( -- ec2LocalGatewayRouteEventualConsistencyTimeout = 1 * time.Minute -+ ec2LocalGatewayRouteEventualConsistencyTimeout = 1 * time.Second +- localGatewayRouteEventualConsistencyTimeout = 1 * time.Minute ++ localGatewayRouteEventualConsistencyTimeout = 1 * time.Second ) - + func ResourceLocalGatewayRoute() *schema.Resource { -diff --git a/internal/service/ec2/route.go b/internal/service/ec2/route.go -index e6e7c24f45..99adeb2661 100644 ---- a/internal/service/ec2/route.go -+++ b/internal/service/ec2/route.go -@@ -46,8 +46,8 @@ func ResourceRoute() *schema.Resource { - }, - - Timeouts: &schema.ResourceTimeout{ -- Create: schema.DefaultTimeout(5 * time.Minute), -- Update: schema.DefaultTimeout(2 * time.Minute), -+ Create: schema.DefaultTimeout(5 * time.Second), -+ Update: schema.DefaultTimeout(2 * time.Second), - Delete: schema.DefaultTimeout(5 * time.Minute), - }, - -diff --git a/internal/service/ec2/route_table.go b/internal/service/ec2/route_table.go -index ce0e981153..886f78063a 100644 ---- a/internal/service/ec2/route_table.go -+++ b/internal/service/ec2/route_table.go -@@ -50,9 +50,9 @@ func ResourceRouteTable() *schema.Resource { - }, - - Timeouts: &schema.ResourceTimeout{ -- Create: schema.DefaultTimeout(5 * time.Minute), -- Update: schema.DefaultTimeout(2 * time.Minute), -- Delete: schema.DefaultTimeout(5 * time.Minute), -+ Create: schema.DefaultTimeout(5 * time.Second), -+ Update: schema.DefaultTimeout(2 * time.Second), -+ Delete: schema.DefaultTimeout(5 * time.Second), - }, - - Schema: map[string]*schema.Schema{ -diff --git a/internal/service/ec2/route_table_test.go b/internal/service/ec2/route_table_test.go -index 267322dd4c..93e27437f4 100644 ---- a/internal/service/ec2/route_table_test.go -+++ b/internal/service/ec2/route_table_test.go -@@ -1165,7 +1165,7 @@ func testAccCheckRouteTableWaitForVPCEndpointRoute(routeTable *ec2.RouteTable, v - - plId := aws.StringValue(resp.PrefixLists[0].PrefixListId) - -- err = resource.Retry(3*time.Minute, func() *resource.RetryError { -+ err = resource.Retry(3*time.Second, func() *resource.RetryError { - resp, err := conn.DescribeRouteTables(&ec2.DescribeRouteTablesInput{ - RouteTableIds: []*string{routeTable.RouteTableId}, - }) -diff --git a/internal/service/ec2/security_group.go b/internal/service/ec2/security_group.go -index 7c94bf3b2e..ba4bdf1979 100644 ---- a/internal/service/ec2/security_group.go -+++ b/internal/service/ec2/security_group.go -@@ -36,8 +36,8 @@ func ResourceSecurityGroup() *schema.Resource { - }, - - Timeouts: &schema.ResourceTimeout{ -- Create: schema.DefaultTimeout(10 * time.Minute), -- Delete: schema.DefaultTimeout(15 * time.Minute), -+ Create: schema.DefaultTimeout(10 * time.Second), -+ Delete: schema.DefaultTimeout(15 * time.Second), - }, - - SchemaVersion: 1, -diff --git a/internal/service/ec2/security_group_rule.go b/internal/service/ec2/security_group_rule.go -index ec5f80f79f..bc7eb79453 100644 ---- a/internal/service/ec2/security_group_rule.go -+++ b/internal/service/ec2/security_group_rule.go -@@ -227,7 +227,7 @@ information and instructions for recovery. Error: %w`, sg_id, autherr) - id := IPPermissionIDHash(sg_id, ruleType, perm) - log.Printf("[DEBUG] Computed group rule ID %s", id) - -- err = resource.Retry(5*time.Minute, func() *resource.RetryError { -+ err = resource.Retry(5*time.Second, func() *resource.RetryError { - sg, err := FindSecurityGroupByID(conn, sg_id) - - if err != nil { -diff --git a/internal/service/ec2/snapshot_create_volume_permission.go b/internal/service/ec2/snapshot_create_volume_permission.go -index 5cfe5b8ef8..6d7c4b226a 100644 ---- a/internal/service/ec2/snapshot_create_volume_permission.go -+++ b/internal/service/ec2/snapshot_create_volume_permission.go -@@ -60,7 +60,7 @@ func resourceSnapshotCreateVolumePermissionCreate(d *schema.ResourceData, meta i - Pending: []string{"denied"}, - Target: []string{"granted"}, - Refresh: resourceSnapshotCreateVolumePermissionStateRefreshFunc(conn, snapshot_id, account_id), -- Timeout: 20 * time.Minute, -+ Timeout: 20 * time.Second, - Delay: 10 * time.Second, - MinTimeout: 10 * time.Second, - } -@@ -120,7 +120,7 @@ func resourceSnapshotCreateVolumePermissionDelete(d *schema.ResourceData, meta i - Pending: []string{"granted"}, - Target: []string{"denied"}, - Refresh: resourceSnapshotCreateVolumePermissionStateRefreshFunc(conn, snapshotID, accountID), -- Timeout: 5 * time.Minute, -+ Timeout: 5 * time.Second, - Delay: 10 * time.Second, - MinTimeout: 10 * time.Second, - } -diff --git a/internal/service/ec2/spot_fleet_request.go b/internal/service/ec2/spot_fleet_request.go -index 49e4909b3a..731a37f253 100644 ---- a/internal/service/ec2/spot_fleet_request.go -+++ b/internal/service/ec2/spot_fleet_request.go -@@ -36,8 +36,8 @@ func ResourceSpotFleetRequest() *schema.Resource { - }, - }, - Timeouts: &schema.ResourceTimeout{ -- Create: schema.DefaultTimeout(10 * time.Minute), -- Delete: schema.DefaultTimeout(15 * time.Minute), -+ Create: schema.DefaultTimeout(20 * time.Second), -+ Delete: schema.DefaultTimeout(15 * time.Second), - }, - - SchemaVersion: 1, -@@ -1089,7 +1089,7 @@ func resourceSpotFleetRequestCreate(d *schema.ResourceData, meta interface{}) er - Pending: []string{ec2.BatchStateSubmitted}, - Target: []string{ec2.BatchStateActive}, - Refresh: resourceSpotFleetRequestStateRefreshFunc(d, meta), -- Timeout: d.Timeout(schema.TimeoutCreate), //10 * time.Minute, -+ Timeout: d.Timeout(schema.TimeoutCreate), //10 * time.Second, - MinTimeout: 10 * time.Second, - Delay: 30 * time.Second, - } -diff --git a/internal/service/ec2/spot_instance_request.go b/internal/service/ec2/spot_instance_request.go -index e054f82987..08aeb6cf70 100644 ---- a/internal/service/ec2/spot_instance_request.go -+++ b/internal/service/ec2/spot_instance_request.go -@@ -32,8 +32,8 @@ func ResourceSpotInstanceRequest() *schema.Resource { - }, - - Timeouts: &schema.ResourceTimeout{ -- Create: schema.DefaultTimeout(10 * time.Minute), -- Delete: schema.DefaultTimeout(20 * time.Minute), -+ Create: schema.DefaultTimeout(20 * time.Second), -+ Delete: schema.DefaultTimeout(20 * time.Second), - }, - - Schema: func() map[string]*schema.Schema { -diff --git a/internal/service/ec2/subnet.go b/internal/service/ec2/subnet.go -index e551ea615a..ffd26e0c2d 100644 ---- a/internal/service/ec2/subnet.go -+++ b/internal/service/ec2/subnet.go -@@ -30,8 +30,8 @@ func ResourceSubnet() *schema.Resource { - CustomizeDiff: verify.SetTagsDiff, - - Timeouts: &schema.ResourceTimeout{ -- Create: schema.DefaultTimeout(10 * time.Minute), -- Delete: schema.DefaultTimeout(20 * time.Minute), -+ Create: schema.DefaultTimeout(10 * time.Second), -+ Delete: schema.DefaultTimeout(20 * time.Second), - }, - - SchemaVersion: 1, -diff --git a/internal/service/ec2/transit_gateway.go b/internal/service/ec2/transit_gateway.go -index 0c4113ac8d..0a243da1f7 100644 ---- a/internal/service/ec2/transit_gateway.go -+++ b/internal/service/ec2/transit_gateway.go +diff --git a/internal/service/ec2/transitgateway_.go b/internal/service/ec2/transitgateway_.go +index 7393846669..c00d5eebd1 100644 +--- a/internal/service/ec2/transitgateway_.go ++++ b/internal/service/ec2/transitgateway_.go @@ -33,9 +33,9 @@ func ResourceTransitGateway() *schema.Resource { }, - + Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(10 * time.Minute), - Update: schema.DefaultTimeout(10 * time.Minute), @@ -401,7 +379,7 @@ index 0c4113ac8d..0a243da1f7 100644 + Update: schema.DefaultTimeout(10 * time.Second), + Delete: schema.DefaultTimeout(10 * time.Second), }, - + CustomizeDiff: customdiff.Sequence( @@ -753,7 +753,7 @@ func waitForTransitGatewayPeeringAttachmentAcceptance(conn *ec2.EC2, transitGate }, @@ -410,7 +388,7 @@ index 0c4113ac8d..0a243da1f7 100644 - Timeout: 10 * time.Minute, + Timeout: 10 * time.Second, } - + log.Printf("[DEBUG] Waiting for EC2 Transit Gateway Peering Attachment (%s) availability", transitGatewayAttachmentID) @@ -774,7 +774,7 @@ func waitForTransitGatewayPeeringAttachmentCreation(conn *ec2.EC2, transitGatewa ec2.TransitGatewayAttachmentStatePendingAcceptance, @@ -419,7 +397,7 @@ index 0c4113ac8d..0a243da1f7 100644 - Timeout: 10 * time.Minute, + Timeout: 10 * time.Second, } - + log.Printf("[DEBUG] Waiting for EC2 Transit Gateway Peering Attachment (%s) availability", transitGatewayAttachmentID) @@ -793,7 +793,7 @@ func WaitForTransitGatewayPeeringAttachmentDeletion(conn *ec2.EC2, transitGatewa }, @@ -428,7 +406,7 @@ index 0c4113ac8d..0a243da1f7 100644 - Timeout: 10 * time.Minute, + Timeout: 10 * time.Second, } - + log.Printf("[DEBUG] Waiting for EC2 Transit Gateway Peering Attachment (%s) deletion", transitGatewayAttachmentID) @@ -811,7 +811,7 @@ func waitForTransitGatewayRouteTableAssociationCreation(conn *ec2.EC2, transitGa Pending: []string{ec2.TransitGatewayAssociationStateAssociating}, @@ -437,7 +415,7 @@ index 0c4113ac8d..0a243da1f7 100644 - Timeout: 5 * time.Minute, + Timeout: 5 * time.Second, } - + log.Printf("[DEBUG] Waiting for EC2 Transit Gateway Route Table (%s) association: %s", transitGatewayRouteTableID, transitGatewayAttachmentID) @@ -828,7 +828,7 @@ func waitForTransitGatewayRouteTableAssociationDeletion(conn *ec2.EC2, transitGa }, @@ -447,7 +425,7 @@ index 0c4113ac8d..0a243da1f7 100644 + Timeout: 5 * time.Second, NotFoundChecks: 1, } - + @@ -847,7 +847,7 @@ func waitForTransitGatewayRouteTableCreation(conn *ec2.EC2, transitGatewayRouteT Pending: []string{ec2.TransitGatewayRouteTableStatePending}, Target: []string{ec2.TransitGatewayRouteTableStateAvailable}, @@ -455,7 +433,7 @@ index 0c4113ac8d..0a243da1f7 100644 - Timeout: 10 * time.Minute, + Timeout: 10 * time.Second, } - + log.Printf("[DEBUG] Waiting for EC2 Transit Gateway Route Table (%s) availability", transitGatewayRouteTableID) @@ -864,7 +864,7 @@ func waitForTransitGatewayRouteTableDeletion(conn *ec2.EC2, transitGatewayRouteT }, @@ -465,7 +443,7 @@ index 0c4113ac8d..0a243da1f7 100644 + Timeout: 10 * time.Second, NotFoundChecks: 1, } - + @@ -886,7 +886,7 @@ func waitForTransitGatewayVPCAttachmentAcceptance(conn *ec2.EC2, transitGatewayA }, Target: []string{ec2.TransitGatewayAttachmentStateAvailable}, @@ -473,7 +451,7 @@ index 0c4113ac8d..0a243da1f7 100644 - Timeout: 10 * time.Minute, + Timeout: 10 * time.Second, } - + log.Printf("[DEBUG] Waiting for EC2 Transit Gateway VPC Attachment (%s) availability", transitGatewayAttachmentID) @@ -903,7 +903,7 @@ func waitForTransitGatewayAttachmentCreation(conn *ec2.EC2, transitGatewayAttach ec2.TransitGatewayAttachmentStateAvailable, @@ -482,7 +460,7 @@ index 0c4113ac8d..0a243da1f7 100644 - Timeout: 10 * time.Minute, + Timeout: 10 * time.Second, } - + log.Printf("[DEBUG] Waiting for EC2 Transit Gateway Attachment (%s) availability", transitGatewayAttachmentID) @@ -920,7 +920,7 @@ func WaitForTransitGatewayAttachmentDeletion(conn *ec2.EC2, transitGatewayAttach }, @@ -492,7 +470,7 @@ index 0c4113ac8d..0a243da1f7 100644 + Timeout: 10 * time.Second, NotFoundChecks: 1, } - + @@ -939,7 +939,7 @@ func waitForTransitGatewayAttachmentUpdate(conn *ec2.EC2, transitGatewayAttachme Pending: []string{ec2.TransitGatewayAttachmentStateModifying}, Target: []string{ec2.TransitGatewayAttachmentStateAvailable}, @@ -500,15 +478,15 @@ index 0c4113ac8d..0a243da1f7 100644 - Timeout: 10 * time.Minute, + Timeout: 10 * time.Second, } - + log.Printf("[DEBUG] Waiting for EC2 Transit Gateway Attachment (%s) availability", transitGatewayAttachmentID) -diff --git a/internal/service/ec2/transit_gateway_connect.go b/internal/service/ec2/transit_gateway_connect.go -index 94fcf294fd..511809d291 100644 ---- a/internal/service/ec2/transit_gateway_connect.go -+++ b/internal/service/ec2/transit_gateway_connect.go +diff --git a/internal/service/ec2/transitgateway_connect.go b/internal/service/ec2/transitgateway_connect.go +index 87697fd0dc..1d27d0eadb 100644 +--- a/internal/service/ec2/transitgateway_connect.go ++++ b/internal/service/ec2/transitgateway_connect.go @@ -29,9 +29,9 @@ func ResourceTransitGatewayConnect() *schema.Resource { }, - + Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(10 * time.Minute), - Update: schema.DefaultTimeout(10 * time.Minute), @@ -517,112 +495,98 @@ index 94fcf294fd..511809d291 100644 + Update: schema.DefaultTimeout(10 * time.Second), + Delete: schema.DefaultTimeout(10 * time.Second), }, - + CustomizeDiff: verify.SetTagsDiff, -diff --git a/internal/service/ec2/transit_gateway_connect_peer.go b/internal/service/ec2/transit_gateway_connect_peer.go -index f99d6fba34..abe9360e1a 100644 ---- a/internal/service/ec2/transit_gateway_connect_peer.go -+++ b/internal/service/ec2/transit_gateway_connect_peer.go +diff --git a/internal/service/ec2/transitgateway_connect_peer.go b/internal/service/ec2/transitgateway_connect_peer.go +index 2e1e95dd3a..286d15d29d 100644 +--- a/internal/service/ec2/transitgateway_connect_peer.go ++++ b/internal/service/ec2/transitgateway_connect_peer.go @@ -34,8 +34,8 @@ func ResourceTransitGatewayConnectPeer() *schema.Resource { }, - + 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), }, - + CustomizeDiff: verify.SetTagsDiff, -diff --git a/internal/service/ec2/transit_gateway_multicast_domain.go b/internal/service/ec2/transit_gateway_multicast_domain.go -index 268b596f7e..cb332107ec 100644 ---- a/internal/service/ec2/transit_gateway_multicast_domain.go -+++ b/internal/service/ec2/transit_gateway_multicast_domain.go +diff --git a/internal/service/ec2/transitgateway_multicast_domain.go b/internal/service/ec2/transitgateway_multicast_domain.go +index 5f4118c36e..11c7798f05 100644 +--- a/internal/service/ec2/transitgateway_multicast_domain.go ++++ b/internal/service/ec2/transitgateway_multicast_domain.go @@ -31,8 +31,8 @@ func ResourceTransitGatewayMulticastDomain() *schema.Resource { CustomizeDiff: verify.SetTagsDiff, - + 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), }, - + Schema: map[string]*schema.Schema{ -diff --git a/internal/service/ec2/transit_gateway_multicast_domain_association.go b/internal/service/ec2/transit_gateway_multicast_domain_association.go -index 7dbb72c75a..0f8782b75b 100644 ---- a/internal/service/ec2/transit_gateway_multicast_domain_association.go -+++ b/internal/service/ec2/transit_gateway_multicast_domain_association.go +diff --git a/internal/service/ec2/transitgateway_multicast_domain_association.go b/internal/service/ec2/transitgateway_multicast_domain_association.go +index ab9595b81d..fca49cea03 100644 +--- a/internal/service/ec2/transitgateway_multicast_domain_association.go ++++ b/internal/service/ec2/transitgateway_multicast_domain_association.go @@ -23,8 +23,8 @@ func ResourceTransitGatewayMulticastDomainAssociation() *schema.Resource { DeleteWithoutTimeout: resourceTransitGatewayMulticastDomainAssociationDelete, - + 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), }, - + Schema: map[string]*schema.Schema{ -diff --git a/internal/service/ec2/volume_attachment.go b/internal/service/ec2/volume_attachment.go -index ba481eabc1..672b93e7ce 100644 ---- a/internal/service/ec2/volume_attachment.go -+++ b/internal/service/ec2/volume_attachment.go -@@ -106,7 +106,7 @@ func resourceVolumeAttachmentCreate(d *schema.ResourceData, meta interface{}) er - Pending: []string{ec2.InstanceStateNamePending, ec2.InstanceStateNameStopping}, - Target: []string{ec2.InstanceStateNameRunning, ec2.InstanceStateNameStopped}, - Refresh: InstanceStateRefreshFunc(conn, iID, []string{ec2.InstanceStateNameTerminated}), -- Timeout: 10 * time.Minute, -+ Timeout: 10 * time.Second, - Delay: 10 * time.Second, - MinTimeout: 3 * time.Second, - } -@@ -139,7 +139,7 @@ func resourceVolumeAttachmentCreate(d *schema.ResourceData, meta interface{}) er - Pending: []string{ec2.VolumeAttachmentStateAttaching}, - Target: []string{ec2.VolumeAttachmentStateAttached}, - Refresh: volumeAttachmentStateRefreshFunc(conn, name, vID, iID), -- Timeout: 5 * time.Minute, -+ Timeout: 5 * time.Second, - Delay: 10 * time.Second, - MinTimeout: 3 * time.Second, - } -@@ -234,7 +234,7 @@ func resourceVolumeAttachmentDelete(d *schema.ResourceData, meta interface{}) er - Pending: []string{ec2.VolumeAttachmentStateDetaching}, - Target: []string{ec2.VolumeAttachmentStateDetached}, - Refresh: volumeAttachmentStateRefreshFunc(conn, name, vID, iID), -- Timeout: 5 * time.Minute, -+ Timeout: 5 * time.Second, - Delay: 10 * time.Second, - MinTimeout: 3 * time.Second, - } -diff --git a/internal/service/ec2/volume_attachment_test.go b/internal/service/ec2/volume_attachment_test.go -index d680b5de40..33e4990293 100644 ---- a/internal/service/ec2/volume_attachment_test.go -+++ b/internal/service/ec2/volume_attachment_test.go -@@ -101,7 +101,7 @@ func TestAccEC2VolumeAttachment_attachStopped(t *testing.T) { - Pending: []string{ec2.InstanceStateNamePending, ec2.InstanceStateNameRunning, ec2.InstanceStateNameStopping}, - Target: []string{ec2.InstanceStateNameStopped}, - Refresh: tfec2.InstanceStateRefreshFunc(conn, *i.InstanceId, []string{}), -- Timeout: 10 * time.Minute, -+ Timeout: 10 * time.Second, - Delay: 10 * time.Second, - MinTimeout: 3 * time.Second, - } +diff --git a/internal/service/ec2/vpc_default_route_table.go b/internal/service/ec2/vpc_default_route_table.go +index 01e170d231..10bc05b4b6 100644 +--- a/internal/service/ec2/vpc_default_route_table.go ++++ b/internal/service/ec2/vpc_default_route_table.go +@@ -27,8 +27,8 @@ func ResourceDefaultRouteTable() *schema.Resource { + }, + + 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), + }, + + // +diff --git a/internal/service/ec2/vpc_default_subnet.go b/internal/service/ec2/vpc_default_subnet.go +index 9a0a8151e2..8bcd1eb537 100644 +--- a/internal/service/ec2/vpc_default_subnet.go ++++ b/internal/service/ec2/vpc_default_subnet.go +@@ -30,8 +30,8 @@ func ResourceDefaultSubnet() *schema.Resource { + CustomizeDiff: verify.SetTagsDiff, + + Timeouts: &schema.ResourceTimeout{ +- Create: schema.DefaultTimeout(10 * time.Minute), +- Delete: schema.DefaultTimeout(20 * time.Minute), ++ Create: schema.DefaultTimeout(10 * time.Second), ++ Delete: schema.DefaultTimeout(20 * time.Second), + }, + + SchemaVersion: 1, diff --git a/internal/service/ec2/vpc_endpoint.go b/internal/service/ec2/vpc_endpoint.go -index e63ff49e44..117845e8ee 100644 +index bc03d302e0..76ae4c7554 100644 --- a/internal/service/ec2/vpc_endpoint.go +++ b/internal/service/ec2/vpc_endpoint.go @@ -22,7 +22,7 @@ import ( - + const ( // Maximum amount of time to wait for VPC Endpoint creation - VPCEndpointCreationTimeout = 10 * time.Minute + VPCEndpointCreationTimeout = 10 * time.Second ) - + func ResourceVPCEndpoint() *schema.Resource { @@ -147,8 +147,8 @@ func ResourceVPCEndpoint() *schema.Resource { - + Timeouts: &schema.ResourceTimeout{ Create: schema.DefaultTimeout(VPCEndpointCreationTimeout), - Update: schema.DefaultTimeout(10 * time.Minute), @@ -630,7 +594,7 @@ index e63ff49e44..117845e8ee 100644 + Update: schema.DefaultTimeout(10 * time.Second), + Delete: schema.DefaultTimeout(10 * time.Second), }, - + CustomizeDiff: verify.SetTagsDiff, diff --git a/internal/service/ec2/vpc_endpoint_policy.go b/internal/service/ec2/vpc_endpoint_policy.go index 98ba994861..f653423ae1 100644 @@ -638,7 +602,7 @@ index 98ba994861..f653423ae1 100644 +++ b/internal/service/ec2/vpc_endpoint_policy.go @@ -45,8 +45,8 @@ func ResourceVPCEndpointPolicy() *schema.Resource { }, - + Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(10 * time.Minute), - Delete: schema.DefaultTimeout(10 * time.Minute), @@ -648,7 +612,7 @@ index 98ba994861..f653423ae1 100644 } } diff --git a/internal/service/ec2/vpc_endpoint_service.go b/internal/service/ec2/vpc_endpoint_service.go -index e25ddc0f7b..2782e413f9 100644 +index 5e38bebaca..cf4e397598 100644 --- a/internal/service/ec2/vpc_endpoint_service.go +++ b/internal/service/ec2/vpc_endpoint_service.go @@ -415,7 +415,7 @@ func vpcEndpointServiceWaitUntilAvailable(d *schema.ResourceData, conn *ec2.EC2) @@ -660,7 +624,7 @@ index e25ddc0f7b..2782e413f9 100644 Delay: 5 * time.Second, MinTimeout: 5 * time.Second, } -@@ -431,7 +431,7 @@ func waitForVpcEndpointServiceDeletion(conn *ec2.EC2, serviceID string) error { +@@ -431,7 +431,7 @@ func waitForVPCEndpointServiceDeletion(conn *ec2.EC2, serviceID string) error { Pending: []string{ec2.ServiceStateAvailable, ec2.ServiceStateDeleting}, Target: []string{ec2.ServiceStateDeleted}, Refresh: vpcEndpointServiceStateRefresh(conn, serviceID), @@ -669,79 +633,39 @@ index e25ddc0f7b..2782e413f9 100644 Delay: 5 * time.Second, MinTimeout: 5 * time.Second, } -diff --git a/internal/service/ec2/vpc_ipam.go b/internal/service/ec2/vpc_ipam.go -index e679302031..67eeccfd00 100644 ---- a/internal/service/ec2/vpc_ipam.go -+++ b/internal/service/ec2/vpc_ipam.go -@@ -73,9 +73,9 @@ func ResourceVPCIpam() *schema.Resource { - const ( - IpamStatusAvailable = "Available" - InvalidIpamIdNotFound = "InvalidIpamId.NotFound" -- IpamCreateTimeout = 3 * time.Minute -+ IpamCreateTimeout = 3 * time.Second - IpamCreateDeley = 5 * time.Second -- IpamDeleteTimeout = 3 * time.Minute -+ IpamDeleteTimeout = 3 * time.Second - IpamDeleteDelay = 5 * time.Second - ) - -diff --git a/internal/service/ec2/vpc_ipam_pool.go b/internal/service/ec2/vpc_ipam_pool.go -index 096d4d2e03..e6825eaed2 100644 ---- a/internal/service/ec2/vpc_ipam_pool.go -+++ b/internal/service/ec2/vpc_ipam_pool.go -@@ -114,10 +114,10 @@ func ResourceVPCIpamPool() *schema.Resource { +diff --git a/internal/service/ec2/vpc_endpoint_subnet_association.go b/internal/service/ec2/vpc_endpoint_subnet_association.go +index 793eea6ef2..b9b5b062d1 100644 +--- a/internal/service/ec2/vpc_endpoint_subnet_association.go ++++ b/internal/service/ec2/vpc_endpoint_subnet_association.go +@@ -38,8 +38,8 @@ func ResourceVPCEndpointSubnetAssociation() *schema.Resource { + }, + + 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), + }, + } } - - const ( -- IpamPoolCreateTimeout = 3 * time.Minute -+ IpamPoolCreateTimeout = 3 * time.Second - InvalidIpamPoolIdNotFound = "InvalidIpamPoolId.NotFound" -- IpamPoolUpdateTimeout = 3 * time.Minute -- IpamPoolDeleteTimeout = 3 * time.Minute -+ IpamPoolUpdateTimeout = 3 * time.Second -+ IpamPoolDeleteTimeout = 3 * time.Second - IpamPoolAvailableDelay = 5 * time.Second - IpamPoolDeleteDelay = 5 * time.Second - ) -diff --git a/internal/service/ec2/vpc_ipam_pool_cidr.go b/internal/service/ec2/vpc_ipam_pool_cidr.go -index e7be2f477c..09898c1fc7 100644 ---- a/internal/service/ec2/vpc_ipam_pool_cidr.go -+++ b/internal/service/ec2/vpc_ipam_pool_cidr.go -@@ -65,9 +65,9 @@ func ResourceVPCIpamPoolCidr() *schema.Resource { - } - - const ( -- IpamPoolCidrCreateTimeout = 10 * time.Minute -+ IpamPoolCidrCreateTimeout = 10 * time.Second - // allocations releases are eventually consistent with a max time of 20m -- IpamPoolCidrDeleteTimeout = 32 * time.Minute -+ IpamPoolCidrDeleteTimeout = 32 * time.Second - IpamPoolCidrAvailableDelay = 5 * time.Second - IpamPoolCidrDeleteDelay = 5 * time.Second - ) -diff --git a/internal/service/ec2/vpc_ipam_scope.go b/internal/service/ec2/vpc_ipam_scope.go -index 52f02ca2b7..39c28b6a6c 100644 ---- a/internal/service/ec2/vpc_ipam_scope.go -+++ b/internal/service/ec2/vpc_ipam_scope.go -@@ -64,9 +64,9 @@ func ResourceVPCIpamScope() *schema.Resource { - } - - const ( -- IpamScopeCreateTimeout = 3 * time.Minute -+ IpamScopeCreateTimeout = 3 * time.Second - IpamScopeCreateDeley = 5 * time.Second -- IpamScopeDeleteTimeout = 3 * time.Minute -+ IpamScopeDeleteTimeout = 3 * time.Second - IpamScopeDeleteDelay = 5 * time.Second - - IpamScopeStatusAvailable = "Available" +@@ -66,8 +66,8 @@ func resourceVPCEndpointSubnetAssociationCreate(d *schema.ResourceData, meta int + defer conns.GlobalMutexKV.Unlock(mk) + + c := &resource.StateChangeConf{ +- Delay: 1 * time.Minute, +- Timeout: 3 * time.Minute, ++ Delay: 1 * time.Second, ++ Timeout: 3 * time.Second, + Target: []string{"ok"}, + Refresh: func() (interface{}, string, error) { + output, err := conn.ModifyVpcEndpoint(input) diff --git a/internal/service/ec2/vpc_ipv4_cidr_block_association.go b/internal/service/ec2/vpc_ipv4_cidr_block_association.go -index 85bf50557e..7f1960a91e 100644 +index c3ba8fe16a..a7d6bb9f98 100644 --- a/internal/service/ec2/vpc_ipv4_cidr_block_association.go +++ b/internal/service/ec2/vpc_ipv4_cidr_block_association.go @@ -64,8 +64,8 @@ func ResourceVPCIPv4CIDRBlockAssociation() *schema.Resource { }, - + Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(10 * time.Minute), - Delete: schema.DefaultTimeout(10 * time.Minute), @@ -751,12 +675,12 @@ index 85bf50557e..7f1960a91e 100644 } } diff --git a/internal/service/ec2/vpc_ipv6_cidr_block_association.go b/internal/service/ec2/vpc_ipv6_cidr_block_association.go -index bbbfaee555..f0627c67df 100644 +index 9894a5703a..0c5cd51ab8 100644 --- a/internal/service/ec2/vpc_ipv6_cidr_block_association.go +++ b/internal/service/ec2/vpc_ipv6_cidr_block_association.go @@ -71,8 +71,8 @@ func ResourceVPCIPv6CIDRBlockAssociation() *schema.Resource { }, - + Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(10 * time.Minute), - Delete: schema.DefaultTimeout(10 * time.Minute), @@ -766,12 +690,12 @@ index bbbfaee555..f0627c67df 100644 } } diff --git a/internal/service/ec2/vpc_peering_connection.go b/internal/service/ec2/vpc_peering_connection.go -index 6fae3fc9e7..6b6f1abd11 100644 +index 7ed8ec448c..d74eef1bc9 100644 --- a/internal/service/ec2/vpc_peering_connection.go +++ b/internal/service/ec2/vpc_peering_connection.go @@ -28,9 +28,9 @@ func ResourceVPCPeeringConnection() *schema.Resource { }, - + Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(1 * time.Minute), - Update: schema.DefaultTimeout(1 * time.Minute), @@ -780,7 +704,7 @@ index 6fae3fc9e7..6b6f1abd11 100644 + Update: schema.DefaultTimeout(1 * time.Second), + Delete: schema.DefaultTimeout(1 * time.Second), }, - + // Keep in sync with aws_vpc_peering_connection_accepter's schema. diff --git a/internal/service/ec2/vpc_peering_connection_accepter.go b/internal/service/ec2/vpc_peering_connection_accepter.go index 5fb1bcb194..2b00ab82d0 100644 @@ -788,88 +712,449 @@ index 5fb1bcb194..2b00ab82d0 100644 +++ b/internal/service/ec2/vpc_peering_connection_accepter.go @@ -21,8 +21,8 @@ func ResourceVPCPeeringConnectionAccepter() *schema.Resource { Delete: resourceVPCPeeringAccepterDelete, - + 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), }, - + Importer: &schema.ResourceImporter{ -diff --git a/internal/service/ec2/vpn_gateway_route_propagation.go b/internal/service/ec2/vpn_gateway_route_propagation.go -index d4d5df3961..9217d9d672 100644 ---- a/internal/service/ec2/vpn_gateway_route_propagation.go -+++ b/internal/service/ec2/vpn_gateway_route_propagation.go +diff --git a/internal/service/ec2/vpc_route.go b/internal/service/ec2/vpc_route.go +index b81c585ac3..5b5eebd83b 100644 +--- a/internal/service/ec2/vpc_route.go ++++ b/internal/service/ec2/vpc_route.go +@@ -46,9 +46,9 @@ func ResourceRoute() *schema.Resource { + }, + + Timeouts: &schema.ResourceTimeout{ +- Create: schema.DefaultTimeout(5 * time.Minute), +- Update: schema.DefaultTimeout(2 * time.Minute), +- Delete: schema.DefaultTimeout(5 * time.Minute), ++ Create: schema.DefaultTimeout(5 * time.Second), ++ Update: schema.DefaultTimeout(2 * time.Second), ++ Delete: schema.DefaultTimeout(5 * time.Second), + }, + + Schema: map[string]*schema.Schema{ +diff --git a/internal/service/ec2/vpc_route_table.go b/internal/service/ec2/vpc_route_table.go +index 5a7b5d36ac..e228b3da4a 100644 +--- a/internal/service/ec2/vpc_route_table.go ++++ b/internal/service/ec2/vpc_route_table.go +@@ -50,9 +50,9 @@ func ResourceRouteTable() *schema.Resource { + }, + + Timeouts: &schema.ResourceTimeout{ +- Create: schema.DefaultTimeout(5 * time.Minute), +- Update: schema.DefaultTimeout(2 * time.Minute), +- Delete: schema.DefaultTimeout(5 * time.Minute), ++ Create: schema.DefaultTimeout(5 * time.Second), ++ Update: schema.DefaultTimeout(2 * time.Second), ++ Delete: schema.DefaultTimeout(5 * time.Second), + }, + + Schema: map[string]*schema.Schema{ +diff --git a/internal/service/ec2/vpc_security_group.go b/internal/service/ec2/vpc_security_group.go +index e7e5114b1c..58dbe14d47 100644 +--- a/internal/service/ec2/vpc_security_group.go ++++ b/internal/service/ec2/vpc_security_group.go +@@ -36,8 +36,8 @@ func ResourceSecurityGroup() *schema.Resource { + }, + + Timeouts: &schema.ResourceTimeout{ +- Create: schema.DefaultTimeout(10 * time.Minute), +- Delete: schema.DefaultTimeout(15 * time.Minute), ++ Create: schema.DefaultTimeout(10 * time.Second), ++ Delete: schema.DefaultTimeout(15 * time.Second), + }, + + SchemaVersion: 1, +@@ -1347,7 +1347,7 @@ func sgProtocolIntegers() map[string]int { + // which would prevent SGs attached to such ENIs from being destroyed + func deleteLingeringLambdaENIs(conn *ec2.EC2, filterName, resourceId string, timeout time.Duration) error { + // AWS Lambda service team confirms P99 deletion time of ~35 minutes. Buffer for safety. +- if minimumTimeout := 45 * time.Minute; timeout < minimumTimeout { ++ if minimumTimeout := 45 * time.Second; timeout < minimumTimeout { + timeout = minimumTimeout + } + +diff --git a/internal/service/ec2/vpc_subnet.go b/internal/service/ec2/vpc_subnet.go +index e52c0c58eb..9a43020008 100644 +--- a/internal/service/ec2/vpc_subnet.go ++++ b/internal/service/ec2/vpc_subnet.go +@@ -30,8 +30,8 @@ func ResourceSubnet() *schema.Resource { + CustomizeDiff: verify.SetTagsDiff, + + Timeouts: &schema.ResourceTimeout{ +- Create: schema.DefaultTimeout(10 * time.Minute), +- Delete: schema.DefaultTimeout(20 * time.Minute), ++ Create: schema.DefaultTimeout(10 * time.Second), ++ Delete: schema.DefaultTimeout(20 * time.Second), + }, + + SchemaVersion: 1, +diff --git a/internal/service/ec2/vpnsite_gateway_route_propagation.go b/internal/service/ec2/vpnsite_gateway_route_propagation.go +index 498d05323f..2b20d8eb42 100644 +--- a/internal/service/ec2/vpnsite_gateway_route_propagation.go ++++ b/internal/service/ec2/vpnsite_gateway_route_propagation.go @@ -18,8 +18,8 @@ func ResourceVPNGatewayRoutePropagation() *schema.Resource { Delete: resourceVPNGatewayRoutePropagationDisable, - + Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(2 * time.Minute), - Delete: schema.DefaultTimeout(2 * time.Minute), + Create: schema.DefaultTimeout(2 * time.Second), + Delete: schema.DefaultTimeout(2 * time.Second), }, - + Schema: map[string]*schema.Schema{ diff --git a/internal/service/ec2/wait.go b/internal/service/ec2/wait.go -index 1674393925..73fe8e1161 100644 +index 5ad62e86c0..68209e7fb8 100644 --- a/internal/service/ec2/wait.go +++ b/internal/service/ec2/wait.go -@@ -15,13 +15,13 @@ import ( - +@@ -14,13 +14,13 @@ import ( + ) + const ( - // Maximum amount of time to wait for EC2 Instance attribute modifications to propagate -- InstanceAttributePropagationTimeout = 2 * time.Minute -+ InstanceAttributePropagationTimeout = 2 * time.Second - +- InstanceReadyTimeout = 10 * time.Minute - InstanceStartTimeout = 10 * time.Minute - InstanceStopTimeout = 10 * time.Minute ++ InstanceReadyTimeout = 10 * time.Second + InstanceStartTimeout = 10 * time.Second + InstanceStopTimeout = 10 * time.Second - - // General timeout for EC2 resource creations to propagate -- PropagationTimeout = 2 * time.Minute -+ PropagationTimeout = 2 * time.Second - + + // General timeout for EC2 resource creations to propagate. + // See https://docs.aws.amazon.com/AWSEC2/latest/APIReference/query-api-troubleshooting.html#eventual-consistency. +- propagationTimeout = 2 * time.Minute ++ propagationTimeout = 2 * time.Second + RouteNotFoundChecks = 1000 // Should exceed any reasonable custom timeout value. RouteTableNotFoundChecks = 1000 // Should exceed any reasonable custom timeout value. -@@ -31,8 +31,8 @@ const ( +@@ -30,7 +30,7 @@ const ( ) - + + const ( +- AvailabilityZoneGroupOptInStatusTimeout = 10 * time.Minute ++ AvailabilityZoneGroupOptInStatusTimeout = 10 * time.Second + ) + + func WaitAvailabilityZoneGroupOptedIn(conn *ec2.EC2, name string) (*ec2.AvailabilityZone, error) { +@@ -68,8 +68,8 @@ func WaitAvailabilityZoneGroupNotOptedIn(conn *ec2.EC2, name string) (*ec2.Avail + } + const ( - CapacityReservationActiveTimeout = 2 * time.Minute - CapacityReservationDeletedTimeout = 2 * time.Minute + CapacityReservationActiveTimeout = 2 * time.Second + CapacityReservationDeletedTimeout = 2 * time.Second ) - + func WaitCapacityReservationActive(conn *ec2.EC2, id string) (*ec2.CapacityReservation, error) { -@@ -70,9 +70,9 @@ func WaitCapacityReservationDeleted(conn *ec2.EC2, id string) (*ec2.CapacityRese +@@ -107,9 +107,9 @@ func WaitCapacityReservationDeleted(conn *ec2.EC2, id string) (*ec2.CapacityRese } - + const ( - CarrierGatewayAvailableTimeout = 5 * time.Minute + CarrierGatewayAvailableTimeout = 5 * time.Second - + - CarrierGatewayDeletedTimeout = 5 * time.Minute + CarrierGatewayDeletedTimeout = 5 * time.Second ) - + func WaitCarrierGatewayAvailable(conn *ec2.EC2, carrierGatewayID string) (*ec2.CarrierGateway, error) { -@@ -111,10 +111,10 @@ func WaitCarrierGatewayDeleted(conn *ec2.EC2, carrierGatewayID string) (*ec2.Car - +@@ -148,10 +148,10 @@ func WaitCarrierGatewayDeleted(conn *ec2.EC2, carrierGatewayID string) (*ec2.Car + const ( // Maximum amount of time to wait for a LocalGatewayRouteTableVpcAssociation to return Associated - LocalGatewayRouteTableVPCAssociationAssociatedTimeout = 5 * time.Minute + LocalGatewayRouteTableVPCAssociationAssociatedTimeout = 5 * time.Second - + // Maximum amount of time to wait for a LocalGatewayRouteTableVpcAssociation to return Disassociated - LocalGatewayRouteTableVPCAssociationDisassociatedTimeout = 5 * time.Minute + LocalGatewayRouteTableVPCAssociationDisassociatedTimeout = 5 * time.Second ) - + // WaitLocalGatewayRouteTableVPCAssociationAssociated waits for a LocalGatewayRouteTableVpcAssociation to return Associated +@@ -191,8 +191,8 @@ func WaitLocalGatewayRouteTableVPCAssociationDisassociated(conn *ec2.EC2, localG + } + + const ( +- ClientVPNEndpointDeletedTimeout = 5 * time.Minute +- ClientVPNEndpointAttributeUpdatedTimeout = 5 * time.Minute ++ ClientVPNEndpointDeletedTimeout = 5 * time.Second ++ ClientVPNEndpointAttributeUpdatedTimeout = 5 * time.Second + ) + + func WaitClientVPNEndpointDeleted(conn *ec2.EC2, id string) (*ec2.ClientVpnEndpoint, error) { +@@ -234,8 +234,8 @@ func WaitClientVPNEndpointClientConnectResponseOptionsUpdated(conn *ec2.EC2, id + } + + const ( +- ClientVPNAuthorizationRuleCreatedTimeout = 10 * time.Minute +- ClientVPNAuthorizationRuleDeletedTimeout = 10 * time.Minute ++ ClientVPNAuthorizationRuleCreatedTimeout = 10 * time.Second ++ ClientVPNAuthorizationRuleDeletedTimeout = 10 * time.Second + ) + + func WaitClientVPNAuthorizationRuleCreated(conn *ec2.EC2, endpointID, targetNetworkCIDR, accessGroupID string, timeout time.Duration) (*ec2.AuthorizationRule, error) { +@@ -277,10 +277,10 @@ func WaitClientVPNAuthorizationRuleDeleted(conn *ec2.EC2, endpointID, targetNetw + } + + const ( +- ClientVPNNetworkAssociationCreatedTimeout = 30 * time.Minute +- ClientVPNNetworkAssociationCreatedDelay = 4 * time.Minute +- ClientVPNNetworkAssociationDeletedTimeout = 30 * time.Minute +- ClientVPNNetworkAssociationDeletedDelay = 4 * time.Minute ++ ClientVPNNetworkAssociationCreatedTimeout = 30 * time.Second ++ ClientVPNNetworkAssociationCreatedDelay = 4 * time.Second ++ ClientVPNNetworkAssociationDeletedTimeout = 30 * time.Second ++ ClientVPNNetworkAssociationDeletedDelay = 4 * time.Second + ClientVPNNetworkAssociationStatusPollInterval = 10 * time.Second + ) + +@@ -327,8 +327,8 @@ func WaitClientVPNNetworkAssociationDeleted(conn *ec2.EC2, associationID, endpoi + } + + const ( +- ClientVPNRouteCreatedTimeout = 1 * time.Minute +- ClientVPNRouteDeletedTimeout = 1 * time.Minute ++ ClientVPNRouteCreatedTimeout = 1 * time.Second ++ ClientVPNRouteDeletedTimeout = 1 * time.Second + ) + + func WaitClientVPNRouteCreated(conn *ec2.EC2, endpointID, targetSubnetID, destinationCIDR string, timeout time.Duration) (*ec2.ClientVpnRoute, error) { +@@ -649,7 +649,7 @@ func WaitInstanceRootBlockDeviceDeleteOnTerminationUpdated(conn *ec2.EC2, id str + return nil, err + } + +-const ManagedPrefixListEntryCreateTimeout = 5 * time.Minute ++const ManagedPrefixListEntryCreateTimeout = 5 * time.Second + + func WaitRouteDeleted(conn *ec2.EC2, routeFinder RouteFinder, routeTableID, destination string, timeout time.Duration) (*ec2.Route, error) { + stateConf := &resource.StateChangeConf{ +@@ -689,11 +689,11 @@ func WaitRouteReady(conn *ec2.EC2, routeFinder RouteFinder, routeTableID, destin + } + + const ( +- RouteTableAssociationPropagationTimeout = 5 * time.Minute ++ RouteTableAssociationPropagationTimeout = 5 * time.Second + +- RouteTableAssociationCreatedTimeout = 5 * time.Minute +- RouteTableAssociationUpdatedTimeout = 5 * time.Minute +- RouteTableAssociationDeletedTimeout = 5 * time.Minute ++ RouteTableAssociationCreatedTimeout = 5 * time.Second ++ RouteTableAssociationUpdatedTimeout = 5 * time.Second ++ RouteTableAssociationDeletedTimeout = 5 * time.Second + ) + + func WaitRouteTableReady(conn *ec2.EC2, id string, timeout time.Duration) (*ec2.RouteTable, error) { +@@ -815,10 +815,10 @@ func WaitSecurityGroupCreated(conn *ec2.EC2, id string, timeout time.Duration) ( + } + + const ( +- SubnetPropagationTimeout = 2 * time.Minute +- SubnetAttributePropagationTimeout = 5 * time.Minute +- SubnetIPv6CIDRBlockAssociationCreatedTimeout = 3 * time.Minute +- SubnetIPv6CIDRBlockAssociationDeletedTimeout = 3 * time.Minute ++ SubnetPropagationTimeout = 10 * time.Second ++ SubnetAttributePropagationTimeout = 10 * time.Second ++ SubnetIPv6CIDRBlockAssociationCreatedTimeout = 3 * time.Second ++ SubnetIPv6CIDRBlockAssociationDeletedTimeout = 3 * time.Second + ) + + func WaitSubnetAvailable(conn *ec2.EC2, id string, timeout time.Duration) (*ec2.Subnet, error) { +@@ -1007,7 +1007,7 @@ func WaitSubnetPrivateDNSHostnameTypeOnLaunchUpdated(conn *ec2.EC2, subnetID str + } + + const ( +- TransitGatewayIncorrectStateTimeout = 5 * time.Minute ++ TransitGatewayIncorrectStateTimeout = 5 * time.Second + ) + + func WaitTransitGatewayCreated(conn *ec2.EC2, id string, timeout time.Duration) (*ec2.TransitGateway, error) { +@@ -1200,7 +1200,7 @@ func WaitTransitGatewayMulticastDomainAssociationDeleted(conn *ec2.EC2, multicas + } + + const ( +- TransitGatewayPrefixListReferenceTimeout = 5 * time.Minute ++ TransitGatewayPrefixListReferenceTimeout = 5 * time.Second + ) + + func WaitTransitGatewayPrefixListReferenceStateCreated(conn *ec2.EC2, transitGatewayRouteTableID string, prefixListID string) (*ec2.TransitGatewayPrefixListReference, error) { +@@ -1255,8 +1255,8 @@ func WaitTransitGatewayPrefixListReferenceStateUpdated(conn *ec2.EC2, transitGat + } + + const ( +- TransitGatewayRouteCreatedTimeout = 2 * time.Minute +- TransitGatewayRouteDeletedTimeout = 2 * time.Minute ++ TransitGatewayRouteCreatedTimeout = 2 * time.Second ++ TransitGatewayRouteDeletedTimeout = 2 * time.Second + ) + + func WaitTransitGatewayRouteCreated(conn *ec2.EC2, transitGatewayRouteTableID, destination string) (*ec2.TransitGatewayRoute, error) { +@@ -1294,7 +1294,7 @@ func WaitTransitGatewayRouteDeleted(conn *ec2.EC2, transitGatewayRouteTableID, d + } + + const ( +- TransitGatewayRouteTablePropagationTimeout = 5 * time.Minute ++ TransitGatewayRouteTablePropagationTimeout = 5 * time.Second + ) + + func WaitTransitGatewayRouteTablePropagationStateEnabled(conn *ec2.EC2, transitGatewayRouteTableID string, transitGatewayAttachmentID string) (*ec2.TransitGatewayRouteTablePropagation, error) { +@@ -1455,9 +1455,9 @@ func WaitVolumeModificationComplete(conn *ec2.EC2, id string, timeout time.Durat + } + + const ( +- vpcAttributePropagationTimeout = 5 * time.Minute +- vpcCreatedTimeout = 10 * time.Minute +- vpcDeletedTimeout = 5 * time.Minute ++ vpcAttributePropagationTimeout = 10 * time.Second ++ vpcCreatedTimeout = 10 * time.Second ++ vpcDeletedTimeout = 5 * time.Second + ) + + func WaitVPCCreated(conn *ec2.EC2, id string) (*ec2.Vpc, error) { +@@ -1542,8 +1542,8 @@ func WaitVPCCIDRBlockAssociationDeleted(conn *ec2.EC2, id string, timeout time.D + } + + const ( +- vpcIPv6CIDRBlockAssociationCreatedTimeout = 10 * time.Minute +- vpcIPv6CIDRBlockAssociationDeletedTimeout = 5 * time.Minute ++ vpcIPv6CIDRBlockAssociationCreatedTimeout = 10 * time.Second ++ vpcIPv6CIDRBlockAssociationDeletedTimeout = 5 * time.Second + ) + + func WaitVPCIPv6CIDRBlockAssociationCreated(conn *ec2.EC2, id string, timeout time.Duration) (*ec2.VpcCidrBlockState, error) { +@@ -1593,7 +1593,7 @@ func WaitVPCIPv6CIDRBlockAssociationDeleted(conn *ec2.EC2, id string, timeout ti + } + + const ( +- VPCPeeringConnectionOptionsPropagationTimeout = 3 * time.Minute ++ VPCPeeringConnectionOptionsPropagationTimeout = 3 * time.Second + ) + + func WaitVPCPeeringConnectionActive(conn *ec2.EC2, id string, timeout time.Duration) (*ec2.VpcPeeringConnection, error) { +@@ -1639,10 +1639,10 @@ func WaitVPCPeeringConnectionDeleted(conn *ec2.EC2, id string, timeout time.Dura + } + + const ( +- VPNGatewayDeletedTimeout = 5 * time.Minute ++ VPNGatewayDeletedTimeout = 5 * time.Second + +- VPNGatewayVPCAttachmentAttachedTimeout = 15 * time.Minute +- VPNGatewayVPCAttachmentDetachedTimeout = 30 * time.Minute ++ VPNGatewayVPCAttachmentAttachedTimeout = 15 * time.Second ++ VPNGatewayVPCAttachmentDetachedTimeout = 30 * time.Second + ) + + func WaitVPNGatewayVPCAttachmentAttached(conn *ec2.EC2, vpnGatewayID, vpcID string) (*ec2.VpcAttachment, error) { +@@ -1680,8 +1680,8 @@ func WaitVPNGatewayVPCAttachmentDetached(conn *ec2.EC2, vpnGatewayID, vpcID stri + } + + const ( +- customerGatewayCreatedTimeout = 10 * time.Minute +- customerGatewayDeletedTimeout = 5 * time.Minute ++ customerGatewayCreatedTimeout = 10 * time.Second ++ customerGatewayDeletedTimeout = 5 * time.Second + ) + + func WaitCustomerGatewayCreated(conn *ec2.EC2, id string) (*ec2.CustomerGateway, error) { +@@ -1721,8 +1721,8 @@ func WaitCustomerGatewayDeleted(conn *ec2.EC2, id string) (*ec2.CustomerGateway, + } + + const ( +- natGatewayCreatedTimeout = 10 * time.Minute +- natGatewayDeletedTimeout = 30 * time.Minute ++ natGatewayCreatedTimeout = 10 * time.Second ++ natGatewayDeletedTimeout = 30 * time.Second + ) + + func WaitNATGatewayCreated(conn *ec2.EC2, id string) (*ec2.NatGateway, error) { +@@ -1770,9 +1770,9 @@ func WaitNATGatewayDeleted(conn *ec2.EC2, id string) (*ec2.NatGateway, error) { + } + + const ( +- vpnConnectionCreatedTimeout = 40 * time.Minute +- vpnConnectionDeletedTimeout = 30 * time.Minute +- vpnConnectionUpdatedTimeout = 30 * time.Minute ++ vpnConnectionCreatedTimeout = 40 * time.Second ++ vpnConnectionDeletedTimeout = 30 * time.Second ++ vpnConnectionUpdatedTimeout = 30 * time.Second + ) + + func WaitVPNConnectionCreated(conn *ec2.EC2, id string) (*ec2.VpnConnection, error) { +@@ -1872,9 +1872,9 @@ func WaitVPNConnectionRouteDeleted(conn *ec2.EC2, vpnConnectionID, cidrBlock str + } + + const ( +- HostCreatedTimeout = 10 * time.Minute +- HostUpdatedTimeout = 10 * time.Minute +- HostDeletedTimeout = 20 * time.Minute ++ HostCreatedTimeout = 10 * time.Second ++ HostUpdatedTimeout = 10 * time.Second ++ HostDeletedTimeout = 20 * time.Second + ) + + func WaitHostCreated(conn *ec2.EC2, id string) (*ec2.Host, error) { +@@ -1929,13 +1929,13 @@ func WaitHostDeleted(conn *ec2.EC2, id string) (*ec2.Host, error) { + } + + const ( +- dhcpOptionSetDeletedTimeout = 3 * time.Minute ++ dhcpOptionSetDeletedTimeout = 3 * time.Second + ) + + const ( +- internetGatewayAttachedTimeout = 4 * time.Minute +- internetGatewayDeletedTimeout = 10 * time.Minute +- internetGatewayDetachedTimeout = 15 * time.Minute ++ internetGatewayAttachedTimeout = 4 * time.Second ++ internetGatewayDeletedTimeout = 10 * time.Second ++ internetGatewayDetachedTimeout = 15 * time.Second + ) + + func WaitInternetGatewayAttached(conn *ec2.EC2, internetGatewayID, vpcID string, timeout time.Duration) (*ec2.InternetGatewayAttachment, error) { +@@ -1974,7 +1974,7 @@ func WaitInternetGatewayDetached(conn *ec2.EC2, internetGatewayID, vpcID string, + } + + const ( +- ManagedPrefixListTimeout = 15 * time.Minute ++ ManagedPrefixListTimeout = 15 * time.Second + ) + + func WaitManagedPrefixListCreated(conn *ec2.EC2, id string) (*ec2.ManagedPrefixList, error) { +@@ -2041,8 +2041,8 @@ func WaitManagedPrefixListDeleted(conn *ec2.EC2, id string) (*ec2.ManagedPrefixL + } + + const ( +- networkInterfaceAttachedTimeout = 5 * time.Minute +- NetworkInterfaceDetachedTimeout = 10 * time.Minute ++ networkInterfaceAttachedTimeout = 5 * time.Second ++ NetworkInterfaceDetachedTimeout = 10 * time.Second + ) + + func WaitNetworkInterfaceAttached(conn *ec2.EC2, id string, timeout time.Duration) (*ec2.NetworkInterfaceAttachment, error) { +@@ -2121,8 +2121,8 @@ func WaitNetworkInterfaceDetached(conn *ec2.EC2, id string, timeout time.Duratio + } + + const ( +- PlacementGroupCreatedTimeout = 5 * time.Minute +- PlacementGroupDeletedTimeout = 5 * time.Minute ++ PlacementGroupCreatedTimeout = 5 * time.Second ++ PlacementGroupDeletedTimeout = 5 * time.Second + ) + + func WaitPlacementGroupCreated(conn *ec2.EC2, name string) (*ec2.PlacementGroup, error) { +@@ -2355,7 +2355,7 @@ func waitVPCEndpointConnectionAccepted(conn *ec2.EC2, serviceID, vpcEndpointID s + } + + const ( +- ebsSnapshotArchivedTimeout = 60 * time.Minute ++ ebsSnapshotArchivedTimeout = 60 * time.Second + ) + + func waitEBSSnapshotTierArchive(conn *ec2.EC2, id string, timeout time.Duration) (*ec2.SnapshotTierStatus, error) { //nolint:unparam -- 2.25.1 diff --git a/tests/terraformtests/etc/0003-Patch-IAM-wait-times.patch b/tests/terraformtests/etc/0003-Patch-IAM-wait-times.patch index 5ead30f20..68038be05 100644 --- a/tests/terraformtests/etc/0003-Patch-IAM-wait-times.patch +++ b/tests/terraformtests/etc/0003-Patch-IAM-wait-times.patch @@ -1,23 +1,23 @@ -From 211ea82c418b51a35b94b1e3ded0d689b4434863 Mon Sep 17 00:00:00 2001 +From e356afa8e19d90c7e343120897f4385d616ae9d2 Mon Sep 17 00:00:00 2001 From: Bert Blommers -Date: Fri, 15 Apr 2022 19:22:04 +0000 -Subject: [PATCH] Patch IAM wait times +Date: Sun, 19 Jun 2022 19:39:31 +0000 +Subject: [PATCH] IAM: Reduce wait times --- internal/service/iam/wait.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/iam/wait.go b/internal/service/iam/wait.go -index 51e5d1c9c7..057446ae1d 100644 +index 705d88d664..527f4fa9b8 100644 --- a/internal/service/iam/wait.go +++ b/internal/service/iam/wait.go @@ -17,7 +17,7 @@ const ( // as this will negatively impact user experience when configurations // have incorrect references or permissions. // Reference: https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency -- PropagationTimeout = 2 * time.Minute -+ PropagationTimeout = 2 * time.Second - +- propagationTimeout = 2 * time.Minute ++ propagationTimeout = 2 * time.Second + RoleStatusARNIsUniqueID = "uniqueid" RoleStatusARNIsARN = "arn" @@ -72,7 +72,7 @@ func waitDeleteServiceLinkedRole(conn *iam.IAM, deletionTaskID string) error { diff --git a/tests/terraformtests/terraform-provider-aws b/tests/terraformtests/terraform-provider-aws index f34a786a6..3c1f58b59 160000 --- a/tests/terraformtests/terraform-provider-aws +++ b/tests/terraformtests/terraform-provider-aws @@ -1 +1 @@ -Subproject commit f34a786a6672e5629456a523e2b74cc4d368db45 +Subproject commit 3c1f58b59a45aaecc9a4b243d5b1004283b3353b diff --git a/tests/terraformtests/terraform-tests.success.txt b/tests/terraformtests/terraform-tests.success.txt index 3ab690c7c..4079bcfdf 100644 --- a/tests/terraformtests/terraform-tests.success.txt +++ b/tests/terraformtests/terraform-tests.success.txt @@ -130,7 +130,8 @@ lambda: meta: - TestAccMetaBillingServiceAccountDataSource mq: - - TestAccMQBroker + - TestAccMQBrokerDataSource + - TestAccMQBroker_ quicksight: - TestAccQuickSightUser redshift: diff --git a/tests/test_autoscaling/test_autoscaling.py b/tests/test_autoscaling/test_autoscaling.py index 0b53400f5..016035510 100644 --- a/tests/test_autoscaling/test_autoscaling.py +++ b/tests/test_autoscaling/test_autoscaling.py @@ -150,7 +150,7 @@ def test_create_autoscaling_groups_defaults(): group["HealthCheckType"].should.equal("EC2") group["LoadBalancerNames"].should.equal([]) group.shouldnt.have.key("PlacementGroup") - group["TerminationPolicies"].should.equal([]) + group["TerminationPolicies"].should.equal(["Default"]) group["Tags"].should.equal([]) diff --git a/tests/test_autoscaling/test_autoscaling_metrics.py b/tests/test_autoscaling/test_autoscaling_metrics.py new file mode 100644 index 000000000..83f1809cf --- /dev/null +++ b/tests/test_autoscaling/test_autoscaling_metrics.py @@ -0,0 +1,49 @@ +import boto3 +import sure # noqa # pylint: disable=unused-import + +from moto import mock_autoscaling, mock_elb, mock_ec2 + +from .utils import setup_networking +from tests import EXAMPLE_AMI_ID + + +@mock_autoscaling +@mock_ec2 +@mock_elb +def test_enable_metrics_collection(): + mocked_networking = setup_networking() + elb_client = boto3.client("elb", region_name="us-east-1") + elb_client.create_load_balancer( + LoadBalancerName="test_lb", + Listeners=[{"Protocol": "http", "LoadBalancerPort": 80, "InstancePort": 8080}], + AvailabilityZones=[], + ) + + as_client = boto3.client("autoscaling", region_name="us-east-1") + as_client.create_launch_configuration( + LaunchConfigurationName="tester_config", + ImageId=EXAMPLE_AMI_ID, + InstanceType="t2.medium", + ) + + as_client.create_auto_scaling_group( + AutoScalingGroupName="tester_group", + LaunchConfigurationName="tester_config", + MinSize=2, + MaxSize=2, + VPCZoneIdentifier=mocked_networking["subnet1"], + ) + + as_client.enable_metrics_collection( + AutoScalingGroupName="tester_group", + Metrics=["GroupMinSize"], + Granularity="1Minute", + ) + + resp = as_client.describe_auto_scaling_groups( + AutoScalingGroupNames=["tester_group"] + )["AutoScalingGroups"][0] + resp.should.have.key("EnabledMetrics").length_of(1) + resp["EnabledMetrics"][0].should.equal( + {"Metric": "GroupMinSize", "Granularity": "1Minute"} + ) diff --git a/tests/test_autoscaling/test_launch_configurations.py b/tests/test_autoscaling/test_launch_configurations.py index 21dd5c4cd..c31f1f7b3 100644 --- a/tests/test_autoscaling/test_launch_configurations.py +++ b/tests/test_autoscaling/test_launch_configurations.py @@ -136,6 +136,46 @@ def test_create_launch_configuration_additional_parameters(): ) +@mock_autoscaling +@mock_ec2 +def test_create_launch_configuration_without_public_ip(): + ec2 = boto3.resource("ec2", "us-east-1") + vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16") + subnet = ec2.create_subnet(VpcId=vpc.id, CidrBlock="10.0.0.0/27") + + ec2_client = boto3.client("ec2", region_name="us-east-1") + random_image_id = ec2_client.describe_images()["Images"][0]["ImageId"] + + client = boto3.client("autoscaling", region_name="us-east-1") + client.create_launch_configuration( + LaunchConfigurationName="tester", + ImageId=EXAMPLE_AMI_ID, + InstanceType="t1.micro", + AssociatePublicIpAddress=False, + ) + + launch_config = client.describe_launch_configurations()["LaunchConfigurations"][0] + launch_config["AssociatePublicIpAddress"].should.equal(False) + + asg_name = f"asg-{random_image_id}" + client.create_auto_scaling_group( + AutoScalingGroupName=asg_name, + LaunchConfigurationName=launch_config["LaunchConfigurationName"], + MinSize=1, + MaxSize=1, + DesiredCapacity=1, + VPCZoneIdentifier=subnet.id, + ) + + instances = client.describe_auto_scaling_instances()["AutoScalingInstances"] + instance_id = instances[0]["InstanceId"] + + instance = ec2_client.describe_instances(InstanceIds=[instance_id])["Reservations"][ + 0 + ]["Instances"][0] + instance.shouldnt.have.key("PublicIpAddress") + + @mock_autoscaling def test_create_launch_configuration_additional_params_default_to_false(): client = boto3.client("autoscaling", region_name="us-east-1")