tests/provider: CloudWatch Event Target test fail #15668
Closed as not planned
Description
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
This test failed on GovCloud. It appears to be a flaky failure that could happen on any partition.
TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount
Terraform CLI and Terraform AWS Provider Version
Terraform 0.12.29 (& 0.13.4)
AWS 3.10.0
Affected Resource(s)
- aws_ecs_cluster
Terraform Configuration Files
resource "aws_cloudwatch_event_rule" "schedule" {
name = "%[1]s"
description = "schedule_ecs_test"
schedule_expression = "rate(5 minutes)"
}
resource "aws_vpc" "vpc" {
cidr_block = "10.1.0.0/16"
}
resource "aws_subnet" "subnet" {
vpc_id = aws_vpc.vpc.id
cidr_block = "10.1.1.0/24"
}
resource "aws_cloudwatch_event_target" "test" {
arn = aws_ecs_cluster.test.id
rule = aws_cloudwatch_event_rule.schedule.id
role_arn = aws_iam_role.test_role.arn
ecs_target {
task_definition_arn = aws_ecs_task_definition.task.arn
launch_type = "FARGATE"
network_configuration {
subnets = [aws_subnet.subnet.id]
}
}
}
resource "aws_iam_role" "test_role" {
name = "%[1]s"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "events.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
EOF
}
resource "aws_iam_role_policy" "test_policy" {
name = "%[1]s"
role = aws_iam_role.test_role.id
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ecs:RunTask"
],
"Resource": [
"*"
]
}
]
}
EOF
}
resource "aws_ecs_cluster" "test" {
name = "%[1]s"
}
resource "aws_ecs_task_definition" "task" {
family = "%[1]s"
cpu = 256
memory = 512
requires_compatibilities = ["FARGATE"]
network_mode = "awsvpc"
container_definitions = <<EOF
[
{
"name": "first",
"image": "service-first",
"cpu": 10,
"memory": 512,
"essential": true
}
]
EOF
}
Debug Output
TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount: testing_new.go:62: Error running post-test destroy, there may be dangling resources: 2020/10/15 19:28:51 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0
Error: Error deleting ECS cluster: ClusterContainsTasksException: The Cluster cannot be deleted while Tasks are active.
--- FAIL: TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount (143.07s)
Expected Behavior
Passing tests
Actual Behavior
Tests fail
Steps to Reproduce
TESTARGS="-run= TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount" make testacc