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,36 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class LambdaEventSourceMappingTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_lambda_event_source_mapping "test", ref_function_name: "test", ref_event_source: "test", event_source_prefix: "test"
|
7
|
+
|
8
|
+
EOS
|
9
|
+
act_template = run_client_as_json(template)
|
10
|
+
exp_template = <<-EOS
|
11
|
+
{
|
12
|
+
"TestLambdaEventSourceMapping": {
|
13
|
+
"Type": "AWS::Lambda::EventSourceMapping",
|
14
|
+
"Properties": {
|
15
|
+
"BatchSize": "100",
|
16
|
+
"Enabled": "true",
|
17
|
+
"EventSourceArn": {
|
18
|
+
"Fn::GetAtt": [
|
19
|
+
"TestTest",
|
20
|
+
"Arn"
|
21
|
+
]
|
22
|
+
},
|
23
|
+
"FunctionName": {
|
24
|
+
"Fn::GetAtt": [
|
25
|
+
"TestLambdaFunction",
|
26
|
+
"Arn"
|
27
|
+
]
|
28
|
+
},
|
29
|
+
"StartingPosition": "LATEST"
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
EOS
|
34
|
+
assert_equal exp_template.chomp, act_template
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class LambdaFunctionTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_lambda_function "test", code: { s3_bucket: "test", s3_key: "test" }, handler: "test", ref_role: "test", runtime: "nodejs4.3"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestLambdaFunction": {
|
12
|
+
"Type": "AWS::Lambda::Function",
|
13
|
+
"Properties": {
|
14
|
+
"Code": {
|
15
|
+
"S3Bucket": "test",
|
16
|
+
"S3Key": "test"
|
17
|
+
},
|
18
|
+
"Handler": "test",
|
19
|
+
"MemorySize": "128",
|
20
|
+
"Role": {
|
21
|
+
"Fn::GetAtt": [
|
22
|
+
"TestRole",
|
23
|
+
"Arn"
|
24
|
+
]
|
25
|
+
},
|
26
|
+
"Runtime": "nodejs4.3",
|
27
|
+
"Timeout": "3"
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
EOS
|
32
|
+
assert_equal exp_template.chomp, act_template
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class LambdaPermissionTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_lambda_permission "test", action: "test", ref_function_name: "test", ref_source_arn: "test"
|
7
|
+
|
8
|
+
EOS
|
9
|
+
act_template = run_client_as_json(template)
|
10
|
+
exp_template = <<-EOS
|
11
|
+
{
|
12
|
+
"TestLambdaPermission": {
|
13
|
+
"Type": "AWS::Lambda::Permission",
|
14
|
+
"Properties": {
|
15
|
+
"Action": "test",
|
16
|
+
"FunctionName": {
|
17
|
+
"Fn::GetAtt": [
|
18
|
+
"TestLambdaFunction",
|
19
|
+
"Arn"
|
20
|
+
]
|
21
|
+
},
|
22
|
+
"Principal": "sns.amazonaws.com",
|
23
|
+
"SourceArn": {
|
24
|
+
"Ref": "TestTopic"
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
EOS
|
30
|
+
assert_equal exp_template.chomp, act_template
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class LambdaVersionTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_lambda_version "test", ref_function_name: "test", ref_source_arn: "test"
|
7
|
+
|
8
|
+
EOS
|
9
|
+
act_template = run_client_as_json(template)
|
10
|
+
exp_template = <<-EOS
|
11
|
+
{
|
12
|
+
"TestLambdaVersion": {
|
13
|
+
"Type": "AWS::Lambda::Version",
|
14
|
+
"Properties": {
|
15
|
+
"FunctionName": {
|
16
|
+
"Fn::GetAtt": [
|
17
|
+
"TestLambdaFunction",
|
18
|
+
"Arn"
|
19
|
+
]
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
EOS
|
25
|
+
assert_equal exp_template.chomp, act_template
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
require 'kumogata/template/const'
|
3
|
+
|
4
|
+
class MappingsEc2Test < Minitest::Test
|
5
|
+
def test_normal
|
6
|
+
# from mappings-ec2
|
7
|
+
amazon_image_id = {
|
8
|
+
virginia: "08111162",
|
9
|
+
oregon: "c229c0a2",
|
10
|
+
california: "1b0f7d7b",
|
11
|
+
frankfurt: "e2df388d",
|
12
|
+
ireland: "31328842",
|
13
|
+
singapore: "e90dc68a",
|
14
|
+
sydney: "f2210191",
|
15
|
+
tokyo: "f80e0596",
|
16
|
+
seoul: "6598510b",
|
17
|
+
saopaulo: "1e159872",
|
18
|
+
}
|
19
|
+
amazon_images = get_image_values(amazon_image_id)
|
20
|
+
centos7_image_id = {
|
21
|
+
virginia: "6d1c2007",
|
22
|
+
oregon: "d2c924b2",
|
23
|
+
california: "af4333cf",
|
24
|
+
ireland: "7abd0209",
|
25
|
+
frankfurt: "9bf712f4",
|
26
|
+
singapore: "f068a193",
|
27
|
+
tokyo: "eec1c380",
|
28
|
+
sydney: "fedafc9d",
|
29
|
+
seoul: "c74789a9",
|
30
|
+
saopaulo: "26b93b4a",
|
31
|
+
}
|
32
|
+
centos7_images = get_image_values(centos7_image_id)
|
33
|
+
ubuntu16_image_id = {
|
34
|
+
virginia: "840910ee",
|
35
|
+
oregon: "fa82739a",
|
36
|
+
california: "fa82739a",
|
37
|
+
frankfurt: "f0eb089f",
|
38
|
+
ireland: "3079f543",
|
39
|
+
singapore: "a5416cc6",
|
40
|
+
sydney: "a5416cc6",
|
41
|
+
tokyo: "3c5f4152",
|
42
|
+
seoul: "a5416cc6",
|
43
|
+
saopaulo: "567cf23a",
|
44
|
+
}
|
45
|
+
ubuntu16_images = get_image_values(ubuntu16_image_id)
|
46
|
+
|
47
|
+
archs = ""
|
48
|
+
EC2_INSTANCE_TYPES.each_with_index do |type, i|
|
49
|
+
archs += <<-EOS
|
50
|
+
"#{type}": {
|
51
|
+
"Arch": "HVM64"
|
52
|
+
}#{i == (EC2_INSTANCE_TYPES.size - 1) ? '' : ','}
|
53
|
+
EOS
|
54
|
+
end
|
55
|
+
|
56
|
+
template = <<-EOS
|
57
|
+
_mappings_ec2 "test"
|
58
|
+
EOS
|
59
|
+
act_template = run_client_as_json(template)
|
60
|
+
exp_template = <<-EOS
|
61
|
+
{
|
62
|
+
"AWSInstanceType2Arch": {
|
63
|
+
#{archs.chomp}
|
64
|
+
},
|
65
|
+
"AWSRegionArch2AMIAmazonLinuxOfficial": {
|
66
|
+
#{amazon_images.chomp}
|
67
|
+
},
|
68
|
+
"AWSRegionArch2AMICentos7Official": {
|
69
|
+
#{centos7_images.chomp}
|
70
|
+
},
|
71
|
+
"AWSRegionArch2AMIUbuntu16Official": {
|
72
|
+
#{ubuntu16_images.chomp}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
EOS
|
76
|
+
assert_equal exp_template.chomp, act_template
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
80
|
+
def get_image_values image_ids
|
81
|
+
values = ''
|
82
|
+
AWS_REGION.each_with_index do |v, i|
|
83
|
+
region, location = v
|
84
|
+
values += <<-EOS
|
85
|
+
"#{location}": {
|
86
|
+
"HVM64": "ami-#{image_ids[region]}"
|
87
|
+
}#{i == (AWS_REGION.size - 1) ? '' : ','}
|
88
|
+
EOS
|
89
|
+
end
|
90
|
+
values
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class OutputAccessKeyTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_output_access_key "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestAccessKey": {
|
12
|
+
"Description": "description of TestAccessKey",
|
13
|
+
"Value": {
|
14
|
+
"Ref": "Test"
|
15
|
+
}
|
16
|
+
},
|
17
|
+
"TestSecretAccessKey": {
|
18
|
+
"Description": "description of TestSecretAccessKey",
|
19
|
+
"Value": {
|
20
|
+
"Fn::GetAtt": [
|
21
|
+
"Test",
|
22
|
+
"SecretAccessKey"
|
23
|
+
]
|
24
|
+
}
|
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
|
+
|
3
|
+
class OutputUserTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_output_arn "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestName": {
|
12
|
+
"Description": "description of TestName",
|
13
|
+
"Value": {
|
14
|
+
"Ref": "Test"
|
15
|
+
}
|
16
|
+
},
|
17
|
+
"TestArn": {
|
18
|
+
"Description": "description of TestArn",
|
19
|
+
"Value": {
|
20
|
+
"Fn::GetAtt": [
|
21
|
+
"Test",
|
22
|
+
"Arn"
|
23
|
+
]
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
EOS
|
28
|
+
assert_equal exp_template.chomp, act_template
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class OutputAutoscalingTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_output_autoscaling "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestAutoscalingGroup": {
|
12
|
+
"Description": "description of TestAutoscalingGroup",
|
13
|
+
"Value": {
|
14
|
+
"Ref": "TestAutoscalingGroup"
|
15
|
+
}
|
16
|
+
},
|
17
|
+
"TestAutoscalingLaunchConfiguration": {
|
18
|
+
"Description": "description of TestAutoscalingLaunchConfiguration",
|
19
|
+
"Value": {
|
20
|
+
"Ref": "TestAutoscalingLaunchConfiguration"
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
EOS
|
25
|
+
assert_equal exp_template.chomp, act_template
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class OutputAzTest < Minitest::Test
|
4
|
+
# FIXME?
|
5
|
+
def test_normal
|
6
|
+
template = <<-EOS
|
7
|
+
_output_az "test"
|
8
|
+
EOS
|
9
|
+
act_template = run_client_as_json(template)
|
10
|
+
exp_template = <<-EOS
|
11
|
+
{
|
12
|
+
"TestName": {
|
13
|
+
"Description": "description of TestName",
|
14
|
+
"Value": {
|
15
|
+
"Ref": "Test"
|
16
|
+
}
|
17
|
+
},
|
18
|
+
"TestCidr": {
|
19
|
+
"Description": "description of TestCidr",
|
20
|
+
"Value": {
|
21
|
+
"Fn::GetAtt": [
|
22
|
+
"Test",
|
23
|
+
"AvailabilityZone"
|
24
|
+
]
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
EOS
|
29
|
+
assert_equal exp_template.chomp, act_template
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class OutputDynamodbTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_output_dynamodb "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestTable": {
|
12
|
+
"Description": "description of TestTable",
|
13
|
+
"Value": {
|
14
|
+
"Ref": "TestTable"
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
18
|
+
EOS
|
19
|
+
assert_equal exp_template.chomp, act_template
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class OutputEc2Test < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_output_ec2 "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestInstance": {
|
12
|
+
"Description": "description of TestInstance",
|
13
|
+
"Value": {
|
14
|
+
"Ref": "TestInstance"
|
15
|
+
}
|
16
|
+
},
|
17
|
+
"TestInstanceAz": {
|
18
|
+
"Description": "description of TestInstanceAz",
|
19
|
+
"Value": {
|
20
|
+
"Fn::GetAtt": [
|
21
|
+
"TestInstance",
|
22
|
+
"AvailabilityZone"
|
23
|
+
]
|
24
|
+
}
|
25
|
+
},
|
26
|
+
"TestInstancePrivateIp": {
|
27
|
+
"Description": "description of TestInstancePrivateIp",
|
28
|
+
"Value": {
|
29
|
+
"Fn::GetAtt": [
|
30
|
+
"TestInstance",
|
31
|
+
"PrivateIp"
|
32
|
+
]
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
EOS
|
37
|
+
assert_equal exp_template.chomp, act_template
|
38
|
+
|
39
|
+
template = <<-EOS
|
40
|
+
_output_ec2 "test", public_ip: true
|
41
|
+
EOS
|
42
|
+
act_template = run_client_as_json(template)
|
43
|
+
exp_template = <<-EOS
|
44
|
+
{
|
45
|
+
"TestInstance": {
|
46
|
+
"Description": "description of TestInstance",
|
47
|
+
"Value": {
|
48
|
+
"Ref": "TestInstance"
|
49
|
+
}
|
50
|
+
},
|
51
|
+
"TestInstanceAz": {
|
52
|
+
"Description": "description of TestInstanceAz",
|
53
|
+
"Value": {
|
54
|
+
"Fn::GetAtt": [
|
55
|
+
"TestInstance",
|
56
|
+
"AvailabilityZone"
|
57
|
+
]
|
58
|
+
}
|
59
|
+
},
|
60
|
+
"TestInstancePublicIp": {
|
61
|
+
"Description": "description of TestInstancePublicIp",
|
62
|
+
"Value": {
|
63
|
+
"Fn::GetAtt": [
|
64
|
+
"TestInstance",
|
65
|
+
"PublicIp"
|
66
|
+
]
|
67
|
+
}
|
68
|
+
},
|
69
|
+
"TestInstancePrivateIp": {
|
70
|
+
"Description": "description of TestInstancePrivateIp",
|
71
|
+
"Value": {
|
72
|
+
"Fn::GetAtt": [
|
73
|
+
"TestInstance",
|
74
|
+
"PrivateIp"
|
75
|
+
]
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
EOS
|
80
|
+
assert_equal exp_template.chomp, act_template
|
81
|
+
end
|
82
|
+
end
|