@@ -41,6 +41,7 @@ func TestAccSyntheticsCanary_basic(t *testing.T) {
41
41
resource .TestCheckResourceAttr (resourceName , names .AttrName , rName ),
42
42
resource .TestCheckResourceAttrPair (resourceName , "runtime_version" , runtimeVersionDataSourceName , "version_name" ),
43
43
resource .TestCheckResourceAttr (resourceName , acctest .CtTagsPercent , "0" ),
44
+ resource .TestCheckResourceAttr (resourceName , "run_config.0.ephemeral_storage" , "1024" ),
44
45
resource .TestCheckResourceAttr (resourceName , "run_config.0.memory_in_mb" , "1500" ),
45
46
resource .TestCheckResourceAttr (resourceName , "run_config.0.timeout_in_seconds" , "840" ),
46
47
resource .TestCheckResourceAttr (resourceName , "failure_retention_period" , "31" ),
@@ -50,7 +51,7 @@ func TestAccSyntheticsCanary_basic(t *testing.T) {
50
51
resource .TestCheckResourceAttr (resourceName , "schedule.0.duration_in_seconds" , "0" ),
51
52
resource .TestCheckResourceAttr (resourceName , "schedule.0.expression" , "rate(0 hour)" ),
52
53
acctest .MatchResourceAttrRegionalARN (ctx , resourceName , "engine_arn" , "lambda" , regexache .MustCompile (fmt .Sprintf (`function:cwsyn-%s.+` , rName ))),
53
- acctest .MatchResourceAttrRegionalARN (ctx , resourceName , "source_location_arn" , "lambda" , regexache .MustCompile (fmt .Sprintf (`layer:cwsyn-%s.+` , rName ))),
54
+ // acctest.MatchResourceAttrRegionalARN(ctx, resourceName, "source_location_arn", "lambda", regexache.MustCompile(fmt.Sprintf(`layer:cwsyn-%s.+`, rName))),
54
55
resource .TestCheckResourceAttrPair (resourceName , names .AttrExecutionRoleARN , "aws_iam_role.test" , names .AttrARN ),
55
56
resource .TestCheckResourceAttr (resourceName , "artifact_s3_location" , fmt .Sprintf ("%s/" , rName )),
56
57
resource .TestCheckResourceAttr (resourceName , "timeline.#" , "1" ),
@@ -73,6 +74,7 @@ func TestAccSyntheticsCanary_basic(t *testing.T) {
73
74
resource .TestCheckResourceAttr (resourceName , names .AttrName , rName ),
74
75
resource .TestCheckResourceAttrPair (resourceName , "runtime_version" , runtimeVersionDataSourceName , "version_name" ),
75
76
resource .TestCheckResourceAttr (resourceName , acctest .CtTagsPercent , "0" ),
77
+ resource .TestCheckResourceAttr (resourceName , "run_config.0.ephemeral_storage" , "1024" ),
76
78
resource .TestCheckResourceAttr (resourceName , "run_config.0.memory_in_mb" , "1500" ),
77
79
resource .TestCheckResourceAttr (resourceName , "run_config.0.timeout_in_seconds" , "840" ),
78
80
resource .TestCheckResourceAttr (resourceName , "failure_retention_period" , "31" ),
@@ -82,7 +84,7 @@ func TestAccSyntheticsCanary_basic(t *testing.T) {
82
84
resource .TestCheckResourceAttr (resourceName , "schedule.0.duration_in_seconds" , "0" ),
83
85
resource .TestCheckResourceAttr (resourceName , "schedule.0.expression" , "rate(0 hour)" ),
84
86
acctest .MatchResourceAttrRegionalARN (ctx , resourceName , "engine_arn" , "lambda" , regexache .MustCompile (fmt .Sprintf (`function:cwsyn-%s.+` , rName ))),
85
- acctest .MatchResourceAttrRegionalARN (ctx , resourceName , "source_location_arn" , "lambda" , regexache .MustCompile (fmt .Sprintf (`layer:cwsyn-%s.+` , rName ))),
87
+ // acctest.MatchResourceAttrRegionalARN(ctx, resourceName, "source_location_arn", "lambda", regexache.MustCompile(fmt.Sprintf(`layer:cwsyn-%s.+`, rName))),
86
88
resource .TestCheckResourceAttrPair (resourceName , names .AttrExecutionRoleARN , "aws_iam_role.test" , names .AttrARN ),
87
89
resource .TestCheckResourceAttr (resourceName , "artifact_s3_location" , fmt .Sprintf ("%s/test/" , rName )),
88
90
resource .TestCheckResourceAttr (resourceName , "timeline.#" , "1" ),
@@ -340,7 +342,7 @@ func TestAccSyntheticsCanary_s3(t *testing.T) {
340
342
resource .TestCheckResourceAttr (resourceName , "schedule.0.duration_in_seconds" , "0" ),
341
343
resource .TestCheckResourceAttr (resourceName , "schedule.0.expression" , "rate(0 hour)" ),
342
344
acctest .MatchResourceAttrRegionalARN (ctx , resourceName , "engine_arn" , "lambda" , regexache .MustCompile (fmt .Sprintf (`function:cwsyn-%s.+` , rName ))),
343
- acctest .MatchResourceAttrRegionalARN (ctx , resourceName , "source_location_arn" , "lambda" , regexache .MustCompile (fmt .Sprintf (`layer:cwsyn-%s.+` , rName ))),
345
+ // acctest.MatchResourceAttrRegionalARN(ctx, resourceName, "source_location_arn", "lambda", regexache.MustCompile(fmt.Sprintf(`layer:cwsyn-%s.+`, rName))),
344
346
resource .TestCheckResourceAttrPair (resourceName , names .AttrExecutionRoleARN , "aws_iam_role.test" , names .AttrARN ),
345
347
resource .TestCheckResourceAttr (resourceName , "artifact_s3_location" , fmt .Sprintf ("%s/" , rName )),
346
348
),
@@ -606,6 +608,75 @@ func TestAccSyntheticsCanary_vpcIPv6AllowedForDualStack(t *testing.T) {
606
608
})
607
609
}
608
610
611
+ func TestAccSyntheticsCanary_runConfigEphemeralStorage (t * testing.T ) {
612
+ ctx := acctest .Context (t )
613
+ var conf1 , conf2 awstypes.Canary
614
+ rName := fmt .Sprintf ("tf-acc-test-%s" , sdkacctest .RandString (8 ))
615
+ resourceName := "aws_synthetics_canary.test"
616
+ runtimeVersionDataSourceName := "data.aws_synthetics_runtime_version.test"
617
+
618
+ resource .ParallelTest (t , resource.TestCase {
619
+ PreCheck : func () { acctest .PreCheck (ctx , t ) },
620
+ ErrorCheck : acctest .ErrorCheck (t , names .SyntheticsServiceID ),
621
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories ,
622
+ CheckDestroy : testAccCheckCanaryDestroy (ctx ),
623
+ Steps : []resource.TestStep {
624
+ {
625
+ Config : testAccCanaryConfig_runConfigEphemeralStorage (rName , 1024 ),
626
+ Check : resource .ComposeAggregateTestCheckFunc (
627
+ testAccCheckCanaryExists (ctx , resourceName , & conf1 ),
628
+ acctest .MatchResourceAttrRegionalARN (ctx , resourceName , names .AttrARN , "synthetics" , regexache .MustCompile (`canary:.+` )),
629
+ resource .TestCheckResourceAttr (resourceName , names .AttrName , rName ),
630
+ resource .TestCheckResourceAttrPair (resourceName , "runtime_version" , runtimeVersionDataSourceName , "version_name" ),
631
+ resource .TestCheckResourceAttr (resourceName , acctest .CtTagsPercent , "0" ),
632
+ resource .TestCheckResourceAttr (resourceName , "run_config.0.memory_in_mb" , "1500" ),
633
+ resource .TestCheckResourceAttr (resourceName , "run_config.0.timeout_in_seconds" , "840" ),
634
+ resource .TestCheckResourceAttr (resourceName , "run_config.0.ephemeral_storage" , "1024" ),
635
+ resource .TestCheckResourceAttr (resourceName , "schedule.0.duration_in_seconds" , "0" ),
636
+ resource .TestCheckResourceAttr (resourceName , "schedule.0.expression" , "rate(0 hour)" ),
637
+ acctest .MatchResourceAttrRegionalARN (ctx , resourceName , "engine_arn" , "lambda" , regexache .MustCompile (fmt .Sprintf (`function:cwsyn-%s.+` , rName ))),
638
+ //acctest.MatchResourceAttrRegionalARN(ctx, resourceName, "source_location_arn", "lambda", regexache.MustCompile(fmt.Sprintf(`layer:cwsyn-%s.+`, rName))),
639
+ resource .TestCheckResourceAttrPair (resourceName , names .AttrExecutionRoleARN , "aws_iam_role.test" , names .AttrARN ),
640
+ resource .TestCheckResourceAttr (resourceName , "artifact_s3_location" , fmt .Sprintf ("%s/" , rName )),
641
+ resource .TestCheckResourceAttr (resourceName , "timeline.#" , "1" ),
642
+ resource .TestCheckResourceAttrSet (resourceName , "timeline.0.created" ),
643
+ resource .TestCheckResourceAttr (resourceName , names .AttrStatus , "READY" ),
644
+ resource .TestCheckResourceAttr (resourceName , "artifact_config.#" , "0" ),
645
+ ),
646
+ },
647
+ {
648
+ ResourceName : resourceName ,
649
+ ImportState : true ,
650
+ ImportStateVerify : true ,
651
+ ImportStateVerifyIgnore : []string {"zip_file" , "start_canary" , "delete_lambda" },
652
+ },
653
+ {
654
+ Config : testAccCanaryConfig_runConfigEphemeralStorage (rName , 2048 ),
655
+ Check : resource .ComposeAggregateTestCheckFunc (
656
+ testAccCheckCanaryExists (ctx , resourceName , & conf2 ),
657
+ acctest .MatchResourceAttrRegionalARN (ctx , resourceName , names .AttrARN , "synthetics" , regexache .MustCompile (`canary:.+` )),
658
+ resource .TestCheckResourceAttr (resourceName , names .AttrName , rName ),
659
+ resource .TestCheckResourceAttrPair (resourceName , "runtime_version" , runtimeVersionDataSourceName , "version_name" ),
660
+ resource .TestCheckResourceAttr (resourceName , acctest .CtTagsPercent , "0" ),
661
+ resource .TestCheckResourceAttr (resourceName , "run_config.0.memory_in_mb" , "1500" ),
662
+ resource .TestCheckResourceAttr (resourceName , "run_config.0.timeout_in_seconds" , "840" ),
663
+ resource .TestCheckResourceAttr (resourceName , "run_config.0.ephemeral_storage" , "2048" ),
664
+ resource .TestCheckResourceAttr (resourceName , "schedule.0.duration_in_seconds" , "0" ),
665
+ resource .TestCheckResourceAttr (resourceName , "schedule.0.expression" , "rate(0 hour)" ),
666
+ acctest .MatchResourceAttrRegionalARN (ctx , resourceName , "engine_arn" , "lambda" , regexache .MustCompile (fmt .Sprintf (`function:cwsyn-%s.+` , rName ))),
667
+ //acctest.MatchResourceAttrRegionalARN(ctx, resourceName, "source_location_arn", "lambda", regexache.MustCompile(fmt.Sprintf(`layer:cwsyn-%s.+`, rName))),
668
+ resource .TestCheckResourceAttrPair (resourceName , names .AttrExecutionRoleARN , "aws_iam_role.test" , names .AttrARN ),
669
+ resource .TestCheckResourceAttr (resourceName , "artifact_s3_location" , fmt .Sprintf ("%s/" , rName )),
670
+ resource .TestCheckResourceAttr (resourceName , "timeline.#" , "1" ),
671
+ resource .TestCheckResourceAttrSet (resourceName , "timeline.0.created" ),
672
+ resource .TestCheckResourceAttr (resourceName , names .AttrStatus , "READY" ),
673
+ resource .TestCheckResourceAttr (resourceName , "artifact_config.#" , "0" ),
674
+ ),
675
+ },
676
+ },
677
+ })
678
+ }
679
+
609
680
func TestAccSyntheticsCanary_tags (t * testing.T ) {
610
681
ctx := acctest .Context (t )
611
682
var conf awstypes.Canary
@@ -1392,6 +1463,32 @@ resource "aws_synthetics_canary" "test" {
1392
1463
` , rName ))
1393
1464
}
1394
1465
1466
+ func testAccCanaryConfig_runConfigEphemeralStorage (rName string , ephemeralStorage int ) string {
1467
+ return acctest .ConfigCompose (
1468
+ testAccCanaryConfig_base (rName ),
1469
+ fmt .Sprintf (`
1470
+ resource "aws_synthetics_canary" "test" {
1471
+ # Must have bucket versioning enabled first
1472
+ depends_on = [aws_s3_bucket_versioning.test, aws_iam_role.test, aws_iam_role_policy.test]
1473
+
1474
+ name = %[1]q
1475
+ artifact_s3_location = "s3://${aws_s3_bucket.test.bucket}/"
1476
+ execution_role_arn = aws_iam_role.test.arn
1477
+ handler = "exports.handler"
1478
+ zip_file = "test-fixtures/lambdatest.zip"
1479
+ runtime_version = data.aws_synthetics_runtime_version.test.version_name
1480
+ delete_lambda = true
1481
+
1482
+ schedule {
1483
+ expression = "rate(0 minute)"
1484
+ }
1485
+ run_config {
1486
+ ephemeral_storage = %[2]d
1487
+ }
1488
+ }
1489
+ ` , rName , ephemeralStorage ))
1490
+ }
1491
+
1395
1492
func testAccCanaryConfig_tags1 (rName , tagKey1 , tagValue1 string ) string {
1396
1493
return acctest .ConfigCompose (
1397
1494
testAccCanaryConfig_base (rName ),
0 commit comments