@@ -358,6 +358,41 @@ func TestAccVPCManagedPrefixList_tags(t *testing.T) {
358
358
})
359
359
}
360
360
361
+ func TestAccVPCManagedPrefixList_descriptionOnlyChange (t * testing.T ) {
362
+ ctx := acctest .Context (t )
363
+ resourceName := "aws_ec2_managed_prefix_list.test"
364
+ rName := sdkacctest .RandomWithPrefix (acctest .ResourcePrefix )
365
+
366
+ resource .ParallelTest (t , resource.TestCase {
367
+ PreCheck : func () { acctest .PreCheck (ctx , t ); testAccPreCheckManagedPrefixList (ctx , t ) },
368
+ ErrorCheck : acctest .ErrorCheck (t , names .EC2ServiceID ),
369
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories ,
370
+ CheckDestroy : testAccCheckManagedPrefixListDestroy (ctx ),
371
+ Steps : []resource.TestStep {
372
+ {
373
+ Config : testAccVPCManagedPrefixListConfig_simpleDescriptionChange (rName , "old description" ),
374
+ Check : resource .ComposeAggregateTestCheckFunc (
375
+ testAccManagedPrefixListExists (ctx , resourceName ),
376
+ resource .TestCheckResourceAttr (resourceName , "entry.#" , "1" ),
377
+ ),
378
+ },
379
+ {
380
+ // This reproduces the bug: change ONLY the description
381
+ // Before the fix, this would fail with "PrefixListVersionMismatch"
382
+ Config : testAccVPCManagedPrefixListConfig_simpleDescriptionChange (rName , "new description" ),
383
+ Check : resource .ComposeAggregateTestCheckFunc (
384
+ testAccManagedPrefixListExists (ctx , resourceName ),
385
+ resource .TestCheckResourceAttr (resourceName , "entry.#" , "1" ),
386
+ resource .TestCheckTypeSetElemNestedAttrs (resourceName , "entry.*" , map [string ]string {
387
+ "cidr" : "1.0.0.0/8" ,
388
+ names .AttrDescription : "new description" ,
389
+ }),
390
+ ),
391
+ },
392
+ },
393
+ })
394
+ }
395
+
361
396
func testAccCheckManagedPrefixListDestroy (ctx context.Context ) resource.TestCheckFunc {
362
397
return func (s * terraform.State ) error {
363
398
conn := acctest .Provider .Meta ().(* conns.AWSClient ).EC2Client (ctx )
@@ -556,3 +591,18 @@ resource "aws_ec2_managed_prefix_list" "test" {
556
591
}
557
592
` , rName , tagKey1 , tagValue1 , tagKey2 , tagValue2 )
558
593
}
594
+
595
+ func testAccVPCManagedPrefixListConfig_simpleDescriptionChange (rName string , description string ) string {
596
+ return fmt .Sprintf (`
597
+ resource "aws_ec2_managed_prefix_list" "test" {
598
+ address_family = "IPv4"
599
+ max_entries = 1
600
+ name = %[1]q
601
+
602
+ entry {
603
+ cidr = "1.0.0.0/8"
604
+ description = %[2]q
605
+ }
606
+ }
607
+ ` , rName , description )
608
+ }
0 commit comments