@@ -28,6 +28,25 @@ func TestAccAWSAutoscalingSchedule_basic(t *testing.T) {
2828 })
2929}
3030
31+ func TestAccAWSAutoscalingSchedule_recurrence (t * testing.T ) {
32+ var schedule autoscaling.ScheduledUpdateGroupAction
33+
34+ resource .Test (t , resource.TestCase {
35+ PreCheck : func () { testAccPreCheck (t ) },
36+ Providers : testAccProviders ,
37+ CheckDestroy : testAccCheckAWSAutoscalingScheduleDestroy ,
38+ Steps : []resource.TestStep {
39+ resource.TestStep {
40+ Config : testAccAWSAutoscalingScheduleConfig_recurrence ,
41+ Check : resource .ComposeTestCheckFunc (
42+ testAccCheckScalingScheduleExists ("aws_autoscaling_schedule.foobar" , & schedule ),
43+ resource .TestCheckResourceAttr ("aws_autoscaling_schedule.foobar" , "recurrence" , "0 8 * * *" ),
44+ ),
45+ },
46+ },
47+ })
48+ }
49+
3150func testAccCheckScalingScheduleExists (n string , policy * autoscaling.ScheduledUpdateGroupAction ) resource.TestCheckFunc {
3251 return func (s * terraform.State ) error {
3352 rs , ok := s .RootModule ().Resources [n ]
@@ -115,3 +134,37 @@ resource "aws_autoscaling_schedule" "foobar" {
115134 autoscaling_group_name = "${aws_autoscaling_group.foobar.name}"
116135}
117136` )
137+
138+ var testAccAWSAutoscalingScheduleConfig_recurrence = fmt .Sprintf (`
139+ resource "aws_launch_configuration" "foobar" {
140+ name = "terraform-test-foobar5"
141+ image_id = "ami-21f78e11"
142+ instance_type = "t1.micro"
143+ }
144+
145+ resource "aws_autoscaling_group" "foobar" {
146+ availability_zones = ["us-west-2a"]
147+ name = "terraform-test-foobar5"
148+ max_size = 1
149+ min_size = 1
150+ health_check_grace_period = 300
151+ health_check_type = "ELB"
152+ force_delete = true
153+ termination_policies = ["OldestInstance"]
154+ launch_configuration = "${aws_launch_configuration.foobar.name}"
155+ tag {
156+ key = "Foo"
157+ value = "foo-bar"
158+ propagate_at_launch = true
159+ }
160+ }
161+
162+ resource "aws_autoscaling_schedule" "foobar" {
163+ scheduled_action_name = "foobar"
164+ min_size = 0
165+ max_size = 1
166+ desired_capacity = 0
167+ recurrence = "0 8 * * *"
168+ autoscaling_group_name = "${aws_autoscaling_group.foobar.name}"
169+ }
170+ ` )
0 commit comments