diff --git a/internal/service/iot/topic_rule_test.go b/internal/service/iot/topic_rule_test.go index f9c16a4722b..15c1a05e9e7 100644 --- a/internal/service/iot/topic_rule_test.go +++ b/internal/service/iot/topic_rule_test.go @@ -1115,9 +1115,6 @@ func TestAccIoTTopicRule_IoT_events_batch_mode(t *testing.T) { func TestAccIoTTopicRule_kafka(t *testing.T) { ctx := acctest.Context(t) - if testing.Short() { - t.Skip("skipping long-running test in short mode") - } rName := testAccTopicRuleName() resourceName := "aws_iot_topic_rule.test" @@ -1129,7 +1126,7 @@ func TestAccIoTTopicRule_kafka(t *testing.T) { CheckDestroy: testAccCheckTopicRuleDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccTopicRuleConfig_kafka(rName), + Config: testAccTopicRuleConfig_kafka(rName, "fake_topic"), Check: resource.ComposeTestCheckFunc( testAccCheckTopicRuleExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "cloudwatch_alarm.#", "0"), @@ -1165,6 +1162,9 @@ func TestAccIoTTopicRule_kafka(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "timestream.#", "0"), ), }, + { + Config: testAccTopicRuleConfig_kafka(rName, "different_topic"), + }, { ResourceName: resourceName, ImportState: true, @@ -2311,11 +2311,14 @@ resource "aws_iot_topic_rule" "test" { `, rName, batchMode)) } -func testAccTopicRuleConfig_kafka(rName string) string { +func testAccTopicRuleConfig_kafka(rName string, topic string) string { + // Making a topic rule destination takes several minutes, as it requires creating many networking resources. + // It's far faster to simply use a properly-formatted but nonexistent ARN for the destination. return acctest.ConfigCompose( - testAccTopicRuleDestinationConfig_basic(rName), + testAccTopicRuleConfig_destinationRole(rName), fmt.Sprintf(` data "aws_region" "current" {} +data "aws_caller_identity" "current" {} resource "aws_iot_topic_rule" "test" { name = %[1]q @@ -2324,8 +2327,8 @@ resource "aws_iot_topic_rule" "test" { sql_version = "2015-10-08" kafka { - destination_arn = aws_iot_topic_rule_destination.test.arn - topic = "fake_topic" + destination_arn = "arn:${data.aws_partition.current.partition}:iot:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:ruledestination/vpc/pretend-this-is-a-uuid" + topic = "%s" client_properties = { "acks" = "1" @@ -2339,7 +2342,7 @@ resource "aws_iot_topic_rule" "test" { } } } -`, rName)) +`, rName, topic)) } func testAccTopicRuleConfig_kinesis(rName string) string {