kumogata-template 0.0.35 → 0.0.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +4 -2
- data/Gemfile +1 -1
- data/Rakefile +1 -1
- data/kumogata-template.gemspec +4 -4
- data/lib/kumogata/template/alb.rb +48 -34
- data/lib/kumogata/template/api-gateway.rb +262 -0
- data/lib/kumogata/template/autoscaling.rb +17 -44
- data/lib/kumogata/template/certificate.rb +11 -8
- data/lib/kumogata/template/cloudfront.rb +67 -60
- data/lib/kumogata/template/cloudwatch.rb +7 -12
- data/lib/kumogata/template/codebuild.rb +4 -8
- data/lib/kumogata/template/codecommit.rb +2 -6
- data/lib/kumogata/template/codedeploy.rb +15 -0
- data/lib/kumogata/template/cognito.rb +203 -0
- data/lib/kumogata/template/const.rb +109 -47
- data/lib/kumogata/template/datapipeline.rb +16 -47
- data/lib/kumogata/template/dynamodb.rb +17 -8
- data/lib/kumogata/template/ec2.rb +61 -10
- data/lib/kumogata/template/ecr.rb +11 -9
- data/lib/kumogata/template/ecs.rb +256 -91
- data/lib/kumogata/template/elasticbeanstalk.rb +6 -9
- data/lib/kumogata/template/elb.rb +9 -24
- data/lib/kumogata/template/emr.rb +184 -51
- data/lib/kumogata/template/events.rb +22 -10
- data/lib/kumogata/template/ext/kumogata.rb +7 -7
- data/lib/kumogata/template/helper.rb +189 -130
- data/lib/kumogata/template/iam.rb +556 -146
- data/lib/kumogata/template/kinesis.rb +282 -0
- data/lib/kumogata/template/lambda.rb +43 -2
- data/lib/kumogata/template/logs.rb +2 -6
- data/lib/kumogata/template/nlb.rb +10 -0
- data/lib/kumogata/template/pinpoint.rb +83 -0
- data/lib/kumogata/template/rds.rb +52 -0
- data/lib/kumogata/template/redshift.rb +15 -6
- data/lib/kumogata/template/role.rb +425 -0
- data/lib/kumogata/template/s3.rb +120 -80
- data/lib/kumogata/template/sns.rb +2 -6
- data/lib/kumogata/template/version.rb +1 -1
- data/lib/kumogata/template.rb +9 -1
- data/template/_template.rb +2 -2
- data/template/alb-load-balancer.rb +5 -4
- data/template/alb-target-group.rb +8 -9
- data/template/api-gateway-account.rb +15 -0
- data/template/api-gateway-api-key.rb +22 -0
- data/template/api-gateway-authorizer.rb +38 -0
- data/template/api-gateway-base-path-mapping.rb +23 -0
- data/template/api-gateway-client-certificate.rb +16 -0
- data/template/api-gateway-deployment.rb +24 -0
- data/template/api-gateway-domain-name.rb +17 -0
- data/template/api-gateway-method.rb +71 -0
- data/template/api-gateway-model.rb +23 -0
- data/template/api-gateway-resource.rb +32 -0
- data/template/api-gateway-rest-api.rb +29 -0
- data/template/api-gateway-stage.rb +33 -0
- data/template/api-gateway-usage-plan-key.rb +19 -0
- data/template/api-gateway-usage-plan.rb +24 -0
- data/template/autoscaling-group.rb +2 -2
- data/template/autoscaling-launch-configuration.rb +7 -4
- data/template/autoscaling-scheduled-action.rb +0 -1
- data/template/certificate.rb +2 -2
- data/template/cloudfront-distribution.rb +4 -0
- data/template/cloudfront-origin-access-identity.rb +19 -0
- data/template/cloudtrail.rb +6 -4
- data/template/cloudwatch-alarm.rb +9 -3
- data/template/codebuild-project.rb +3 -3
- data/template/codecommit-repository.rb +2 -2
- data/template/codedeploy-application.rb +1 -1
- data/template/codedeploy-deployment-config.rb +1 -1
- data/template/codedeploy-deployment-group.rb +2 -0
- data/template/cognito-identity-pool.rb +34 -0
- data/template/cognito-identity-role-attachment.rb +22 -0
- data/template/cognito-user-pool-client.rb +28 -0
- data/template/cognito-user-pool-group.rb +24 -0
- data/template/cognito-user-pool-user-to-group-attachment.rb +20 -0
- data/template/cognito-user-pool-user.rb +28 -0
- data/template/cognito-user-pool.rb +45 -0
- data/template/datapipeline-pipeline.rb +4 -4
- data/template/dynamodb-table.rb +5 -1
- data/template/ec2-eip-association.rb +1 -1
- data/template/ec2-instance.rb +4 -1
- data/template/ec2-nat-gateway.rb +4 -0
- data/template/ec2-route.rb +4 -0
- data/template/ec2-security-group-ingress.rb +1 -1
- data/template/ec2-security-group.rb +2 -2
- data/template/ec2-subnet.rb +8 -4
- data/template/ec2-volume.rb +1 -2
- data/template/ec2-vpc-cidr-block.rb +4 -2
- data/template/ec2-vpc-endpoint.rb +5 -2
- data/template/ecr-repository.rb +2 -2
- data/template/ecs-cluster.rb +1 -1
- data/template/ecs-service.rb +19 -7
- data/template/ecs-task-definition.rb +4 -4
- data/template/elasticache-cache-cluster.rb +1 -1
- data/template/elasticache-parameter-group.rb +1 -1
- data/template/elasticache-replication-group.rb +1 -1
- data/template/elasticache-subnet-group.rb +1 -1
- data/template/elasticbeanstalk-application-version.rb +1 -1
- data/template/elasticbeanstalk-application.rb +1 -1
- data/template/elasticbeanstalk-configuration-template.rb +1 -1
- data/template/elasticbeanstalk-environment.rb +1 -1
- data/template/elb-load-balancer.rb +2 -2
- data/template/emr-cluster.rb +3 -3
- data/template/emr-instance-group-config.rb +4 -2
- data/template/emr-security-configuration.rb +17 -0
- data/template/emr-step.rb +2 -2
- data/template/events-rule.rb +8 -8
- data/template/iam-group.rb +2 -2
- data/template/iam-instance-profile.rb +2 -2
- data/template/iam-managed-policy.rb +1 -1
- data/template/iam-policy.rb +1 -1
- data/template/iam-role.rb +17 -2
- data/template/iam-user.rb +4 -4
- data/template/kinesis-firehose-delivery-stream.rb +36 -0
- data/template/kinesis-stream.rb +21 -0
- data/template/kms-alias.rb +2 -2
- data/template/kms-key.rb +1 -1
- data/template/lambda-alias.rb +2 -2
- data/template/lambda-event-source-mapping.rb +4 -4
- data/template/lambda-function.rb +17 -17
- data/template/lambda-permission.rb +31 -10
- data/template/lambda-version.rb +4 -2
- data/template/logs-destination.rb +1 -1
- data/template/logs-log-group.rb +1 -1
- data/template/logs-log-stream.rb +4 -2
- data/template/logs-metric-filter.rb +1 -1
- data/template/logs-subscription_filter.rb +1 -1
- data/template/mappings-ec2.rb +114 -52
- data/template/output-arn.rb +12 -4
- data/template/output-certificate.rb +11 -0
- data/template/output-distribution.rb +11 -0
- data/template/output-domain-name.rb +11 -0
- data/template/output-ecr-repository.rb +16 -0
- data/template/output-eip.rb +11 -0
- data/template/output-lambda-function.rb +6 -0
- data/template/output-name.rb +7 -2
- data/template/output-origin-access-identity.rb +13 -0
- data/template/output-rds-cluster.rb +17 -0
- data/template/{output-rds.rb → output-rds-instance.rb} +1 -1
- data/template/output-redshift.rb +11 -0
- data/template/output-rest-api.rb +11 -0
- data/template/output-s3.rb +3 -0
- data/template/output-stage.rb +19 -0
- data/template/output-subnet.rb +6 -3
- data/template/output-trail.rb +14 -0
- data/template/output-user-pool-client.rb +14 -0
- data/template/output-user-pool.rb +17 -0
- data/template/output-vpc.rb +13 -3
- data/template/output.rb +3 -2
- data/template/parameter-ec2.rb +10 -4
- data/template/parameter-elasticache.rb +1 -1
- data/template/parameter-rds.rb +51 -4
- data/template/parameter-redshift.rb +31 -1
- data/template/parameter.rb +87 -7
- data/template/rds-db-cluster-parameter-group.rb +18 -4
- data/template/rds-db-cluster.rb +19 -7
- data/template/rds-db-instance.rb +55 -131
- data/template/rds-db-parameter-group.rb +29 -3
- data/template/rds-db-subnet-group.rb +1 -1
- data/template/rds-event-subscription.rb +2 -4
- data/template/rds-option-group.rb +28 -5
- data/template/redshift-cluster-parameter-group.rb +3 -1
- data/template/redshift-cluster-security-group.rb +17 -0
- data/template/redshift-cluster-subnet-group.rb +3 -1
- data/template/redshift-cluster.rb +15 -12
- data/template/s3-bucket.rb +10 -5
- data/template/sns-topic.rb +2 -2
- data/template/sqs-queue.rb +1 -1
- data/test/abstract_unit.rb +2 -9
- data/test/cloudfront_test.rb +57 -28
- data/test/codedeploy_test.rb +21 -0
- data/test/datapipeline_test.rb +0 -22
- data/test/ec2_test.rb +12 -52
- data/test/ecs_test.rb +30 -26
- data/test/emr_test.rb +101 -20
- data/test/events_test.rb +47 -0
- data/test/helper_test.rb +251 -281
- data/test/iam_test.rb +572 -57
- data/test/lambda_test.rb +1 -1
- data/test/s3_test.rb +49 -14
- data/test/template/alb-load-balancer_test.rb +4 -5
- data/test/template/alb-target-group_test.rb +1 -3
- data/test/template/api-gateway-account_test.rb +26 -0
- data/test/template/api-gateway-api-key_test.rb +33 -0
- data/test/template/api-gateway-authorizer_test.rb +62 -0
- data/test/template/api-gateway-base-path-mapping_test.rb +27 -0
- data/test/template/api-gateway-client-certificate_test.rb +21 -0
- data/test/template/api-gateway-deployment_test.rb +27 -0
- data/test/template/api-gateway-domain-name_test.rb +26 -0
- data/test/template/api-gateway-method_test.rb +29 -0
- data/test/template/api-gateway-model_test.rb +37 -0
- data/test/template/api-gateway-resource_test.rb +82 -0
- data/test/template/api-gateway-rest-api_test.rb +33 -0
- data/test/template/api-gateway-stage_test.rb +39 -0
- data/test/template/api-gateway-usage-plan-key_test.rb +25 -0
- data/test/template/api-gateway-usage-plan_test.rb +42 -0
- data/test/template/cloudfront-distribution_test.rb +41 -3
- data/test/template/cloudtrail_test.rb +13 -5
- data/test/template/cloudwatch-alarm_test.rb +14 -2
- data/test/template/codebuild-project_test.rb +2 -11
- data/test/template/codecommit-repository_test.rb +12 -1
- data/test/template/cognito-identity-pool_test.rb +32 -0
- data/test/template/cognito-identity-role-attachment_test.rb +38 -0
- data/test/template/cognito-user-pool-client_test.rb +36 -0
- data/test/template/cognito-user-pool-group_test.rb +36 -0
- data/test/template/cognito-user-pool-user-to-group-attachment_test.rb +29 -0
- data/test/template/cognito-user-pool-user_test.rb +38 -0
- data/test/template/cognito-user-pool_test.rb +99 -0
- data/test/template/datapipeline-pipeline_test.rb +45 -6
- data/test/template/dynamodb-table_test.rb +19 -1
- data/test/template/ec2-instance_test.rb +9 -1
- data/test/template/ec2-nat-gateway_test.rb +29 -1
- data/test/template/ec2-security-group-egress_test.rb +1 -0
- data/test/template/ec2-security-group-ingress_test.rb +1 -0
- data/test/template/ec2-security-group_test.rb +11 -1
- data/test/template/ec2-spot-fleet_test.rb +1 -1
- data/test/template/ec2-subnet_test.rb +62 -1
- data/test/template/ec2-vpc-cidr-block_test.rb +1 -1
- data/test/template/ec2-vpc-endpoint_test.rb +56 -0
- data/test/template/ecr-repository_test.rb +63 -11
- data/test/template/ecs-service_test.rb +13 -2
- data/test/template/ecs-task-definition_test.rb +86 -13
- data/test/template/elasticache-cache-cluster_test.rb +4 -6
- data/test/template/elasticache-replication-group_test.rb +1 -1
- data/test/template/elasticbeanstalk-application-version_test.rb +1 -0
- data/test/template/elasticbeanstalk-application_test.rb +2 -1
- data/test/template/elasticbeanstalk-configuration-template_test.rb +2 -1
- data/test/template/elasticbeanstalk-template_test.rb +1 -0
- data/test/template/elb-load-balancer_test.rb +1 -3
- data/test/template/emr-cluster_test.rb +2 -14
- data/test/template/emr-instance-group-config_test.rb +2 -4
- data/test/template/emr-security-configuration_test.rb +34 -0
- data/test/template/emr-step_test.rb +2 -6
- data/test/template/events-rule_test.rb +3 -3
- data/test/template/iam-group_test.rb +11 -1
- data/test/template/iam-instance-profile_test.rb +11 -1
- data/test/template/iam-managed-policy_test.rb +1 -0
- data/test/template/iam-policy_test.rb +1 -3
- data/test/template/iam-role_test.rb +12 -2
- data/test/template/iam-user_test.rb +11 -17
- data/test/template/kinesis-firehorse-delivery-stream_test.rb +68 -0
- data/test/template/kinesis-stream_test.rb +61 -0
- data/test/template/kms-key_test.rb +1 -0
- data/test/template/lambda-alias_test.rb +2 -3
- data/test/template/lambda-event-source-mapping_test.rb +1 -1
- data/test/template/lambda-function_test.rb +20 -32
- data/test/template/lambda-permission_test.rb +7 -4
- data/test/template/lambda-version_test.rb +5 -2
- data/test/template/logs-log-group_test.rb +1 -3
- data/test/template/logs-log-stream_test.rb +2 -6
- data/test/template/logs-metric-filter_test.rb +1 -3
- data/test/template/logs-subscription-filter_test.rb +1 -3
- data/test/template/mappings-ec2_test.rb +10 -3
- data/test/template/output-domain-name_test.rb +30 -0
- data/test/template/output-name_test.rb +9 -0
- data/test/template/{output-rds_test.rb → output-rds-instance_test.rb} +2 -2
- data/test/template/output-rest-api_test.rb +30 -0
- data/test/template/output-s3_test.rb +9 -0
- data/test/template/output-stage_test.rb +43 -0
- data/test/template/output-user-pool-client_test.rb +39 -0
- data/test/template/output-user-pool_test.rb +48 -0
- data/test/template/output_test.rb +3 -1
- data/test/template/parameter-ec2_test.rb +22 -24
- data/test/template/parameter-elasticache_test.rb +2 -1
- data/test/template/parameter-rds_test.rb +32 -3
- data/test/template/parameter-redshift_test.rb +31 -2
- data/test/template/parameter_test.rb +37 -4
- data/test/template/rds-db-cluster-parameter-group_test.rb +1 -1
- data/test/template/rds-db-cluster_test.rb +4 -20
- data/test/template/rds-db-instance_test.rb +3 -373
- data/test/template/rds-db-parameter-group_test.rb +1 -1
- data/test/template/rds-option-group_test.rb +2 -2
- data/test/template/redshift-cluster-parameter-group_test.rb +28 -0
- data/test/template/redshift-cluster-security-group_test.rb +49 -0
- data/test/template/redshift-cluster-subnet-group_test.rb +28 -0
- data/test/template/redshift-cluster_test.rb +33 -5
- data/test/template/s3-bucket_test.rb +6 -20
- metadata +130 -22
@@ -11,6 +11,7 @@ _events_rule "test"
|
|
11
11
|
"TestEventsRule": {
|
12
12
|
"Type": "AWS::Events::Rule",
|
13
13
|
"Properties": {
|
14
|
+
"Description": "test events rule description",
|
14
15
|
"Name": {
|
15
16
|
"Fn::Join": [
|
16
17
|
"-",
|
@@ -18,12 +19,11 @@ _events_rule "test"
|
|
18
19
|
{
|
19
20
|
"Ref": "Service"
|
20
21
|
},
|
21
|
-
|
22
|
-
"Ref": "Name"
|
23
|
-
}
|
22
|
+
"test"
|
24
23
|
]
|
25
24
|
]
|
26
25
|
},
|
26
|
+
"ScheduleExpression": "rate(5 minute)",
|
27
27
|
"State": "ENABLED"
|
28
28
|
}
|
29
29
|
}
|
@@ -15,7 +15,17 @@ _iam_instance_profile "test", roles: [ "test" ]
|
|
15
15
|
"Roles": [
|
16
16
|
"test"
|
17
17
|
],
|
18
|
-
"InstanceProfileName":
|
18
|
+
"InstanceProfileName": {
|
19
|
+
"Fn::Join": [
|
20
|
+
"-",
|
21
|
+
[
|
22
|
+
{
|
23
|
+
"Ref": "Service"
|
24
|
+
},
|
25
|
+
"test"
|
26
|
+
]
|
27
|
+
]
|
28
|
+
}
|
19
29
|
}
|
20
30
|
}
|
21
31
|
}
|
@@ -11,6 +11,7 @@ _iam_managed_policy "test", policy_document: [ { service: "s3" } ]
|
|
11
11
|
"TestManagedPolicy": {
|
12
12
|
"Type": "AWS::IAM::ManagedPolicy",
|
13
13
|
"Properties": {
|
14
|
+
"Description": "test managed policy description",
|
14
15
|
"Path": "/",
|
15
16
|
"PolicyDocument": {
|
16
17
|
"Version": "2012-10-17",
|
@@ -18,7 +18,7 @@ _iam_role "test", user: "test", service: "s3"
|
|
18
18
|
"Effect": "Allow",
|
19
19
|
"Principal": {
|
20
20
|
"Service": [
|
21
|
-
"s3
|
21
|
+
"s3.#{DOMAIN}"
|
22
22
|
]
|
23
23
|
},
|
24
24
|
"Action": [
|
@@ -28,7 +28,17 @@ _iam_role "test", user: "test", service: "s3"
|
|
28
28
|
]
|
29
29
|
},
|
30
30
|
"Path": "/",
|
31
|
-
"RoleName":
|
31
|
+
"RoleName": {
|
32
|
+
"Fn::Join": [
|
33
|
+
"-",
|
34
|
+
[
|
35
|
+
{
|
36
|
+
"Ref": "Service"
|
37
|
+
},
|
38
|
+
"test"
|
39
|
+
]
|
40
|
+
]
|
41
|
+
}
|
32
42
|
}
|
33
43
|
}
|
34
44
|
}
|
@@ -12,7 +12,17 @@ _iam_user "test"
|
|
12
12
|
"Type": "AWS::IAM::User",
|
13
13
|
"Properties": {
|
14
14
|
"Path": "/",
|
15
|
-
"UserName":
|
15
|
+
"UserName": {
|
16
|
+
"Fn::Join": [
|
17
|
+
"-",
|
18
|
+
[
|
19
|
+
{
|
20
|
+
"Ref": "Service"
|
21
|
+
},
|
22
|
+
"test"
|
23
|
+
]
|
24
|
+
]
|
25
|
+
}
|
16
26
|
}
|
17
27
|
}
|
18
28
|
}
|
@@ -53,22 +63,6 @@ _iam_user "test", ref_user: "test"
|
|
53
63
|
}
|
54
64
|
}
|
55
65
|
}
|
56
|
-
}
|
57
|
-
EOS
|
58
|
-
assert_equal exp_template.chomp, act_template
|
59
|
-
|
60
|
-
template = <<-EOS
|
61
|
-
_iam_user "test", user: false
|
62
|
-
EOS
|
63
|
-
act_template = run_client_as_json(template)
|
64
|
-
exp_template = <<-EOS
|
65
|
-
{
|
66
|
-
"TestUser": {
|
67
|
-
"Type": "AWS::IAM::User",
|
68
|
-
"Properties": {
|
69
|
-
"Path": "/"
|
70
|
-
}
|
71
|
-
}
|
72
66
|
}
|
73
67
|
EOS
|
74
68
|
assert_equal exp_template.chomp, act_template
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class KinesisFirehoseDeliverySystemTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_kinesis_firehose_delivery_stream "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestKinesisFirehoseDeliveryStream": {
|
12
|
+
"Type": "AWS::KinesisFirehose::DeliveryStream",
|
13
|
+
"Properties": {
|
14
|
+
"DeliveryStreamName": {
|
15
|
+
"Fn::Join": [
|
16
|
+
"-",
|
17
|
+
[
|
18
|
+
{
|
19
|
+
"Ref": "Service"
|
20
|
+
},
|
21
|
+
"test"
|
22
|
+
]
|
23
|
+
]
|
24
|
+
},
|
25
|
+
"DeliveryStreamType": "DirectPut"
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
EOS
|
30
|
+
assert_equal exp_template.chomp, act_template
|
31
|
+
end
|
32
|
+
|
33
|
+
# FIXME
|
34
|
+
def test_kinesis_stream
|
35
|
+
template = <<-EOS
|
36
|
+
_kinesis_firehose_delivery_stream "test",
|
37
|
+
stream: "kinesis",
|
38
|
+
type: "kinesis", kinesis: { ref_stream: "test", ref_role: "test" }
|
39
|
+
EOS
|
40
|
+
act_template = run_client_as_json(template)
|
41
|
+
exp_template = <<-EOS
|
42
|
+
{
|
43
|
+
"TestKinesisFirehoseDeliveryStream": {
|
44
|
+
"Type": "AWS::KinesisFirehose::DeliveryStream",
|
45
|
+
"Properties": {
|
46
|
+
"DeliveryStreamName": "kinesis",
|
47
|
+
"DeliveryStreamType": "KinesisStreamAsSource",
|
48
|
+
"KinesisStreamSourceConfiguration": {
|
49
|
+
"KinesisStreamARN": {
|
50
|
+
"Fn::GetAtt": [
|
51
|
+
"TestKinesisStream",
|
52
|
+
"Arn"
|
53
|
+
]
|
54
|
+
},
|
55
|
+
"RoleARN": {
|
56
|
+
"Fn::GetAtt": [
|
57
|
+
"TestRole",
|
58
|
+
"Arn"
|
59
|
+
]
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
EOS
|
66
|
+
assert_equal exp_template.chomp, act_template
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class KinesisStreamTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_kinesis_stream "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestKinesisStream": {
|
12
|
+
"Type": "AWS::Kinesis::Stream",
|
13
|
+
"Properties": {
|
14
|
+
"Name": {
|
15
|
+
"Fn::Join": [
|
16
|
+
"-",
|
17
|
+
[
|
18
|
+
{
|
19
|
+
"Ref": "Service"
|
20
|
+
},
|
21
|
+
"test"
|
22
|
+
]
|
23
|
+
]
|
24
|
+
},
|
25
|
+
"RetentionPeriodHours": "24",
|
26
|
+
"ShardCount": "1",
|
27
|
+
"Tags": [
|
28
|
+
{
|
29
|
+
"Key": "Name",
|
30
|
+
"Value": {
|
31
|
+
"Fn::Join": [
|
32
|
+
"-",
|
33
|
+
[
|
34
|
+
{
|
35
|
+
"Ref": "Service"
|
36
|
+
},
|
37
|
+
"test"
|
38
|
+
]
|
39
|
+
]
|
40
|
+
}
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"Key": "Service",
|
44
|
+
"Value": {
|
45
|
+
"Ref": "Service"
|
46
|
+
}
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"Key": "Version",
|
50
|
+
"Value": {
|
51
|
+
"Ref": "Version"
|
52
|
+
}
|
53
|
+
}
|
54
|
+
]
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
EOS
|
59
|
+
assert_equal exp_template.chomp, act_template
|
60
|
+
end
|
61
|
+
end
|
@@ -12,6 +12,7 @@ _lambda_alias "test", ref_function_name: "test", ref_function_version: "test"
|
|
12
12
|
"TestLambdaAlias": {
|
13
13
|
"Type": "AWS::Lambda::Alias",
|
14
14
|
"Properties": {
|
15
|
+
"Description": "test lambda alias description",
|
15
16
|
"FunctionName": {
|
16
17
|
"Fn::GetAtt": [
|
17
18
|
"TestLambdaFunction",
|
@@ -31,9 +32,7 @@ _lambda_alias "test", ref_function_name: "test", ref_function_version: "test"
|
|
31
32
|
{
|
32
33
|
"Ref": "Service"
|
33
34
|
},
|
34
|
-
|
35
|
-
"Ref": "Name"
|
36
|
-
}
|
35
|
+
"test"
|
37
36
|
]
|
38
37
|
]
|
39
38
|
}
|
@@ -3,7 +3,7 @@ require 'abstract_unit'
|
|
3
3
|
class LambdaEventSourceMappingTest < Minitest::Test
|
4
4
|
def test_normal
|
5
5
|
template = <<-EOS
|
6
|
-
_lambda_event_source_mapping "test",
|
6
|
+
_lambda_event_source_mapping "test", ref_function: "test", ref_event: "test", event_prefix: "test"
|
7
7
|
|
8
8
|
EOS
|
9
9
|
act_template = run_client_as_json(template)
|
@@ -3,7 +3,7 @@ require 'abstract_unit'
|
|
3
3
|
class LambdaFunctionTest < Minitest::Test
|
4
4
|
def test_normal
|
5
5
|
template = <<-EOS
|
6
|
-
_lambda_function "test", code: { s3_bucket: "test", s3_key: "test" },
|
6
|
+
_lambda_function "test", runtime: 'node6', code: { s3_bucket: "test", s3_key: "test" }, function: "test", ref_role: "test"
|
7
7
|
EOS
|
8
8
|
act_template = run_client_as_json(template)
|
9
9
|
exp_template = <<-EOS
|
@@ -15,8 +15,9 @@ _lambda_function "test", code: { s3_bucket: "test", s3_key: "test" }, function_n
|
|
15
15
|
"S3Bucket": "test",
|
16
16
|
"S3Key": "test"
|
17
17
|
},
|
18
|
+
"Description": "test lambda function description",
|
18
19
|
"FunctionName": "test",
|
19
|
-
"Handler": "
|
20
|
+
"Handler": "lambda.handler",
|
20
21
|
"MemorySize": "128",
|
21
22
|
"Role": {
|
22
23
|
"Fn::GetAtt": [
|
@@ -24,22 +25,12 @@ _lambda_function "test", code: { s3_bucket: "test", s3_key: "test" }, function_n
|
|
24
25
|
"Arn"
|
25
26
|
]
|
26
27
|
},
|
27
|
-
"Runtime": "
|
28
|
-
"Timeout": "
|
28
|
+
"Runtime": "nodejs6.10",
|
29
|
+
"Timeout": "300",
|
29
30
|
"Tags": [
|
30
31
|
{
|
31
32
|
"Key": "Name",
|
32
|
-
"Value":
|
33
|
-
"Fn::Join": [
|
34
|
-
"-",
|
35
|
-
[
|
36
|
-
{
|
37
|
-
"Ref": "Service"
|
38
|
-
},
|
39
|
-
"test"
|
40
|
-
]
|
41
|
-
]
|
42
|
-
}
|
33
|
+
"Value": "test"
|
43
34
|
},
|
44
35
|
{
|
45
36
|
"Key": "Service",
|
@@ -54,14 +45,17 @@ _lambda_function "test", code: { s3_bucket: "test", s3_key: "test" }, function_n
|
|
54
45
|
}
|
55
46
|
}
|
56
47
|
]
|
57
|
-
}
|
48
|
+
},
|
49
|
+
"DependsOn": [
|
50
|
+
"TestRole"
|
51
|
+
]
|
58
52
|
}
|
59
53
|
}
|
60
54
|
EOS
|
61
55
|
assert_equal exp_template.chomp, act_template
|
62
56
|
|
63
57
|
template = <<-EOS
|
64
|
-
_lambda_function "test", code: { zip_file: "test/data/lambda_function.py" },
|
58
|
+
_lambda_function "test", code: { zip_file: "test/data/lambda_function.py" }, function: "test", ref_role: "test", runtime: "python2"
|
65
59
|
EOS
|
66
60
|
act_template = run_client_as_json(template)
|
67
61
|
exp_template = <<-EOS
|
@@ -72,7 +66,7 @@ _lambda_function "test", code: { zip_file: "test/data/lambda_function.py" }, fun
|
|
72
66
|
"Code": {
|
73
67
|
"ZipFile": {
|
74
68
|
"Fn::Join": [
|
75
|
-
"
|
69
|
+
"\\n",
|
76
70
|
[
|
77
71
|
"import boto3",
|
78
72
|
"",
|
@@ -82,8 +76,9 @@ _lambda_function "test", code: { zip_file: "test/data/lambda_function.py" }, fun
|
|
82
76
|
]
|
83
77
|
}
|
84
78
|
},
|
79
|
+
"Description": "test lambda function description",
|
85
80
|
"FunctionName": "test",
|
86
|
-
"Handler": "
|
81
|
+
"Handler": "lambda.handler",
|
87
82
|
"MemorySize": "128",
|
88
83
|
"Role": {
|
89
84
|
"Fn::GetAtt": [
|
@@ -92,21 +87,11 @@ _lambda_function "test", code: { zip_file: "test/data/lambda_function.py" }, fun
|
|
92
87
|
]
|
93
88
|
},
|
94
89
|
"Runtime": "python2.7",
|
95
|
-
"Timeout": "
|
90
|
+
"Timeout": "300",
|
96
91
|
"Tags": [
|
97
92
|
{
|
98
93
|
"Key": "Name",
|
99
|
-
"Value":
|
100
|
-
"Fn::Join": [
|
101
|
-
"-",
|
102
|
-
[
|
103
|
-
{
|
104
|
-
"Ref": "Service"
|
105
|
-
},
|
106
|
-
"test"
|
107
|
-
]
|
108
|
-
]
|
109
|
-
}
|
94
|
+
"Value": "test"
|
110
95
|
},
|
111
96
|
{
|
112
97
|
"Key": "Service",
|
@@ -121,7 +106,10 @@ _lambda_function "test", code: { zip_file: "test/data/lambda_function.py" }, fun
|
|
121
106
|
}
|
122
107
|
}
|
123
108
|
]
|
124
|
-
}
|
109
|
+
},
|
110
|
+
"DependsOn": [
|
111
|
+
"TestRole"
|
112
|
+
]
|
125
113
|
}
|
126
114
|
}
|
127
115
|
EOS
|
@@ -3,7 +3,7 @@ require 'abstract_unit'
|
|
3
3
|
class LambdaPermissionTest < Minitest::Test
|
4
4
|
def test_normal
|
5
5
|
template = <<-EOS
|
6
|
-
_lambda_permission "test",
|
6
|
+
_lambda_permission "test", principal: 'sns', ref_function: "test", ref_source_arn: "test"
|
7
7
|
|
8
8
|
EOS
|
9
9
|
act_template = run_client_as_json(template)
|
@@ -12,18 +12,21 @@ _lambda_permission "test", action: "test", ref_function_name: "test", ref_source
|
|
12
12
|
"TestLambdaPermission": {
|
13
13
|
"Type": "AWS::Lambda::Permission",
|
14
14
|
"Properties": {
|
15
|
-
"Action": "
|
15
|
+
"Action": "lambda:InvokeFunction",
|
16
16
|
"FunctionName": {
|
17
17
|
"Fn::GetAtt": [
|
18
18
|
"TestLambdaFunction",
|
19
19
|
"Arn"
|
20
20
|
]
|
21
21
|
},
|
22
|
-
"Principal": "sns
|
22
|
+
"Principal": "sns.#{DOMAIN}",
|
23
23
|
"SourceArn": {
|
24
24
|
"Ref": "TestTopic"
|
25
25
|
}
|
26
|
-
}
|
26
|
+
},
|
27
|
+
"DependsOn": [
|
28
|
+
"TestLambdaFunction"
|
29
|
+
]
|
27
30
|
}
|
28
31
|
}
|
29
32
|
EOS
|
@@ -3,7 +3,7 @@ require 'abstract_unit'
|
|
3
3
|
class LambdaVersionTest < Minitest::Test
|
4
4
|
def test_normal
|
5
5
|
template = <<-EOS
|
6
|
-
_lambda_version "test",
|
6
|
+
_lambda_version "test", ref_function: "test", ref_source_arn: "test"
|
7
7
|
|
8
8
|
EOS
|
9
9
|
act_template = run_client_as_json(template)
|
@@ -18,7 +18,10 @@ _lambda_version "test", ref_function_name: "test", ref_source_arn: "test"
|
|
18
18
|
"Arn"
|
19
19
|
]
|
20
20
|
}
|
21
|
-
}
|
21
|
+
},
|
22
|
+
"DependsOn": [
|
23
|
+
"TestLambdaFunction"
|
24
|
+
]
|
22
25
|
}
|
23
26
|
}
|
24
27
|
EOS
|
@@ -18,9 +18,7 @@ _logs_log_stream "test"
|
|
18
18
|
{
|
19
19
|
"Ref": "Service"
|
20
20
|
},
|
21
|
-
|
22
|
-
"Ref": "Name"
|
23
|
-
}
|
21
|
+
"test"
|
24
22
|
]
|
25
23
|
]
|
26
24
|
},
|
@@ -31,9 +29,7 @@ _logs_log_stream "test"
|
|
31
29
|
{
|
32
30
|
"Ref": "Service"
|
33
31
|
},
|
34
|
-
|
35
|
-
"Ref": "Name"
|
36
|
-
}
|
32
|
+
"test"
|
37
33
|
]
|
38
34
|
]
|
39
35
|
}
|
@@ -24,12 +24,18 @@ _mappings_ec2 "test"
|
|
24
24
|
#{archs.chomp}
|
25
25
|
},
|
26
26
|
"AWSRegionArch2AMIAmazonLinuxOfficial": {
|
27
|
+
#{images.chomp}
|
28
|
+
},
|
29
|
+
"AWSRegionArch2AMIAmazonLinux2Official": {
|
27
30
|
#{images.chomp}
|
28
31
|
},
|
29
32
|
"AWSRegionArch2AMICentos7Official": {
|
30
33
|
#{images.chomp}
|
31
34
|
},
|
32
35
|
"AWSRegionArch2AMIUbuntu16Official": {
|
36
|
+
#{images.chomp}
|
37
|
+
},
|
38
|
+
"AWSRegionArch2AMIEcsOfficial": {
|
33
39
|
#{images.chomp}
|
34
40
|
}
|
35
41
|
}
|
@@ -40,10 +46,11 @@ _mappings_ec2 "test"
|
|
40
46
|
private
|
41
47
|
def generate_image_values
|
42
48
|
values = ''
|
43
|
-
AWS_REGION.each_with_index do |
|
44
|
-
|
49
|
+
AWS_REGION.each_with_index do |region, i|
|
50
|
+
key, value = region
|
51
|
+
next if key =~ /local/
|
45
52
|
values += <<-EOS
|
46
|
-
"#{
|
53
|
+
"#{value}": {
|
47
54
|
"HVM64": "ami-*"
|
48
55
|
}#{i == (AWS_REGION.size - 1) ? '' : ','}
|
49
56
|
EOS
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class OutputDomainNameTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_output_domain_name "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestDomainNameDomain": {
|
12
|
+
"Description": "description of TestDomainNameDomain",
|
13
|
+
"Value": {
|
14
|
+
"Ref": "TestDomainName"
|
15
|
+
}
|
16
|
+
},
|
17
|
+
"TestDomainNameDistribution": {
|
18
|
+
"Description": "description of TestDomainNameDistribution",
|
19
|
+
"Value": {
|
20
|
+
"Fn::GetAtt": [
|
21
|
+
"TestDomainName",
|
22
|
+
"DistributionDomainName"
|
23
|
+
]
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
EOS
|
28
|
+
assert_equal exp_template.chomp, act_template
|
29
|
+
end
|
30
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'abstract_unit'
|
2
2
|
|
3
|
-
class
|
3
|
+
class OutputRdsInstanceTest < Minitest::Test
|
4
4
|
def test_normal
|
5
5
|
template = <<-EOS
|
6
|
-
|
6
|
+
_output_rds_instance "test"
|
7
7
|
EOS
|
8
8
|
act_template = run_client_as_json(template)
|
9
9
|
exp_template = <<-EOS
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class OutputRestApiTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_output_rest_api "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestRestApi": {
|
12
|
+
"Description": "description of TestRestApi",
|
13
|
+
"Value": {
|
14
|
+
"Ref": "TestRestApi"
|
15
|
+
}
|
16
|
+
},
|
17
|
+
"TestRestApiRootResource": {
|
18
|
+
"Description": "description of TestRestApiRootResource",
|
19
|
+
"Value": {
|
20
|
+
"Fn::GetAtt": [
|
21
|
+
"TestRestApi",
|
22
|
+
"RootResourceId"
|
23
|
+
]
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
EOS
|
28
|
+
assert_equal exp_template.chomp, act_template
|
29
|
+
end
|
30
|
+
end
|