chef-boneyard / chef-provisioning-aws

AWS driver and resources for Chef that uses the AWS SDK
Apache License 2.0
142 stars 121 forks source link

NoMethodError: undefined method 'scaling_policies' for nil:NilClass #491

Closed amsharm closed 8 years ago

amsharm commented 8 years ago

I'm new to Chef, so I knew I'm probably overlooking something simple, but I would appreciate any help. The line that's causing this error is: alarm_actions [scaling_group.aws_object.scaling_policies['policy'].arn ]. I have the rest of the code below. What's strange is that I ran this earlier today, and it worked perfectly fine. I don't think I changed anything.

aws_launch_configuration 'launch-config' do image node['AmiID'] instance_type 't2.micro' end

scaling_group = aws_auto_scaling_group 'testingggg' do availability_zones ['us-east-1a', 'us-east-1c'] launch_configuration 'launch-config' max_size 2 min_size 1 desired_capacity 1 scaling_policies( 'policy' => { adjustment_type: 'ChangeInCapacity', scaling_adjustment: 1 } ) end

aws_cloudwatch_alarm 'Alarm' do namespace 'AWS/EC2' metric_name 'CPUUtilization' comparison_operator 'GreaterThanThreshold' evaluation_periods 2 period 60 statistic 'Average' threshold 1 alarm_actions [ scaling_group.aws_object.scaling_policies['policy'].arn ] end