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,87 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class OutputTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_output "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"Test": {
|
12
|
+
"Description": "description of Test",
|
13
|
+
"Value": "Test"
|
14
|
+
}
|
15
|
+
}
|
16
|
+
EOS
|
17
|
+
assert_equal exp_template.chomp, act_template
|
18
|
+
|
19
|
+
template = <<-EOS
|
20
|
+
_output "test", { value: "test1" }
|
21
|
+
EOS
|
22
|
+
act_template = run_client_as_json(template)
|
23
|
+
exp_template = <<-EOS
|
24
|
+
{
|
25
|
+
"Test": {
|
26
|
+
"Description": "description of Test",
|
27
|
+
"Value": "test1"
|
28
|
+
}
|
29
|
+
}
|
30
|
+
EOS
|
31
|
+
assert_equal exp_template.chomp, act_template
|
32
|
+
|
33
|
+
template = <<-EOS
|
34
|
+
_output "test", { value: [ "test1", "test2" ] }
|
35
|
+
EOS
|
36
|
+
act_template = run_client_as_json(template)
|
37
|
+
exp_template = <<-EOS
|
38
|
+
{
|
39
|
+
"Test": {
|
40
|
+
"Description": "description of Test",
|
41
|
+
"Value": {
|
42
|
+
"Fn::GetAtt": [
|
43
|
+
"Test1",
|
44
|
+
"test2"
|
45
|
+
]
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
EOS
|
50
|
+
assert_equal exp_template.chomp, act_template
|
51
|
+
|
52
|
+
template = <<-EOS
|
53
|
+
_output "test", { ref_value: [ "test1", "test2" ] }
|
54
|
+
EOS
|
55
|
+
act_template = run_client_as_json(template)
|
56
|
+
exp_template = <<-EOS
|
57
|
+
{
|
58
|
+
"Test": {
|
59
|
+
"Description": "description of Test",
|
60
|
+
"Value": {
|
61
|
+
"Fn::GetAtt": [
|
62
|
+
"Test1",
|
63
|
+
"test2"
|
64
|
+
]
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
EOS
|
69
|
+
assert_equal exp_template.chomp, act_template
|
70
|
+
|
71
|
+
template = <<-EOS
|
72
|
+
_output "test", { ref_value: "test1" }
|
73
|
+
EOS
|
74
|
+
act_template = run_client_as_json(template)
|
75
|
+
exp_template = <<-EOS
|
76
|
+
{
|
77
|
+
"Test": {
|
78
|
+
"Description": "description of Test",
|
79
|
+
"Value": {
|
80
|
+
"Ref": "Test1"
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}
|
84
|
+
EOS
|
85
|
+
assert_equal exp_template.chomp, act_template
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ParameterEc2Test < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_parameter_ec2 "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
allowed_values = []
|
10
|
+
EC2_INSTANCE_TYPES.each do |type|
|
11
|
+
allowed_values << "#{type}"
|
12
|
+
end
|
13
|
+
allowed_values = JSON.generate(allowed_values)
|
14
|
+
.gsub("[", "[\n ")
|
15
|
+
.gsub("\",", "\",\n ")
|
16
|
+
.gsub("\"]", "\"\n ]")
|
17
|
+
exp_template = <<-EOS
|
18
|
+
{
|
19
|
+
"TestInstanceType": {
|
20
|
+
"Type": "String",
|
21
|
+
"Default": "#{EC2_DEFAULT_INSTANCE_TYPE}",
|
22
|
+
"AllowedValues": #{allowed_values},
|
23
|
+
"Description": "test instance type"
|
24
|
+
},
|
25
|
+
"TestIamInstanceProfile\": {
|
26
|
+
"Type\": \"String\",
|
27
|
+
"Default\": \"\",
|
28
|
+
"Description\": \"test iam instance profile\"
|
29
|
+
},
|
30
|
+
"TestDataVolumeSize\": {
|
31
|
+
"Type\": \"String\",
|
32
|
+
"Default\": \"100\",
|
33
|
+
"Description\": \"test data volume size\"
|
34
|
+
},
|
35
|
+
"TestKeyName": {
|
36
|
+
"Type": "AWS::EC2::KeyPair::KeyName",
|
37
|
+
"Default": "",
|
38
|
+
"Description": "test key name"
|
39
|
+
}
|
40
|
+
}
|
41
|
+
EOS
|
42
|
+
assert_equal exp_template.chomp, act_template
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
require 'kumogata/template/const'
|
3
|
+
|
4
|
+
class ParameterElasticaheTest < Minitest::Test
|
5
|
+
def test_normal
|
6
|
+
values = ''
|
7
|
+
ELASTICACHE_NODE_TYPES.each_with_index do |v, i|
|
8
|
+
values +=<<-EOS
|
9
|
+
"#{v}"#{i == (ELASTICACHE_NODE_TYPES.size - 1) ? '': ','}
|
10
|
+
EOS
|
11
|
+
end
|
12
|
+
template = <<-EOS
|
13
|
+
_parameter_elasticache "test"
|
14
|
+
EOS
|
15
|
+
act_template = run_client_as_json(template)
|
16
|
+
exp_template = <<-EOS
|
17
|
+
{
|
18
|
+
"TestCacheNodeTypes": {
|
19
|
+
"Type": "String",
|
20
|
+
"Default": "#{ELASTICACHE_DEFAULT_NODE_TYPE}",
|
21
|
+
"AllowedValues": [
|
22
|
+
#{values.chomp}
|
23
|
+
],
|
24
|
+
"Description": "test cache node types"
|
25
|
+
}
|
26
|
+
}
|
27
|
+
EOS
|
28
|
+
assert_equal exp_template.chomp, act_template
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
require 'kumogata/template/const'
|
3
|
+
|
4
|
+
class ParameterRdsTest < Minitest::Test
|
5
|
+
def test_normal
|
6
|
+
values = ''
|
7
|
+
RDS_INSTANCE_CLASSES.each_with_index do |v, i|
|
8
|
+
values +=<<-EOS
|
9
|
+
"#{v}"#{i == (RDS_INSTANCE_CLASSES.size - 1) ? '': ','}
|
10
|
+
EOS
|
11
|
+
end
|
12
|
+
template = <<-EOS
|
13
|
+
_parameter_rds "test"
|
14
|
+
EOS
|
15
|
+
act_template = run_client_as_json(template)
|
16
|
+
exp_template = <<-EOS
|
17
|
+
{
|
18
|
+
"TestDbInstanceClasses": {
|
19
|
+
"Type": "String",
|
20
|
+
"Default": "#{RDS_DEFAULT_INSTANCE_CLASS}",
|
21
|
+
"AllowedValues": [
|
22
|
+
#{values.chomp}
|
23
|
+
],
|
24
|
+
"Description": "test db instance classes"
|
25
|
+
}
|
26
|
+
}
|
27
|
+
EOS
|
28
|
+
assert_equal exp_template.chomp, act_template
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
require 'kumogata/template/const'
|
3
|
+
|
4
|
+
class ParameterRdsInstanceTest < Minitest::Test
|
5
|
+
def test_normal
|
6
|
+
values = ''
|
7
|
+
REDSHIFT_NODE_TYPES.each_with_index do |v, i|
|
8
|
+
values +=<<-EOS
|
9
|
+
"#{v}"#{i == (REDSHIFT_NODE_TYPES.size - 1) ? '': ','}
|
10
|
+
EOS
|
11
|
+
end
|
12
|
+
template = <<-EOS
|
13
|
+
_parameter_redshift "test"
|
14
|
+
EOS
|
15
|
+
act_template = run_client_as_json(template)
|
16
|
+
exp_template = <<-EOS
|
17
|
+
{
|
18
|
+
"TestRedshiftClusterNodeTypes": {
|
19
|
+
"Type": "String",
|
20
|
+
"Default": "#{REDSHIFT_DEFAULT_NODE_TYPE}",
|
21
|
+
"AllowedValues": [
|
22
|
+
#{values.chomp}
|
23
|
+
],
|
24
|
+
"Description": "test redshift cluster node types"
|
25
|
+
}
|
26
|
+
}
|
27
|
+
EOS
|
28
|
+
assert_equal exp_template.chomp, act_template
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class ParameterTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_parameter "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"Test": {
|
12
|
+
"Type": "String",
|
13
|
+
"Default": "",
|
14
|
+
"Description": ""
|
15
|
+
}
|
16
|
+
}
|
17
|
+
EOS
|
18
|
+
assert_equal exp_template.chomp, act_template
|
19
|
+
|
20
|
+
template = <<-EOS
|
21
|
+
_parameter "test", { type: "type", default: "default", description: "desc", allowed_values: [ "1", "2" ], no_echo: true }
|
22
|
+
EOS
|
23
|
+
act_template = run_client_as_json(template)
|
24
|
+
exp_template = <<-EOS
|
25
|
+
{
|
26
|
+
"Test": {
|
27
|
+
"Type": "type",
|
28
|
+
"Default": "default",
|
29
|
+
"AllowedValues": [
|
30
|
+
"1",
|
31
|
+
"2"
|
32
|
+
],
|
33
|
+
"Description": "desc",
|
34
|
+
"NoEcho": "true"
|
35
|
+
}
|
36
|
+
}
|
37
|
+
EOS
|
38
|
+
assert_equal exp_template.chomp, act_template
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class RdsDbClusterParameterGroupTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_rds_db_cluster_parameter_group "test", parameters: { test: "test" }
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestDbClusterParameterGroup": {
|
12
|
+
"Type": "AWS::RDS::DBClusterParameterGroup",
|
13
|
+
"Properties": {
|
14
|
+
"Description": "test db cluster parameter group description",
|
15
|
+
"Family": "aurora5.6",
|
16
|
+
"Parameters": {
|
17
|
+
"test": "test"
|
18
|
+
},
|
19
|
+
"Tags": [
|
20
|
+
{
|
21
|
+
"Key": "Name",
|
22
|
+
"Value": {
|
23
|
+
"Fn::Join": [
|
24
|
+
"-",
|
25
|
+
[
|
26
|
+
{
|
27
|
+
"Ref": "Service"
|
28
|
+
},
|
29
|
+
"test"
|
30
|
+
]
|
31
|
+
]
|
32
|
+
}
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"Key": "Service",
|
36
|
+
"Value": {
|
37
|
+
"Ref": "Service"
|
38
|
+
}
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"Key": "Version",
|
42
|
+
"Value": {
|
43
|
+
"Ref": "Version"
|
44
|
+
}
|
45
|
+
}
|
46
|
+
]
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
EOS
|
51
|
+
assert_equal exp_template.chomp, act_template
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class RdsDbClusterTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_rds_db_cluster "test", ref_parameter: "test", ref_subnet_group: "test", ref_user_name: "test", ref_user_password: "test", ref_security_groups: "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestDbCluster": {
|
12
|
+
"Type": "AWS::RDS::DBCluster",
|
13
|
+
"Properties": {
|
14
|
+
"BackupRetentionPeriod": "7",
|
15
|
+
"DatabaseName": {
|
16
|
+
"Fn::Join": [
|
17
|
+
"-",
|
18
|
+
[
|
19
|
+
{
|
20
|
+
"Ref": "Service"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"Ref": "Name"
|
24
|
+
}
|
25
|
+
]
|
26
|
+
]
|
27
|
+
},
|
28
|
+
"DBClusterParameterGroupName": {
|
29
|
+
"Ref": "TestDbClusterParameterGroup"
|
30
|
+
},
|
31
|
+
"DBSubnetGroupName": {
|
32
|
+
"Ref": "TestDbSubnetGroup"
|
33
|
+
},
|
34
|
+
"Engine": "aurora",
|
35
|
+
"EngineVersion": "5.6.10a",
|
36
|
+
"MasterUsername": {
|
37
|
+
"Ref": "TestDbMasterUserName"
|
38
|
+
},
|
39
|
+
"MasterUserPassword": {
|
40
|
+
"Ref": "TestDbMasterUserPassword"
|
41
|
+
},
|
42
|
+
"Port": "3306",
|
43
|
+
"PreferredBackupWindow": "21:30-22:00",
|
44
|
+
"PreferredMaintenanceWindow": "Thu:20:30-Thu:21:00",
|
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
|
+
"VpcSecurityGroupIds": [
|
74
|
+
{
|
75
|
+
"Ref": "TestSecurityGroup"
|
76
|
+
}
|
77
|
+
]
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
|
+
EOS
|
82
|
+
assert_equal exp_template.chomp, act_template
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class RdsDbInstanceTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_rds_db_instance "test", ref_db_name: "test", ref_port: "test", ref_subnet_group: "test", ref_security_groups: "test", ref_user_name: "test", ref_user_password: "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestDbInstance": {
|
12
|
+
"Type": "AWS::RDS::DBInstance",
|
13
|
+
"Properties": {
|
14
|
+
"AllocatedStorage": "5",
|
15
|
+
"AllowMajorVersionUpgrade": "true",
|
16
|
+
"AutoMinorVersionUpgrade": "true",
|
17
|
+
"BackupRetentionPeriod": "7",
|
18
|
+
"DBInstanceClass": "db.t2.medium",
|
19
|
+
"DBInstanceIdentifier": {
|
20
|
+
"Fn::Join": [
|
21
|
+
"-",
|
22
|
+
[
|
23
|
+
{
|
24
|
+
"Ref": "Service"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"Ref": "Name"
|
28
|
+
}
|
29
|
+
]
|
30
|
+
]
|
31
|
+
},
|
32
|
+
"DBName": {
|
33
|
+
"Ref": "TestDbName"
|
34
|
+
},
|
35
|
+
"DBParameterGroupName": "default.mysql5.7",
|
36
|
+
"DBSubnetGroupName": {
|
37
|
+
"Ref": "TestDbSubnetGroup"
|
38
|
+
},
|
39
|
+
"Engine": "mysql",
|
40
|
+
"EngineVersion": "5.7.10",
|
41
|
+
"MasterUsername": {
|
42
|
+
"Ref": "TestDbMasterUserName"
|
43
|
+
},
|
44
|
+
"MasterUserPassword": {
|
45
|
+
"Ref": "TestDbMasterUserPassword"
|
46
|
+
},
|
47
|
+
"MultiAZ": "false",
|
48
|
+
"Port": {
|
49
|
+
"Ref": "TestDbPort"
|
50
|
+
},
|
51
|
+
"PreferredBackupWindow": "21:30-22:00",
|
52
|
+
"PreferredMaintenanceWindow": "Thu:20:30-Thu:21:00",
|
53
|
+
"PubliclyAccessible": "false",
|
54
|
+
"Tags": [
|
55
|
+
{
|
56
|
+
"Key": "Name",
|
57
|
+
"Value": {
|
58
|
+
"Fn::Join": [
|
59
|
+
"-",
|
60
|
+
[
|
61
|
+
{
|
62
|
+
"Ref": "Service"
|
63
|
+
},
|
64
|
+
"test"
|
65
|
+
]
|
66
|
+
]
|
67
|
+
}
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"Key": "Service",
|
71
|
+
"Value": {
|
72
|
+
"Ref": "Service"
|
73
|
+
}
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"Key": "Version",
|
77
|
+
"Value": {
|
78
|
+
"Ref": "Version"
|
79
|
+
}
|
80
|
+
}
|
81
|
+
],
|
82
|
+
"VPCSecurityGroups": [
|
83
|
+
{
|
84
|
+
"Ref": "TestSecurityGroup"
|
85
|
+
}
|
86
|
+
]
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
EOS
|
91
|
+
assert_equal exp_template.chomp, act_template
|
92
|
+
end
|
93
|
+
end
|