kumogata-template 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +54 -0
- data/.travis.yml +8 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +75 -0
- data/README.md +204 -0
- data/Rakefile +23 -0
- data/bin/kumogata-template +9 -0
- data/kumogata-template.gemspec +26 -0
- data/lib/kumogata/template.rb +17 -0
- data/lib/kumogata/template/autoscaling.rb +77 -0
- data/lib/kumogata/template/cloudwatch.rb +28 -0
- data/lib/kumogata/template/codedeploy.rb +85 -0
- data/lib/kumogata/template/const.rb +175 -0
- data/lib/kumogata/template/datapipeline.rb +90 -0
- data/lib/kumogata/template/dynamodb.rb +111 -0
- data/lib/kumogata/template/ec2.rb +165 -0
- data/lib/kumogata/template/ecs.rb +119 -0
- data/lib/kumogata/template/elasticbeanstalk.rb +33 -0
- data/lib/kumogata/template/elb.rb +132 -0
- data/lib/kumogata/template/emr.rb +166 -0
- data/lib/kumogata/template/events.rb +25 -0
- data/lib/kumogata/template/ext/argument_parser.rb +8 -0
- data/lib/kumogata/template/ext/kumogata.rb +103 -0
- data/lib/kumogata/template/helper.rb +211 -0
- data/lib/kumogata/template/iam.rb +96 -0
- data/lib/kumogata/template/lambda.rb +34 -0
- data/lib/kumogata/template/s3.rb +223 -0
- data/lib/kumogata/template/sns.rb +25 -0
- data/lib/kumogata/template/version.rb +1 -0
- data/template/_template.rb +25 -0
- data/template/autoscaling-group.rb +47 -0
- data/template/autoscaling-launch-configuration.rb +54 -0
- data/template/autoscaling-lifecycle-hook.rb +27 -0
- data/template/autoscaling-scaling-policy.rb +33 -0
- data/template/autoscaling-scheduled-action.rb +37 -0
- data/template/cloudtrail.rb +39 -0
- data/template/cloudwatch-alarm.rb +45 -0
- data/template/codedeploy-application.rb +15 -0
- data/template/codedeploy-deployment-config.rb +23 -0
- data/template/codedeploy-deployment-group.rb +35 -0
- data/template/datapipeline-pipeline.rb +28 -0
- data/template/dynamodb-table.rb +33 -0
- data/template/ec2-eip-association.rb +23 -0
- data/template/ec2-eip.rb +17 -0
- data/template/ec2-instance.rb +65 -0
- data/template/ec2-internet-gateway.rb +15 -0
- data/template/ec2-nat-gateway.rb +17 -0
- data/template/ec2-network-acl-entry.rb +30 -0
- data/template/ec2-network-acl.rb +17 -0
- data/template/ec2-route-table.rb +17 -0
- data/template/ec2-route.rb +27 -0
- data/template/ec2-security-group.rb +24 -0
- data/template/ec2-subnet-network-acl-association.rb +17 -0
- data/template/ec2-subnet-route-table-association.rb +17 -0
- data/template/ec2-subnet.rb +23 -0
- data/template/ec2-volume-attachment.rb +19 -0
- data/template/ec2-volume.rb +31 -0
- data/template/ec2-vpc-endpoint.rb +23 -0
- data/template/ec2-vpc-gateway-attachment.rb +19 -0
- data/template/ec2-vpc.rb +24 -0
- data/template/ecs-cluster.rb +11 -0
- data/template/ecs-service.rb +24 -0
- data/template/ecs-task-definition.rb +18 -0
- data/template/elasticache-cache-cluster.rb +63 -0
- data/template/elasticache-parameter-group.rb +20 -0
- data/template/elasticache-replication-group.rb +58 -0
- data/template/elasticache-subnet-group.rb +17 -0
- data/template/elasticbeanstalk-application-version.rb +24 -0
- data/template/elasticbeanstalk-application.rb +17 -0
- data/template/elasticbeanstalk-configuration-template.rb +31 -0
- data/template/elasticbeanstalk-environment.rb +44 -0
- data/template/elb-loadbalancer.rb +46 -0
- data/template/emr-cluster.rb +39 -0
- data/template/emr-instance-group-config.rb +33 -0
- data/template/emr-step.rb +22 -0
- data/template/events-rule.rb +28 -0
- data/template/iam-access-key.rb +19 -0
- data/template/iam-group.rb +20 -0
- data/template/iam-instance-profile.rb +17 -0
- data/template/iam-managed-policy.rb +28 -0
- data/template/iam-policy.rb +26 -0
- data/template/iam-role.rb +21 -0
- data/template/iam-user-to-group-addition.rb +17 -0
- data/template/iam-user.rb +24 -0
- data/template/lambda-alias.rb +21 -0
- data/template/lambda-event-source-mapping.rb +24 -0
- data/template/lambda-function.rb +34 -0
- data/template/lambda-permission.rb +26 -0
- data/template/lambda-version.rb +19 -0
- data/template/mappings-ec2.rb +85 -0
- data/template/output-access-key.rb +6 -0
- data/template/output-arn.rb +6 -0
- data/template/output-autoscaling.rb +6 -0
- data/template/output-az.rb +6 -0
- data/template/output-dynamodb.rb +6 -0
- data/template/output-ec2.rb +8 -0
- data/template/output-elasticache.rb +30 -0
- data/template/output-elb.rb +12 -0
- data/template/output-emr.rb +6 -0
- data/template/output-rds.rb +10 -0
- data/template/output-redshift.rb +10 -0
- data/template/output-s3.rb +8 -0
- data/template/output-security-group.rb +5 -0
- data/template/output-sqs.rb +5 -0
- data/template/output-topic.rb +6 -0
- data/template/output-vpc.rb +10 -0
- data/template/output.rb +29 -0
- data/template/parameter-ec2.rb +22 -0
- data/template/parameter-elasticache.rb +9 -0
- data/template/parameter-rds.rb +9 -0
- data/template/parameter-redshift.rb +9 -0
- data/template/parameter.rb +20 -0
- data/template/rds-db-cluster-parameter-group.rb +22 -0
- data/template/rds-db-cluster.rb +47 -0
- data/template/rds-db-instance.rb +82 -0
- data/template/rds-db-parameter-group.rb +21 -0
- data/template/rds-db-subnet-group.rb +19 -0
- data/template/rds-event-subscription.rb +42 -0
- data/template/rds-option-group.rb +23 -0
- data/template/redshift-cluster-parameter-group.rb +19 -0
- data/template/redshift-cluster-subnet-group.rb +17 -0
- data/template/redshift-cluster.rb +60 -0
- data/template/s3-bucket-policy.rb +20 -0
- data/template/s3-bucket.rb +42 -0
- data/template/sns-topic.rb +20 -0
- data/template/sqs-queue.rb +27 -0
- data/test/_template.rb +26 -0
- data/test/abstract_unit.rb +101 -0
- data/test/autoscaling_test.rb +109 -0
- data/test/codedeploy_test.rb +117 -0
- data/test/datapipeline_test.rb +142 -0
- data/test/dynamodb_test.rb +184 -0
- data/test/ec2_test.rb +286 -0
- data/test/ecs_test.rb +135 -0
- data/test/elasticbeanstalk_test.rb +56 -0
- data/test/elb_test.rb +147 -0
- data/test/emr_test.rb +193 -0
- data/test/events_test.rb +22 -0
- data/test/helper_test.rb +547 -0
- data/test/iam_test.rb +93 -0
- data/test/lambda_test.rb +41 -0
- data/test/s3_test.rb +195 -0
- data/test/sns_test.rb +27 -0
- data/test/template/autoscaling-group_test.rb +177 -0
- data/test/template/autoscaling-launch-configuration_test.rb +117 -0
- data/test/template/autoscaling-lifecycle-hook_test.rb +33 -0
- data/test/template/autoscaling-scaling-policy_test.rb +26 -0
- data/test/template/autoscaling-scheduled-action_test.rb +26 -0
- data/test/template/cloudtrail_test.rb +55 -0
- data/test/template/cloudwatch-alarm_test.rb +38 -0
- data/test/template/codedeploy-application_test.rb +21 -0
- data/test/template/codedeploy-deployment-config_test.rb +26 -0
- data/test/template/codedeploy-deployment-group_test.rb +48 -0
- data/test/template/datapipeline-pipeline_test.rb +358 -0
- data/test/template/dynamodb-table_test.rb +94 -0
- data/test/template/ec2-eip-association_test.rb +22 -0
- data/test/template/ec2-eip_test.rb +21 -0
- data/test/template/ec2-instance_test.rb +95 -0
- data/test/template/ec2-internet-gateway_test.rb +48 -0
- data/test/template/ec2-nat-gateway_test.rb +22 -0
- data/test/template/ec2-network-acl-entry_test.rb +61 -0
- data/test/template/ec2-network-acl_test.rb +51 -0
- data/test/template/ec2-route-table_test.rb +49 -0
- data/test/template/ec2-route_test.rb +21 -0
- data/test/template/ec2-security-group_test.rb +50 -0
- data/test/template/ec2-subnet-netwokr-acl-association_test.rb +26 -0
- data/test/template/ec2-subnet-route-table-association_test.rb +22 -0
- data/test/template/ec2-subnet_test.rb +51 -0
- data/test/template/ec2-volume-attachment_test.rb +24 -0
- data/test/template/ec2-volume_test.rb +52 -0
- data/test/template/ec2-vpc-gateway-attachment_test.rb +23 -0
- data/test/template/ec2-vpc_test.rb +102 -0
- data/test/template/ecs-cluster_test.rb +18 -0
- data/test/template/ecs-service_test.rb +29 -0
- data/test/template/ecs-task-definition_test.rb +143 -0
- data/test/template/elasticache-cache-cluster_test.rb +77 -0
- data/test/template/elasticache-parameter-group_test.rb +25 -0
- data/test/template/elasticache-replication-group_test.rb +45 -0
- data/test/template/elasticache-subnet-group_test.rb +26 -0
- data/test/template/elasticbeanstalk-application-version_test.rb +27 -0
- data/test/template/elasticbeanstalk-application_test.rb +21 -0
- data/test/template/elasticbeanstalk-configuration-template_test.rb +23 -0
- data/test/template/elasticbeanstalk-environment_test.rb +56 -0
- data/test/template/elasticbeanstalk-template_test.rb +33 -0
- data/test/template/elb-loadbalancer_test.rb +94 -0
- data/test/template/emr-cluster_test.rb +147 -0
- data/test/template/emr-instance-group-config_test.rb +65 -0
- data/test/template/emr-step_test.rb +82 -0
- data/test/template/events-rule_test.rb +34 -0
- data/test/template/iam-access-key_test.rb +22 -0
- data/test/template/iam-group_test.rb +21 -0
- data/test/template/iam-instance-profile_test.rb +24 -0
- data/test/template/iam-managed-policy_test.rb +35 -0
- data/test/template/iam-policy_test.rb +52 -0
- data/test/template/iam-role_test.rb +37 -0
- data/test/template/iam-user-to-group-addition_test.rb +24 -0
- data/test/template/iam-user_test.rb +21 -0
- data/test/template/lambda-alias_test.rb +46 -0
- data/test/template/lambda-event-source-mapping_test.rb +36 -0
- data/test/template/lambda-function_test.rb +34 -0
- data/test/template/lambda-permission_test.rb +32 -0
- data/test/template/lambda-version_test.rb +27 -0
- data/test/template/mappings-ec2_test.rb +92 -0
- data/test/template/output-access-key_test.rb +30 -0
- data/test/template/output-arn_test.rb +30 -0
- data/test/template/output-autoscaling_test.rb +27 -0
- data/test/template/output-az_test.rb +31 -0
- data/test/template/output-dynamodb_test.rb +21 -0
- data/test/template/output-ec2_test.rb +82 -0
- data/test/template/output-elasticache_test.rb +107 -0
- data/test/template/output-elb_test.rb +48 -0
- data/test/template/output-emr_test.rb +30 -0
- data/test/template/output-rds_test.rb +39 -0
- data/test/template/output-redshift_test.rb +39 -0
- data/test/template/output-s3_test.rb +52 -0
- data/test/template/output-security-group_test.rb +21 -0
- data/test/template/output-sqs_test.rb +21 -0
- data/test/template/output-topic_test.rb +30 -0
- data/test/template/output-vpc_test.rb +48 -0
- data/test/template/output_test.rb +87 -0
- data/test/template/parameter-ec2_test.rb +44 -0
- data/test/template/parameter-elasticache_test.rb +30 -0
- data/test/template/parameter-rds_test.rb +30 -0
- data/test/template/parameter-redshift_test.rb +30 -0
- data/test/template/parameter_test.rb +40 -0
- data/test/template/rds-db-cluster-parameter-group_test.rb +53 -0
- data/test/template/rds-db-cluster_test.rb +84 -0
- data/test/template/rds-db-instance_test.rb +93 -0
- data/test/template/rds-db-parameter-group_test.rb +53 -0
- data/test/template/rds-db-subnet-group.rb +54 -0
- data/test/template/rds-event-subscription_test.rb +48 -0
- data/test/template/rds-option-group_test.rb +56 -0
- data/test/template/redshift-cluster-parameter-group_test.rb +28 -0
- data/test/template/redshift-cluster-subnet-group_test.rb +26 -0
- data/test/template/redshift-cluster_test.rb +47 -0
- data/test/template/s3-bucket-policy_test.rb +40 -0
- data/test/template/s3-bucket_test.rb +127 -0
- data/test/template/sns-topic_test.rb +42 -0
- data/test/template/sqs-queue_test.rb +25 -0
- metadata +468 -0
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ElasticacheCacheClusterTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_elasticache_cache_cluster "test", ref_security_groups: "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestCacheCluster": {
|
12
|
+
"Type": "AWS::ElastiCache::CacheCluster",
|
13
|
+
"Properties": {
|
14
|
+
"AutoMinorVersionUpgrade": "true",
|
15
|
+
"CacheNodeType": "cache.t2.medium",
|
16
|
+
"CacheParameterGroupName": "default.redis2.8",
|
17
|
+
"CacheSubnetGroupName": "",
|
18
|
+
"ClusterName": {
|
19
|
+
"Fn::Join": [
|
20
|
+
"-",
|
21
|
+
[
|
22
|
+
{
|
23
|
+
"Ref": "Service"
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"Ref": "Name"
|
27
|
+
}
|
28
|
+
]
|
29
|
+
]
|
30
|
+
},
|
31
|
+
"Engine": "redis",
|
32
|
+
"EngineVersion": "2.8.24",
|
33
|
+
"NumCacheNodes": "1",
|
34
|
+
"Port": "6379",
|
35
|
+
"PreferredMaintenanceWindow": "Thu:20:15-Thu:21:15",
|
36
|
+
"SnapshotRetentionLimit": "10",
|
37
|
+
"SnapshotWindow": "21:15-22:15",
|
38
|
+
"Tags": [
|
39
|
+
{
|
40
|
+
"Key": "Name",
|
41
|
+
"Value": {
|
42
|
+
"Fn::Join": [
|
43
|
+
"-",
|
44
|
+
[
|
45
|
+
{
|
46
|
+
"Ref": "Service"
|
47
|
+
},
|
48
|
+
"test"
|
49
|
+
]
|
50
|
+
]
|
51
|
+
}
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"Key": "Service",
|
55
|
+
"Value": {
|
56
|
+
"Ref": "Service"
|
57
|
+
}
|
58
|
+
},
|
59
|
+
{
|
60
|
+
"Key": "Version",
|
61
|
+
"Value": {
|
62
|
+
"Ref": "Version"
|
63
|
+
}
|
64
|
+
}
|
65
|
+
],
|
66
|
+
"VpcSecurityGroupIds": [
|
67
|
+
{
|
68
|
+
"Ref": "TestSecurityGroup"
|
69
|
+
}
|
70
|
+
]
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
EOS
|
75
|
+
assert_equal exp_template.chomp, act_template
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ElasticacheParameterGroupTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_elasticache_parameter_group "test", properties: { "timeout": 0 }
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestCacheParameterGroup": {
|
12
|
+
"Type": "AWS::ElastiCache::ParameterGroup",
|
13
|
+
"Properties": {
|
14
|
+
"CacheParameterGroupFamily": "redis2.8",
|
15
|
+
"Description": "test cache parameter group description",
|
16
|
+
"Properties": {
|
17
|
+
"timeout": 0
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
EOS
|
23
|
+
assert_equal exp_template.chomp, act_template
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ElasticacheReplicationGroupTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_elasticache_replication_group "test", ref_security_groups: "test", ref_subnet: "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestCacheReplicationGroup": {
|
12
|
+
"Type": "AWS::ElastiCache::ReplicationGroup",
|
13
|
+
"Properties": {
|
14
|
+
"AutomaticFailoverEnabled": "true",
|
15
|
+
"AutoMinorVersionUpgrade": "true",
|
16
|
+
"CacheNodeType": "cache.t2.medium",
|
17
|
+
"CacheParameterGroupName": "default.redis2.8",
|
18
|
+
"CacheSubnetGroupName": {
|
19
|
+
"Ref": "TestCacheSubnetGroup"
|
20
|
+
},
|
21
|
+
"Engine": "redis",
|
22
|
+
"EngineVersion": "2.8.24",
|
23
|
+
"NumCacheClusters": "2",
|
24
|
+
"Port": "6379",
|
25
|
+
"PreferredCacheClusterAZs": {
|
26
|
+
"Fn::GetAZs": {
|
27
|
+
"Ref": "AWS::Region"
|
28
|
+
}
|
29
|
+
},
|
30
|
+
"PreferredMaintenanceWindow": "Thu:20:15-Thu:21:15",
|
31
|
+
"ReplicationGroupDescription": "test cache replication group description",
|
32
|
+
"SecurityGroupIds": [
|
33
|
+
{
|
34
|
+
"Ref": "TestSecurityGroup"
|
35
|
+
}
|
36
|
+
],
|
37
|
+
"SnapshotRetentionLimit": "10",
|
38
|
+
"SnapshotWindow": "21:15-22:15"
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
EOS
|
43
|
+
assert_equal exp_template.chomp, act_template
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ElasitcacheSubnetGroupTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_elasticache_subnet_group "test", ref_subnets: [ "test" ]
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestCacheSubnetGroup": {
|
12
|
+
"Type": "AWS::ElastiCache::SubnetGroup",
|
13
|
+
"Properties": {
|
14
|
+
"Description": "test cache subnet group description",
|
15
|
+
"SubnetIds": [
|
16
|
+
{
|
17
|
+
"Ref": "TestSubnet"
|
18
|
+
}
|
19
|
+
]
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
EOS
|
24
|
+
assert_equal exp_template.chomp, act_template
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ElasticbeanstalkApplicationVersionTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_elasticbeanstalk_application_version "test", application: "test", ref_s3_bucket: "test", s3_key: "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestElasticbeanstalkApplicationVersion": {
|
12
|
+
"Type": "AWS::ElasticBeanstalk::ApplicationVersion",
|
13
|
+
"Properties": {
|
14
|
+
"ApplicationName": "test",
|
15
|
+
"SourceBundle": {
|
16
|
+
"S3Bucket": {
|
17
|
+
"Ref": "TestBucket"
|
18
|
+
},
|
19
|
+
"S3Key": "test"
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
EOS
|
25
|
+
assert_equal exp_template.chomp, act_template
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ElasticbeanstalkApplicationTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_elasticbeanstalk_application "test", application: "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestElasticbeanstalkApplication": {
|
12
|
+
"Type": "AWS::ElasticBeanstalk::Application",
|
13
|
+
"Properties": {
|
14
|
+
"ApplicationName": "test"
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
18
|
+
EOS
|
19
|
+
assert_equal exp_template.chomp, act_template
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ElasticbeanstalkConfgiurationTemplateTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_elasticbeanstalk_configuration_template "test", ref_application: "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestElasticbeanstalkConfigurationTemplate": {
|
12
|
+
"Type": "AWS::ElasticBeanstalk::ConfigurationTemplate",
|
13
|
+
"Properties": {
|
14
|
+
"ApplicationName": {
|
15
|
+
"Ref": "TestElasticbeanstalkApplication"
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
EOS
|
21
|
+
assert_equal exp_template.chomp, act_template
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ElasticbeanstalkEnvironmentTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_elasticbeanstalk_environment "test", ref_application: "test", description: "test", environment: "test", solution: "test", template: "test", version: "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestElasticbeanstalkEnvironment": {
|
12
|
+
"Type": "AWS::ElasticBeanstalk::Environment",
|
13
|
+
"Properties": {
|
14
|
+
"ApplicationName": {
|
15
|
+
"Ref": "TestElasticbeanstalkApplication"
|
16
|
+
},
|
17
|
+
"Description": "test",
|
18
|
+
"EnvironmentName": "test",
|
19
|
+
"SolutionStackName": "test",
|
20
|
+
"Tags": [
|
21
|
+
{
|
22
|
+
"Key": "Name",
|
23
|
+
"Value": {
|
24
|
+
"Fn::Join": [
|
25
|
+
"-",
|
26
|
+
[
|
27
|
+
{
|
28
|
+
"Ref": "Service"
|
29
|
+
},
|
30
|
+
"test"
|
31
|
+
]
|
32
|
+
]
|
33
|
+
}
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"Key": "Service",
|
37
|
+
"Value": {
|
38
|
+
"Ref": "Service"
|
39
|
+
}
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"Key": "Version",
|
43
|
+
"Value": {
|
44
|
+
"Ref": "Version"
|
45
|
+
}
|
46
|
+
}
|
47
|
+
],
|
48
|
+
"TemplateName": "test",
|
49
|
+
"VersionLabel": "test"
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
EOS
|
54
|
+
assert_equal exp_template.chomp, act_template
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ElasticbeanstalkTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_elasticbeanstalk_configuration_template "test", application: "test", solution: "test", option: [ { namespace: "test", option: "test", value: "test" } ], configuration: { application: "test", template: "test" }
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestElasticbeanstalkConfigurationTemplate": {
|
12
|
+
"Type": "AWS::ElasticBeanstalk::ConfigurationTemplate",
|
13
|
+
"Properties": {
|
14
|
+
"ApplicationName": "test",
|
15
|
+
"OptionSettings": [
|
16
|
+
{
|
17
|
+
"Namespace": "test",
|
18
|
+
"OptionName": "test",
|
19
|
+
"Value": "test"
|
20
|
+
}
|
21
|
+
],
|
22
|
+
"SolutionStackName": "test",
|
23
|
+
"SourceConfiguration": {
|
24
|
+
"ApplicationName": "test",
|
25
|
+
"TemplateName": "test"
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
EOS
|
31
|
+
assert_equal exp_template.chomp, act_template
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ElbLoadbalancerTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_elb_loadbalancer "test", ref_security_groups: [ "test" ], listeners: [ protocol: "http" ]
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestLoadBalancer": {
|
12
|
+
"Type": "AWS::ElasticLoadBalancing::LoadBalancer",
|
13
|
+
"Properties": {
|
14
|
+
"AvailabilityZones": {
|
15
|
+
"Fn::GetAZs": {
|
16
|
+
"Ref": "AWS::Region"
|
17
|
+
}
|
18
|
+
},
|
19
|
+
"ConnectionDrainingPolicy": {
|
20
|
+
"Enabled": "true",
|
21
|
+
"Timeout": "60"
|
22
|
+
},
|
23
|
+
"ConnectionSettings": {
|
24
|
+
"IdleTimeout": "60"
|
25
|
+
},
|
26
|
+
"CrossZone": "false",
|
27
|
+
"HealthCheck": {
|
28
|
+
"HealthyThreshold": "10",
|
29
|
+
"Interval": "30",
|
30
|
+
"Target": "HTTP:80/index.html",
|
31
|
+
"Timeout": "5",
|
32
|
+
"UnhealthyThreshold": "2"
|
33
|
+
},
|
34
|
+
"LoadBalancerName": {
|
35
|
+
"Fn::Join": [
|
36
|
+
"-",
|
37
|
+
[
|
38
|
+
{
|
39
|
+
"Ref": "Service"
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"Ref": "Name"
|
43
|
+
}
|
44
|
+
]
|
45
|
+
]
|
46
|
+
},
|
47
|
+
"Listeners": [
|
48
|
+
{
|
49
|
+
"InstancePort": "80",
|
50
|
+
"InstanceProtocol": "HTTP",
|
51
|
+
"LoadBalancerPort": "80",
|
52
|
+
"Protocol": "HTTP"
|
53
|
+
}
|
54
|
+
],
|
55
|
+
"SecurityGroups": [
|
56
|
+
{
|
57
|
+
"Ref": "TestSecurityGroup"
|
58
|
+
}
|
59
|
+
],
|
60
|
+
"Tags": [
|
61
|
+
{
|
62
|
+
"Key": "Name",
|
63
|
+
"Value": {
|
64
|
+
"Fn::Join": [
|
65
|
+
"-",
|
66
|
+
[
|
67
|
+
{
|
68
|
+
"Ref": "Service"
|
69
|
+
},
|
70
|
+
"test"
|
71
|
+
]
|
72
|
+
]
|
73
|
+
}
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"Key": "Service",
|
77
|
+
"Value": {
|
78
|
+
"Ref": "Service"
|
79
|
+
}
|
80
|
+
},
|
81
|
+
{
|
82
|
+
"Key": "Version",
|
83
|
+
"Value": {
|
84
|
+
"Ref": "Version"
|
85
|
+
}
|
86
|
+
}
|
87
|
+
]
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
EOS
|
92
|
+
assert_equal exp_template.chomp, act_template
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,147 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class EmrClusterTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_emr_cluster "test", job: { core: { name: "test" }, master: { name: "test" } }
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestEmrCluster": {
|
12
|
+
"Type": "AWS::EMR::Cluster",
|
13
|
+
"Properties": {
|
14
|
+
"Instances": {
|
15
|
+
"CoreInstanceGroup": {
|
16
|
+
"InstanceCount": "1",
|
17
|
+
"InstanceType": "c4.large",
|
18
|
+
"Market": "ON_DEMAND",
|
19
|
+
"Name": "test"
|
20
|
+
},
|
21
|
+
"MasterInstanceGroup": {
|
22
|
+
"InstanceCount": "1",
|
23
|
+
"InstanceType": "c4.large",
|
24
|
+
"Market": "ON_DEMAND",
|
25
|
+
"Name": "test"
|
26
|
+
},
|
27
|
+
"TerminationProtected": "false"
|
28
|
+
},
|
29
|
+
"JobFlowRole": "EMR_EC2_DefaultRole",
|
30
|
+
"Name": {
|
31
|
+
"Fn::Join": [
|
32
|
+
"-",
|
33
|
+
[
|
34
|
+
{
|
35
|
+
"Ref": "Service"
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"Ref": "Name"
|
39
|
+
}
|
40
|
+
]
|
41
|
+
]
|
42
|
+
},
|
43
|
+
"ReleaseLabel": "emr-4.6.0",
|
44
|
+
"ServiceRole": "EMR_DefaultRole",
|
45
|
+
"Tags": [
|
46
|
+
{
|
47
|
+
"Key": "Name",
|
48
|
+
"Value": {
|
49
|
+
"Fn::Join": [
|
50
|
+
"-",
|
51
|
+
[
|
52
|
+
{
|
53
|
+
"Ref": "Service"
|
54
|
+
},
|
55
|
+
"test"
|
56
|
+
]
|
57
|
+
]
|
58
|
+
}
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"Key": "Service",
|
62
|
+
"Value": {
|
63
|
+
"Ref": "Service"
|
64
|
+
}
|
65
|
+
},
|
66
|
+
{
|
67
|
+
"Key": "Version",
|
68
|
+
"Value": {
|
69
|
+
"Ref": "Version"
|
70
|
+
}
|
71
|
+
}
|
72
|
+
],
|
73
|
+
"VisibleToAllUsers": "false"
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
EOS
|
78
|
+
assert_equal exp_template.chomp, act_template
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_aws
|
82
|
+
template = <<-EOS
|
83
|
+
core = { name: "Core", count: 1, instance_type: "m3.xlarge" }
|
84
|
+
master = { name: "Master", count: 1, instance_type: "m3.xlarge" }
|
85
|
+
_emr_cluster "test", job: { core: core, master: master, termination: true }, cluster: "TestCluster"
|
86
|
+
EOS
|
87
|
+
act_template = run_client_as_json(template)
|
88
|
+
exp_template = <<-EOS
|
89
|
+
{
|
90
|
+
"TestEmrCluster": {
|
91
|
+
"Type": "AWS::EMR::Cluster",
|
92
|
+
"Properties": {
|
93
|
+
"Instances": {
|
94
|
+
"CoreInstanceGroup": {
|
95
|
+
"InstanceCount": "1",
|
96
|
+
"InstanceType": "m3.xlarge",
|
97
|
+
"Market": "ON_DEMAND",
|
98
|
+
"Name": "Core"
|
99
|
+
},
|
100
|
+
"MasterInstanceGroup": {
|
101
|
+
"InstanceCount": "1",
|
102
|
+
"InstanceType": "m3.xlarge",
|
103
|
+
"Market": "ON_DEMAND",
|
104
|
+
"Name": "Master"
|
105
|
+
},
|
106
|
+
"TerminationProtected": "true"
|
107
|
+
},
|
108
|
+
"JobFlowRole": "EMR_EC2_DefaultRole\",
|
109
|
+
"Name": "TestCluster",
|
110
|
+
"ReleaseLabel": "emr-4.6.0",
|
111
|
+
"ServiceRole": "EMR_DefaultRole",
|
112
|
+
"Tags": [
|
113
|
+
{
|
114
|
+
"Key": "Name",
|
115
|
+
"Value": {
|
116
|
+
"Fn::Join": [
|
117
|
+
"-",
|
118
|
+
[
|
119
|
+
{
|
120
|
+
"Ref": "Service"
|
121
|
+
},
|
122
|
+
"test"
|
123
|
+
]
|
124
|
+
]
|
125
|
+
}
|
126
|
+
},
|
127
|
+
{
|
128
|
+
"Key": "Service",
|
129
|
+
"Value": {
|
130
|
+
"Ref": "Service"
|
131
|
+
}
|
132
|
+
},
|
133
|
+
{
|
134
|
+
"Key": "Version",
|
135
|
+
"Value": {
|
136
|
+
"Ref": "Version"
|
137
|
+
}
|
138
|
+
}
|
139
|
+
],
|
140
|
+
"VisibleToAllUsers": "false"
|
141
|
+
}
|
142
|
+
}
|
143
|
+
}
|
144
|
+
EOS
|
145
|
+
assert_equal exp_template.chomp, act_template
|
146
|
+
end
|
147
|
+
end
|