chef-provisioning-aws 3.0.4 → 3.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +16 -5
- data/Rakefile +15 -6
- data/chef-provisioning-aws.gemspec +17 -17
- data/lib/chef/provider/aws_auto_scaling_group.rb +5 -6
- data/lib/chef/provider/aws_cache_cluster.rb +21 -15
- data/lib/chef/provider/aws_cache_replication_group.rb +12 -8
- data/lib/chef/provider/aws_cache_subnet_group.rb +3 -3
- data/lib/chef/provider/aws_cloudsearch_domain.rb +9 -13
- data/lib/chef/provider/aws_cloudwatch_alarm.rb +10 -12
- data/lib/chef/provider/aws_dhcp_options.rb +18 -21
- data/lib/chef/provider/aws_ebs_volume.rb +24 -26
- data/lib/chef/provider/aws_eip_address.rb +10 -13
- data/lib/chef/provider/aws_elasticsearch_domain.rb +19 -18
- data/lib/chef/provider/aws_iam_instance_profile.rb +5 -7
- data/lib/chef/provider/aws_iam_role.rb +14 -17
- data/lib/chef/provider/aws_image.rb +6 -6
- data/lib/chef/provider/aws_instance.rb +5 -5
- data/lib/chef/provider/aws_internet_gateway.rb +8 -11
- data/lib/chef/provider/aws_key_pair.rb +15 -17
- data/lib/chef/provider/aws_launch_configuration.rb +11 -14
- data/lib/chef/provider/aws_load_balancer.rb +1 -2
- data/lib/chef/provider/aws_nat_gateway.rb +6 -7
- data/lib/chef/provider/aws_network_acl.rb +28 -29
- data/lib/chef/provider/aws_network_interface.rb +25 -27
- data/lib/chef/provider/aws_rds_instance.rb +12 -13
- data/lib/chef/provider/aws_rds_parameter_group.rb +8 -8
- data/lib/chef/provider/aws_rds_subnet_group.rb +8 -9
- data/lib/chef/provider/aws_route_table.rb +19 -20
- data/lib/chef/provider/aws_s3_bucket.rb +22 -25
- data/lib/chef/provider/aws_security_group.rb +268 -285
- data/lib/chef/provider/aws_server_certificate.rb +6 -5
- data/lib/chef/provider/aws_sns_topic.rb +4 -6
- data/lib/chef/provider/aws_sqs_queue.rb +3 -4
- data/lib/chef/provider/aws_subnet.rb +29 -34
- data/lib/chef/provider/aws_vpc.rb +108 -116
- data/lib/chef/provider/aws_vpc_peering_connection.rb +11 -11
- data/lib/chef/provisioning/aws_driver.rb +4 -2
- data/lib/chef/provisioning/aws_driver/aws_provider.rb +234 -241
- data/lib/chef/provisioning/aws_driver/aws_rds_resource.rb +5 -7
- data/lib/chef/provisioning/aws_driver/aws_resource.rb +182 -185
- data/lib/chef/provisioning/aws_driver/aws_resource_with_entry.rb +17 -17
- data/lib/chef/provisioning/aws_driver/aws_taggable.rb +13 -15
- data/lib/chef/provisioning/aws_driver/aws_tagger.rb +47 -48
- data/lib/chef/provisioning/aws_driver/credentials.rb +96 -100
- data/lib/chef/provisioning/aws_driver/credentials2.rb +42 -45
- data/lib/chef/provisioning/aws_driver/driver.rb +1349 -1362
- data/lib/chef/provisioning/aws_driver/exceptions.rb +10 -12
- data/lib/chef/provisioning/aws_driver/super_lwrp.rb +60 -60
- data/lib/chef/provisioning/aws_driver/tagging_strategy/auto_scaling.rb +49 -50
- data/lib/chef/provisioning/aws_driver/tagging_strategy/ec2.rb +37 -38
- data/lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb +14 -15
- data/lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb +29 -31
- data/lib/chef/provisioning/aws_driver/tagging_strategy/rds.rb +39 -40
- data/lib/chef/provisioning/aws_driver/tagging_strategy/s3.rb +41 -43
- data/lib/chef/provisioning/aws_driver/version.rb +5 -5
- data/lib/chef/provisioning/driver_init/aws.rb +2 -2
- data/lib/chef/resource/aws_auto_scaling_group.rb +1 -1
- data/lib/chef/resource/aws_cache_cluster.rb +9 -12
- data/lib/chef/resource/aws_cache_replication_group.rb +9 -11
- data/lib/chef/resource/aws_cache_subnet_group.rb +8 -10
- data/lib/chef/resource/aws_cloudsearch_domain.rb +4 -5
- data/lib/chef/resource/aws_cloudwatch_alarm.rb +17 -18
- data/lib/chef/resource/aws_dhcp_options.rb +2 -2
- data/lib/chef/resource/aws_ebs_volume.rb +10 -10
- data/lib/chef/resource/aws_eip_address.rb +5 -5
- data/lib/chef/resource/aws_elasticsearch_domain.rb +4 -4
- data/lib/chef/resource/aws_iam_instance_profile.rb +4 -5
- data/lib/chef/resource/aws_iam_role.rb +2 -3
- data/lib/chef/resource/aws_image.rb +3 -3
- data/lib/chef/resource/aws_instance.rb +4 -4
- data/lib/chef/resource/aws_internet_gateway.rb +3 -3
- data/lib/chef/resource/aws_key_pair.rb +7 -7
- data/lib/chef/resource/aws_launch_configuration.rb +4 -4
- data/lib/chef/resource/aws_load_balancer.rb +7 -7
- data/lib/chef/resource/aws_nat_gateway.rb +11 -11
- data/lib/chef/resource/aws_network_acl.rb +7 -8
- data/lib/chef/resource/aws_network_interface.rb +9 -9
- data/lib/chef/resource/aws_rds_instance.rb +4 -4
- data/lib/chef/resource/aws_rds_parameter_group.rb +3 -3
- data/lib/chef/resource/aws_rds_subnet_group.rb +4 -4
- data/lib/chef/resource/aws_route53_hosted_zone.rb +37 -40
- data/lib/chef/resource/aws_route53_record_set.rb +22 -24
- data/lib/chef/resource/aws_route_table.rb +7 -7
- data/lib/chef/resource/aws_s3_bucket.rb +7 -7
- data/lib/chef/resource/aws_security_group.rb +10 -10
- data/lib/chef/resource/aws_server_certificate.rb +6 -8
- data/lib/chef/resource/aws_sns_topic.rb +2 -2
- data/lib/chef/resource/aws_sqs_queue.rb +5 -7
- data/lib/chef/resource/aws_subnet.rb +9 -9
- data/lib/chef/resource/aws_vpc.rb +11 -11
- data/lib/chef/resource/aws_vpc_peering_connection.rb +4 -4
- data/spec/aws_support.rb +44 -45
- data/spec/aws_support/aws_resource_run_wrapper.rb +2 -2
- data/spec/aws_support/deep_matcher.rb +2 -3
- data/spec/aws_support/deep_matcher/fuzzy_match_objects.rb +6 -9
- data/spec/aws_support/deep_matcher/match_values_failure_messages.rb +30 -37
- data/spec/aws_support/deep_matcher/matchable_array.rb +0 -1
- data/spec/aws_support/deep_matcher/matchable_object.rb +1 -2
- data/spec/aws_support/deep_matcher/rspec_monkeypatches.rb +4 -4
- data/spec/aws_support/delayed_stream.rb +2 -2
- data/spec/aws_support/matchers/create_an_aws_object.rb +6 -6
- data/spec/aws_support/matchers/destroy_an_aws_object.rb +6 -6
- data/spec/aws_support/matchers/have_aws_object_tags.rb +4 -5
- data/spec/aws_support/matchers/match_an_aws_object.rb +5 -6
- data/spec/aws_support/matchers/update_an_aws_object.rb +6 -7
- data/spec/integration/aws_auto_scaling_group_spec.rb +56 -64
- data/spec/integration/aws_cache_cluster_spec.rb +70 -71
- data/spec/integration/aws_cache_subnet_group_spec.rb +13 -14
- data/spec/integration/aws_cloudsearch_domain_spec.rb +6 -8
- data/spec/integration/aws_cloudwatch_alarm_spec.rb +200 -208
- data/spec/integration/aws_dhcp_options_spec.rb +32 -43
- data/spec/integration/aws_ebs_volume_spec.rb +52 -73
- data/spec/integration/aws_eip_address_spec.rb +24 -31
- data/spec/integration/aws_elasticsearch_domain_spec.rb +31 -33
- data/spec/integration/aws_iam_instance_profile_spec.rb +36 -45
- data/spec/integration/aws_iam_role_spec.rb +39 -46
- data/spec/integration/aws_internet_gateway_spec.rb +64 -75
- data/spec/integration/aws_key_pair_spec.rb +6 -6
- data/spec/integration/aws_launch_configuration_spec.rb +17 -18
- data/spec/integration/aws_nat_gateway_spec.rb +21 -24
- data/spec/integration/aws_network_acl_spec.rb +81 -95
- data/spec/integration/aws_network_interface_spec.rb +28 -43
- data/spec/integration/aws_rds_instance_spec.rb +29 -40
- data/spec/integration/aws_rds_parameter_group_spec.rb +32 -35
- data/spec/integration/aws_rds_subnet_group_spec.rb +30 -40
- data/spec/integration/aws_route53_hosted_zone_spec.rb +205 -205
- data/spec/integration/aws_route_table_spec.rb +118 -136
- data/spec/integration/aws_s3_bucket_spec.rb +19 -27
- data/spec/integration/aws_security_group_spec.rb +369 -388
- data/spec/integration/aws_server_certificate_spec.rb +16 -18
- data/spec/integration/aws_subnet_spec.rb +44 -58
- data/spec/integration/aws_vpc_peering_connection_spec.rb +43 -50
- data/spec/integration/aws_vpc_spec.rb +99 -115
- data/spec/integration/load_balancer_spec.rb +169 -183
- data/spec/integration/machine_batch_spec.rb +24 -31
- data/spec/integration/machine_image_spec.rb +54 -66
- data/spec/integration/machine_spec.rb +216 -237
- data/spec/persistence_file.txt +219 -0
- data/spec/spec_helper.rb +16 -17
- data/spec/unit/chef/provisioning/aws_driver/credentials_spec.rb +67 -74
- data/spec/unit/chef/provisioning/aws_driver/driver_spec.rb +29 -29
- data/spec/unit/chef/provisioning/aws_driver/route53_spec.rb +13 -15
- metadata +4 -3
@@ -1,71 +1,70 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
describe Chef::Resource::AwsCacheCluster, :super_slow do
|
4
|
-
extend AWSSupport
|
5
|
-
|
6
|
-
when_the_chef_12_server "exists", organization:
|
7
|
-
with_aws "with a VPC, subnet, subnet_group and security_group" do
|
8
|
-
after(:context) do
|
9
|
-
# Cache Cluster takes around 7 minutes to get deleted
|
10
|
-
# and all the dependent resources can be deleted after that only.
|
11
|
-
# Hence waiting for 8 minutes.
|
12
|
-
sleep(480)
|
13
|
-
converge
|
14
|
-
aws_cache_subnet_group
|
15
|
-
action :destroy
|
16
|
-
end
|
17
|
-
|
18
|
-
aws_vpc "test_vpc" do
|
19
|
-
action :purge
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
it "aws_cache_cluster 'TestRedisCluster' creates a cache cluster" do
|
25
|
-
converge
|
26
|
-
aws_vpc "test_vpc" do
|
27
|
-
cidr_block
|
28
|
-
internet_gateway true
|
29
|
-
end
|
30
|
-
|
31
|
-
aws_subnet "test_subnet" do
|
32
|
-
vpc
|
33
|
-
cidr_block "10.0.0.0/24"
|
34
|
-
end
|
35
|
-
|
36
|
-
aws_cache_subnet_group
|
37
|
-
description
|
38
|
-
subnets [
|
39
|
-
end
|
40
|
-
|
41
|
-
aws_security_group
|
42
|
-
vpc
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
expect_recipe
|
47
|
-
aws_cache_cluster
|
48
|
-
az_mode
|
49
|
-
engine
|
50
|
-
engine_version
|
51
|
-
node_type
|
52
|
-
number_nodes 1
|
53
|
-
security_groups
|
54
|
-
subnet_group_name
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
end
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Chef::Resource::AwsCacheCluster, :super_slow do
|
4
|
+
extend AWSSupport
|
5
|
+
|
6
|
+
when_the_chef_12_server "exists", organization: "foo", server_scope: :context do
|
7
|
+
with_aws "with a VPC, subnet, subnet_group and security_group" do
|
8
|
+
after(:context) do
|
9
|
+
# Cache Cluster takes around 7 minutes to get deleted
|
10
|
+
# and all the dependent resources can be deleted after that only.
|
11
|
+
# Hence waiting for 8 minutes.
|
12
|
+
sleep(480)
|
13
|
+
converge do
|
14
|
+
aws_cache_subnet_group "test-subnet-group" do
|
15
|
+
action :destroy
|
16
|
+
end
|
17
|
+
|
18
|
+
aws_vpc "test_vpc" do
|
19
|
+
action :purge
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it "aws_cache_cluster 'TestRedisCluster' creates a cache cluster" do
|
25
|
+
converge do
|
26
|
+
aws_vpc "test_vpc" do
|
27
|
+
cidr_block "10.0.0.0/24"
|
28
|
+
internet_gateway true
|
29
|
+
end
|
30
|
+
|
31
|
+
aws_subnet "test_subnet" do
|
32
|
+
vpc "test_vpc"
|
33
|
+
cidr_block "10.0.0.0/24"
|
34
|
+
end
|
35
|
+
|
36
|
+
aws_cache_subnet_group "test-subnet-group" do
|
37
|
+
description "Test Subnet Group"
|
38
|
+
subnets ["test_subnet"]
|
39
|
+
end
|
40
|
+
|
41
|
+
aws_security_group "test_sg" do
|
42
|
+
vpc "test_vpc"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
expect_recipe do
|
47
|
+
aws_cache_cluster "TestRedisCluster" do
|
48
|
+
az_mode "single-az"
|
49
|
+
engine "redis"
|
50
|
+
engine_version "3.2.6"
|
51
|
+
node_type "cache.t2.micro"
|
52
|
+
number_nodes 1
|
53
|
+
security_groups "test_sg"
|
54
|
+
subnet_group_name "test-subnet-group"
|
55
|
+
end
|
56
|
+
end.to create_an_aws_cache_cluster("TestRedisCluster",
|
57
|
+
cache_cluster_id: "testrediscluster",
|
58
|
+
cache_node_type: "cache.t2.micro",
|
59
|
+
engine: "redis",
|
60
|
+
engine_version: "3.2.6",
|
61
|
+
num_cache_nodes: 1,
|
62
|
+
pending_modified_values: {},
|
63
|
+
cache_security_groups: [],
|
64
|
+
cache_parameter_group:
|
65
|
+
{ cache_parameter_group_name: "default.redis3.2", parameter_apply_status: "in-sync", cache_node_ids_to_reboot: [] },
|
66
|
+
cache_subnet_group_name: "test-subnet-group").and be_idempotent
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -1,32 +1,31 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Chef::Resource::AwsCacheSubnetGroup do
|
4
4
|
extend AWSSupport
|
5
5
|
|
6
|
-
when_the_chef_12_server "exists", organization:
|
6
|
+
when_the_chef_12_server "exists", organization: "foo", server_scope: :context do
|
7
7
|
with_aws "with a VPC with an internet gateway and subnet" do
|
8
8
|
aws_vpc "test_vpc" do
|
9
|
-
cidr_block
|
9
|
+
cidr_block "10.0.0.0/24"
|
10
10
|
internet_gateway true
|
11
11
|
end
|
12
12
|
|
13
13
|
aws_subnet "test_subnet" do
|
14
|
-
vpc
|
14
|
+
vpc "test_vpc"
|
15
15
|
cidr_block "10.0.0.0/24"
|
16
16
|
end
|
17
17
|
|
18
18
|
it "aws_cache_subnet_group 'test-subnet-group' creates a cache subnet group" do
|
19
|
-
expect_recipe
|
20
|
-
aws_cache_subnet_group
|
21
|
-
description
|
22
|
-
subnets [
|
19
|
+
expect_recipe do
|
20
|
+
aws_cache_subnet_group "test-subnet-group" do
|
21
|
+
description "Test Subnet Group"
|
22
|
+
subnets ["test_subnet"]
|
23
23
|
end
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
).and be_idempotent
|
24
|
+
end.to create_an_aws_cache_subnet_group("test-subnet-group",
|
25
|
+
vpc_id: test_vpc.aws_object.id,
|
26
|
+
subnets: [
|
27
|
+
{ subnet_identifier: test_subnet.aws_object.id }
|
28
|
+
]).and be_idempotent
|
30
29
|
end
|
31
30
|
end
|
32
31
|
end
|
@@ -1,31 +1,29 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Chef::Resource::AwsCloudsearchDomain do
|
4
4
|
extend AWSSupport
|
5
5
|
when_the_chef_12_server "exists", organization: "foo", server_scope: :context do
|
6
6
|
with_aws "when connected to AWS" do
|
7
|
-
|
8
7
|
# Cloudsearch can take forevvvver to delete so we need to randomize our names
|
9
|
-
time = DateTime.now.strftime(
|
8
|
+
time = DateTime.now.strftime("%Q")
|
10
9
|
|
11
10
|
it "aws_cloudsearch_domain 'test-#{time}' creates a cloudsearch domain" do
|
12
|
-
expect_recipe
|
11
|
+
expect_recipe do
|
13
12
|
aws_cloudsearch_domain "test-#{time}" do
|
14
13
|
multi_az false
|
15
14
|
end
|
16
|
-
|
15
|
+
end.to create_an_aws_cloudsearch_domain("test-#{time}", {}).and be_idempotent
|
17
16
|
end
|
18
17
|
|
19
18
|
it "returns nil when aws_object is called for something that does not exist" do
|
20
19
|
r = nil
|
21
|
-
converge
|
20
|
+
converge do
|
22
21
|
r = aws_cloudsearch_domain "wont-exist" do
|
23
22
|
action :nothing
|
24
23
|
end
|
25
|
-
|
24
|
+
end
|
26
25
|
expect(r.aws_object).to eq(nil)
|
27
26
|
end
|
28
|
-
|
29
27
|
end
|
30
28
|
end
|
31
29
|
end
|
@@ -1,286 +1,278 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Chef::Resource::AwsCloudwatchAlarm do
|
4
4
|
extend AWSSupport
|
5
5
|
|
6
|
-
when_the_chef_12_server
|
7
|
-
with_aws
|
8
|
-
|
9
|
-
aws_sns_topic
|
10
|
-
aws_sns_topic 'mytesttopic2'
|
6
|
+
when_the_chef_12_server "exists", organization: "foo", server_scope: :context do
|
7
|
+
with_aws "When connected to AWS" do
|
8
|
+
aws_sns_topic "mytesttopic1"
|
9
|
+
aws_sns_topic "mytesttopic2"
|
11
10
|
|
12
11
|
it "creates an aws_cloudwatch_alarm with minimum properties" do
|
13
|
-
expect_recipe
|
14
|
-
aws_cloudwatch_alarm
|
15
|
-
namespace
|
16
|
-
metric_name
|
17
|
-
comparison_operator
|
12
|
+
expect_recipe do
|
13
|
+
aws_cloudwatch_alarm "my-test-alert" do
|
14
|
+
namespace "AWS/EC2"
|
15
|
+
metric_name "CPUUtilization"
|
16
|
+
comparison_operator "GreaterThanThreshold"
|
18
17
|
evaluation_periods 1
|
19
18
|
period 60
|
20
|
-
statistic
|
19
|
+
statistic "Average"
|
21
20
|
threshold 80
|
22
21
|
end
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
22
|
+
end.to create_an_aws_cloudwatch_alarm("my-test-alert",
|
23
|
+
namespace: "AWS/EC2",
|
24
|
+
metric_name: "CPUUtilization",
|
25
|
+
comparison_operator: "GreaterThanThreshold",
|
26
|
+
evaluation_periods: 1,
|
27
|
+
period: 60,
|
28
|
+
statistic: "Average",
|
29
|
+
threshold: 80,
|
30
|
+
actions_enabled: true # this is true by default
|
31
|
+
).and be_idempotent
|
33
32
|
end
|
34
33
|
|
35
34
|
it "creates an aws_cloudwatch_alarm with maximum properties" do
|
36
|
-
expect_recipe
|
37
|
-
aws_cloudwatch_alarm
|
38
|
-
namespace
|
39
|
-
metric_name
|
40
|
-
comparison_operator
|
35
|
+
expect_recipe do
|
36
|
+
aws_cloudwatch_alarm "my-test-alert" do
|
37
|
+
namespace "AWS/EC2"
|
38
|
+
metric_name "CPUUtilization"
|
39
|
+
comparison_operator "GreaterThanThreshold"
|
41
40
|
evaluation_periods 1
|
42
41
|
period 60
|
43
|
-
statistic
|
42
|
+
statistic "Average"
|
44
43
|
threshold 80
|
45
44
|
dimensions([
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
insufficient_data_actions [
|
56
|
-
ok_actions [
|
57
|
-
alarm_actions [
|
45
|
+
{
|
46
|
+
name: "foo1",
|
47
|
+
value: "bar1"
|
48
|
+
},
|
49
|
+
{
|
50
|
+
name: "foo2",
|
51
|
+
value: "bar2"
|
52
|
+
}
|
53
|
+
])
|
54
|
+
insufficient_data_actions ["mytesttopic1"]
|
55
|
+
ok_actions ["mytesttopic1"]
|
56
|
+
alarm_actions ["mytesttopic1"]
|
58
57
|
actions_enabled false
|
59
58
|
alarm_description "description"
|
60
59
|
unit "Percent"
|
61
60
|
end
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
).and be_idempotent
|
61
|
+
end.to create_an_aws_cloudwatch_alarm("my-test-alert",
|
62
|
+
namespace: "AWS/EC2",
|
63
|
+
metric_name: "CPUUtilization",
|
64
|
+
comparison_operator: "GreaterThanThreshold",
|
65
|
+
evaluation_periods: 1,
|
66
|
+
period: 60,
|
67
|
+
statistic: "Average",
|
68
|
+
threshold: 80,
|
69
|
+
dimensions: [
|
70
|
+
{
|
71
|
+
name: "foo1",
|
72
|
+
value: "bar1"
|
73
|
+
},
|
74
|
+
{
|
75
|
+
name: "foo2",
|
76
|
+
value: "bar2"
|
77
|
+
}
|
78
|
+
],
|
79
|
+
insufficient_data_actions: [mytesttopic1.aws_object.attributes["TopicArn"]],
|
80
|
+
ok_actions: [mytesttopic1.aws_object.attributes["TopicArn"]],
|
81
|
+
alarm_actions: [mytesttopic1.aws_object.attributes["TopicArn"]],
|
82
|
+
actions_enabled: false,
|
83
|
+
alarm_description: "description",
|
84
|
+
unit: "Percent").and be_idempotent
|
87
85
|
end
|
88
86
|
|
89
87
|
context "with an existing minimum cloudwatch alarm" do
|
90
|
-
aws_cloudwatch_alarm
|
91
|
-
namespace
|
92
|
-
metric_name
|
93
|
-
comparison_operator
|
88
|
+
aws_cloudwatch_alarm "my-test-alert" do
|
89
|
+
namespace "AWS/EC2"
|
90
|
+
metric_name "CPUUtilization"
|
91
|
+
comparison_operator "GreaterThanThreshold"
|
94
92
|
evaluation_periods 1
|
95
93
|
period 60
|
96
|
-
statistic
|
94
|
+
statistic "Average"
|
97
95
|
threshold 80
|
98
96
|
end
|
99
97
|
|
100
98
|
it "updates an aws_cloudwatch_alarm with maximum properties" do
|
101
|
-
expect_recipe
|
102
|
-
aws_cloudwatch_alarm
|
103
|
-
namespace
|
104
|
-
metric_name
|
105
|
-
comparison_operator
|
99
|
+
expect_recipe do
|
100
|
+
aws_cloudwatch_alarm "my-test-alert" do
|
101
|
+
namespace "AWS/EC2"
|
102
|
+
metric_name "CPUUtilization"
|
103
|
+
comparison_operator "GreaterThanThreshold"
|
106
104
|
evaluation_periods 1
|
107
105
|
period 60
|
108
|
-
statistic
|
106
|
+
statistic "Average"
|
109
107
|
threshold 80
|
110
108
|
dimensions([
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
insufficient_data_actions [
|
121
|
-
ok_actions [
|
122
|
-
alarm_actions [
|
109
|
+
{
|
110
|
+
name: "foo1",
|
111
|
+
value: "bar1"
|
112
|
+
},
|
113
|
+
{
|
114
|
+
name: "foo2",
|
115
|
+
value: "bar2"
|
116
|
+
}
|
117
|
+
])
|
118
|
+
insufficient_data_actions ["mytesttopic1"]
|
119
|
+
ok_actions ["mytesttopic1"]
|
120
|
+
alarm_actions ["mytesttopic1"]
|
123
121
|
actions_enabled false
|
124
122
|
alarm_description "description"
|
125
123
|
unit "Percent"
|
126
124
|
end
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
).and be_idempotent
|
125
|
+
end.to update_an_aws_cloudwatch_alarm("my-test-alert",
|
126
|
+
namespace: "AWS/EC2",
|
127
|
+
metric_name: "CPUUtilization",
|
128
|
+
comparison_operator: "GreaterThanThreshold",
|
129
|
+
evaluation_periods: 1,
|
130
|
+
period: 60,
|
131
|
+
statistic: "Average",
|
132
|
+
threshold: 80,
|
133
|
+
dimensions: [
|
134
|
+
{
|
135
|
+
name: "foo1",
|
136
|
+
value: "bar1"
|
137
|
+
},
|
138
|
+
{
|
139
|
+
name: "foo2",
|
140
|
+
value: "bar2"
|
141
|
+
}
|
142
|
+
],
|
143
|
+
insufficient_data_actions: [mytesttopic1.aws_object.attributes["TopicArn"]],
|
144
|
+
ok_actions: [mytesttopic1.aws_object.attributes["TopicArn"]],
|
145
|
+
alarm_actions: [mytesttopic1.aws_object.attributes["TopicArn"]],
|
146
|
+
actions_enabled: false,
|
147
|
+
alarm_description: "description",
|
148
|
+
unit: "Percent").and be_idempotent
|
152
149
|
end
|
153
|
-
|
154
150
|
end
|
155
151
|
|
156
152
|
context "with an existing maximum cloudwatch alarm" do
|
157
|
-
aws_cloudwatch_alarm
|
158
|
-
namespace
|
159
|
-
metric_name
|
160
|
-
comparison_operator
|
153
|
+
aws_cloudwatch_alarm "my-test-alert" do
|
154
|
+
namespace "AWS/EC2"
|
155
|
+
metric_name "CPUUtilization"
|
156
|
+
comparison_operator "GreaterThanThreshold"
|
161
157
|
evaluation_periods 1
|
162
158
|
period 60
|
163
|
-
statistic
|
159
|
+
statistic "Average"
|
164
160
|
threshold 80
|
165
161
|
dimensions([
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
insufficient_data_actions [
|
176
|
-
ok_actions [
|
177
|
-
alarm_actions [
|
162
|
+
{
|
163
|
+
name: "foo1",
|
164
|
+
value: "bar1"
|
165
|
+
},
|
166
|
+
{
|
167
|
+
name: "foo2",
|
168
|
+
value: "bar2"
|
169
|
+
}
|
170
|
+
])
|
171
|
+
insufficient_data_actions ["mytesttopic1"]
|
172
|
+
ok_actions ["mytesttopic1"]
|
173
|
+
alarm_actions ["mytesttopic1"]
|
178
174
|
actions_enabled false
|
179
175
|
alarm_description "description"
|
180
176
|
unit "Percent"
|
181
177
|
end
|
182
178
|
|
183
179
|
it "updates all updateable attributes" do
|
184
|
-
expect_recipe
|
185
|
-
aws_cloudwatch_alarm
|
186
|
-
namespace
|
187
|
-
metric_name
|
188
|
-
comparison_operator
|
180
|
+
expect_recipe do
|
181
|
+
aws_cloudwatch_alarm "my-test-alert" do
|
182
|
+
namespace "AWS/S3"
|
183
|
+
metric_name "foo"
|
184
|
+
comparison_operator "LessThanThreshold"
|
189
185
|
evaluation_periods 2
|
190
186
|
period 120
|
191
|
-
statistic
|
187
|
+
statistic "Maximum"
|
192
188
|
threshold 70
|
193
189
|
dimensions([
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
insufficient_data_actions [
|
200
|
-
ok_actions
|
201
|
-
alarm_actions [
|
190
|
+
{
|
191
|
+
name: "foo3",
|
192
|
+
value: "bar3"
|
193
|
+
}
|
194
|
+
])
|
195
|
+
insufficient_data_actions ["mytesttopic2"]
|
196
|
+
ok_actions %w{mytesttopic1 mytesttopic2}
|
197
|
+
alarm_actions ["mytesttopic2"]
|
202
198
|
actions_enabled true
|
203
199
|
alarm_description "description2"
|
204
200
|
unit "Bits"
|
205
201
|
end
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
).and be_idempotent
|
202
|
+
end.to update_an_aws_cloudwatch_alarm("my-test-alert",
|
203
|
+
namespace: "AWS/S3",
|
204
|
+
metric_name: "foo",
|
205
|
+
comparison_operator: "LessThanThreshold",
|
206
|
+
evaluation_periods: 2,
|
207
|
+
period: 120,
|
208
|
+
statistic: "Maximum",
|
209
|
+
threshold: 70,
|
210
|
+
dimensions: [
|
211
|
+
{
|
212
|
+
name: "foo3",
|
213
|
+
value: "bar3"
|
214
|
+
}
|
215
|
+
],
|
216
|
+
insufficient_data_actions: [mytesttopic2.aws_object.attributes["TopicArn"]],
|
217
|
+
ok_actions: Set[mytesttopic1.aws_object.attributes["TopicArn"], mytesttopic2.aws_object.attributes["TopicArn"]],
|
218
|
+
alarm_actions: [mytesttopic2.aws_object.attributes["TopicArn"]],
|
219
|
+
actions_enabled: true,
|
220
|
+
alarm_description: "description2",
|
221
|
+
unit: "Bits").and be_idempotent
|
227
222
|
end
|
228
223
|
|
229
224
|
it "updates only the specified properties" do
|
230
|
-
expect_recipe
|
231
|
-
aws_cloudwatch_alarm
|
225
|
+
expect_recipe do
|
226
|
+
aws_cloudwatch_alarm "my-test-alert" do
|
232
227
|
unit "Gigabytes"
|
233
228
|
end
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
).and be_idempotent
|
229
|
+
end.to update_an_aws_cloudwatch_alarm("my-test-alert",
|
230
|
+
namespace: "AWS/S3",
|
231
|
+
metric_name: "foo",
|
232
|
+
comparison_operator: "LessThanThreshold",
|
233
|
+
evaluation_periods: 2,
|
234
|
+
period: 120,
|
235
|
+
statistic: "Maximum",
|
236
|
+
threshold: 70,
|
237
|
+
dimensions: [
|
238
|
+
{
|
239
|
+
name: "foo3",
|
240
|
+
value: "bar3"
|
241
|
+
}
|
242
|
+
],
|
243
|
+
insufficient_data_actions: [mytesttopic2.aws_object.attributes["TopicArn"]],
|
244
|
+
ok_actions: Set[mytesttopic1.aws_object.attributes["TopicArn"], mytesttopic2.aws_object.attributes["TopicArn"]],
|
245
|
+
alarm_actions: [mytesttopic2.aws_object.attributes["TopicArn"]],
|
246
|
+
actions_enabled: true,
|
247
|
+
alarm_description: "description2",
|
248
|
+
unit: "Gigabytes").and be_idempotent
|
255
249
|
end
|
256
250
|
|
257
251
|
it "clears out all clearable arrays" do
|
258
|
-
expect_recipe
|
259
|
-
aws_cloudwatch_alarm
|
252
|
+
expect_recipe do
|
253
|
+
aws_cloudwatch_alarm "my-test-alert" do
|
260
254
|
dimensions []
|
261
255
|
insufficient_data_actions []
|
262
256
|
ok_actions []
|
263
257
|
alarm_actions []
|
264
258
|
end
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
).and be_idempotent
|
259
|
+
end.to create_an_aws_cloudwatch_alarm("my-test-alert",
|
260
|
+
namespace: "AWS/S3",
|
261
|
+
metric_name: "foo",
|
262
|
+
comparison_operator: "LessThanThreshold",
|
263
|
+
evaluation_periods: 2,
|
264
|
+
period: 120,
|
265
|
+
statistic: "Maximum",
|
266
|
+
threshold: 70,
|
267
|
+
dimensions: [],
|
268
|
+
insufficient_data_actions: [],
|
269
|
+
ok_actions: [],
|
270
|
+
alarm_actions: [],
|
271
|
+
actions_enabled: true,
|
272
|
+
alarm_description: "description2",
|
273
|
+
unit: "Gigabytes").and be_idempotent
|
281
274
|
end
|
282
275
|
end
|
283
|
-
|
284
276
|
end
|
285
277
|
end
|
286
278
|
end
|