The initial state in the AWS dashboard is request-canceled-and-instance-running which then changes to instance-terminated-by-user after about 3 minutes. However, the terraform destroy process always takes at least 6+ minutes to to recognize the EC2 instance has been terminated. As a result the destruction process takes at least 6 minutes to complete, even if it only takes 3 minutes or less to terminate the EC2 instance. I’ve used the latest version of provider which is 3.38.0 along with terraform 0.15 but still the issue exists and didn’t make any difference. Please find attached outputs.
The code used to deploy is pasted below
resource “aws_ec2_fleet” “viewer-tool-fleet” { launch_template_config { launch_template_specification { launch_template_name = “test” version = 1 } } target_capacity_specification { default_target_capacity_type = “spot” total_target_capacity = 1 } terminate_instances = true terminate_instances_with_expiration = true }