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,7 +11,17 @@ _ec2_security_group "test", vpc: "test"
|
|
11
11
|
"TestSecurityGroup": {
|
12
12
|
"Type": "AWS::EC2::SecurityGroup",
|
13
13
|
"Properties": {
|
14
|
-
"GroupName":
|
14
|
+
"GroupName": {
|
15
|
+
"Fn::Join": [
|
16
|
+
"-",
|
17
|
+
[
|
18
|
+
{
|
19
|
+
"Ref": "Service"
|
20
|
+
},
|
21
|
+
"test"
|
22
|
+
]
|
23
|
+
]
|
24
|
+
},
|
15
25
|
"GroupDescription": "test security group description",
|
16
26
|
"Tags": [
|
17
27
|
{
|
@@ -3,7 +3,7 @@ require 'abstract_unit'
|
|
3
3
|
class Ec2SubnetTest < Minitest::Test
|
4
4
|
def test_normal
|
5
5
|
template = <<-EOS
|
6
|
-
_ec2_subnet "test", vpc: "test"
|
6
|
+
_ec2_subnet "test", { vpc: "test", public_ip: true }
|
7
7
|
EOS
|
8
8
|
act_template = run_client_as_json(template)
|
9
9
|
exp_template = <<-EOS
|
@@ -44,6 +44,67 @@ _ec2_subnet "test", vpc: "test"
|
|
44
44
|
"VpcId": "test"
|
45
45
|
}
|
46
46
|
}
|
47
|
+
}
|
48
|
+
EOS
|
49
|
+
assert_equal exp_template.chomp, act_template
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_association
|
53
|
+
template = <<-EOS
|
54
|
+
name = "test test"
|
55
|
+
_ec2_subnet name, { vpc: "test" }
|
56
|
+
_ec2_subnet_route_table_association name, ref_route_table: name, ref_subnet: name
|
57
|
+
EOS
|
58
|
+
act_template = run_client_as_json(template)
|
59
|
+
exp_template = <<-EOS
|
60
|
+
{
|
61
|
+
"TestTestSubnet": {
|
62
|
+
"Type": "AWS::EC2::Subnet",
|
63
|
+
"Properties": {
|
64
|
+
"CidrBlock": "10.1.0.0/24",
|
65
|
+
"MapPublicIpOnLaunch": "true",
|
66
|
+
"Tags": [
|
67
|
+
{
|
68
|
+
"Key": "Name",
|
69
|
+
"Value": {
|
70
|
+
"Fn::Join": [
|
71
|
+
"-",
|
72
|
+
[
|
73
|
+
{
|
74
|
+
"Ref": "Service"
|
75
|
+
},
|
76
|
+
"test-test"
|
77
|
+
]
|
78
|
+
]
|
79
|
+
}
|
80
|
+
},
|
81
|
+
{
|
82
|
+
"Key": "Service",
|
83
|
+
"Value": {
|
84
|
+
"Ref": "Service"
|
85
|
+
}
|
86
|
+
},
|
87
|
+
{
|
88
|
+
"Key": "Version",
|
89
|
+
"Value": {
|
90
|
+
"Ref": "Version"
|
91
|
+
}
|
92
|
+
}
|
93
|
+
],
|
94
|
+
"VpcId": "test"
|
95
|
+
}
|
96
|
+
},
|
97
|
+
"TestTestSubnetRouteTableAssociation": {
|
98
|
+
"Type": "AWS::EC2::SubnetRouteTableAssociation",
|
99
|
+
"Properties": {
|
100
|
+
"RouteTableId": {
|
101
|
+
"Ref": "TestTestRouteTable"
|
102
|
+
},
|
103
|
+
"SubnetId": {
|
104
|
+
"Ref": "TestTestSubnet"
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
47
108
|
}
|
48
109
|
EOS
|
49
110
|
assert_equal exp_template.chomp, act_template
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class Ec2VpcEndpointTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_ec2_vpc_endpoint "test", ref_route_tables: %w( test ), ref_vpc: "test",
|
7
|
+
policy_document: [ { service: "s3", principal: "*" } ]
|
8
|
+
EOS
|
9
|
+
act_template = run_client_as_json(template)
|
10
|
+
exp_template = <<-EOS
|
11
|
+
{
|
12
|
+
"TestVpcEndpoint": {
|
13
|
+
"Type": "AWS::EC2::VPCEndpoint",
|
14
|
+
"Properties": {
|
15
|
+
"PolicyDocument": {
|
16
|
+
"Version": "2012-10-17",
|
17
|
+
"Statement": [
|
18
|
+
{
|
19
|
+
"Effect": "Allow",
|
20
|
+
"Action": [
|
21
|
+
"s3:*"
|
22
|
+
],
|
23
|
+
"Resource": [
|
24
|
+
"*"
|
25
|
+
],
|
26
|
+
"Principal": "*"
|
27
|
+
}
|
28
|
+
]
|
29
|
+
},
|
30
|
+
"RouteTableIds": [
|
31
|
+
{
|
32
|
+
"Ref": "TestRouteTable"
|
33
|
+
}
|
34
|
+
],
|
35
|
+
"ServiceName": {
|
36
|
+
"Fn::Join": [
|
37
|
+
".",
|
38
|
+
[
|
39
|
+
"com.amazonaws",
|
40
|
+
{
|
41
|
+
"Ref": "AWS::Region"
|
42
|
+
},
|
43
|
+
"s3"
|
44
|
+
]
|
45
|
+
]
|
46
|
+
},
|
47
|
+
"VpcId": {
|
48
|
+
"Ref": "TestVpc"
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
EOS
|
54
|
+
assert_equal exp_template.chomp, act_template
|
55
|
+
end
|
56
|
+
end
|
@@ -3,17 +3,17 @@ require 'abstract_unit'
|
|
3
3
|
class EcrRepositoryTest < Minitest::Test
|
4
4
|
def test_normal
|
5
5
|
template = <<-EOS
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
6
|
+
actions = [
|
7
|
+
'get download url for layer',
|
8
|
+
'batch get image',
|
9
|
+
'batch check layer availability',
|
10
|
+
'put image',
|
11
|
+
'initiate layer upload',
|
12
|
+
'upload layer part',
|
13
|
+
'complete layer upload',
|
14
|
+
]
|
15
15
|
account = { id: 1, name: "test" }
|
16
|
-
_ecr_repository "test",
|
16
|
+
_ecr_repository "test", policy: { actions: actions, principal: { account: account } }
|
17
17
|
EOS
|
18
18
|
act_template = run_client_as_json(template)
|
19
19
|
exp_template = <<-EOS
|
@@ -21,7 +21,17 @@ _ecr_repository "test", { policy: { action: action, account: account } }
|
|
21
21
|
"TestEcrRepository": {
|
22
22
|
"Type": "AWS::ECR::Repository",
|
23
23
|
"Properties": {
|
24
|
-
"RepositoryName":
|
24
|
+
"RepositoryName": {
|
25
|
+
"Fn::Join": [
|
26
|
+
"-",
|
27
|
+
[
|
28
|
+
{
|
29
|
+
"Ref": "Service"
|
30
|
+
},
|
31
|
+
"test"
|
32
|
+
]
|
33
|
+
]
|
34
|
+
},
|
25
35
|
"RepositoryPolicyText": {
|
26
36
|
"Version": "2012-10-17",
|
27
37
|
"Statement": [
|
@@ -44,6 +54,48 @@ _ecr_repository "test", { policy: { action: action, account: account } }
|
|
44
54
|
}
|
45
55
|
}
|
46
56
|
}
|
57
|
+
}
|
58
|
+
EOS
|
59
|
+
assert_equal exp_template.chomp, act_template
|
60
|
+
|
61
|
+
template = <<-EOS
|
62
|
+
action = 'get download url for layer'
|
63
|
+
account = { id: 1, name: "test" }
|
64
|
+
_ecr_repository "test", { policy: { action: action, principal: { account: account } } }
|
65
|
+
EOS
|
66
|
+
act_template = run_client_as_json(template)
|
67
|
+
exp_template = <<-EOS
|
68
|
+
{
|
69
|
+
"TestEcrRepository": {
|
70
|
+
"Type": "AWS::ECR::Repository",
|
71
|
+
"Properties": {
|
72
|
+
"RepositoryName": {
|
73
|
+
"Fn::Join": [
|
74
|
+
"-",
|
75
|
+
[
|
76
|
+
{
|
77
|
+
"Ref": "Service"
|
78
|
+
},
|
79
|
+
"test"
|
80
|
+
]
|
81
|
+
]
|
82
|
+
},
|
83
|
+
"RepositoryPolicyText": {
|
84
|
+
"Version": "2012-10-17",
|
85
|
+
"Statement": [
|
86
|
+
{
|
87
|
+
"Effect": "Allow",
|
88
|
+
"Action": [
|
89
|
+
"ecr:GetDownloadUrlForLayer"
|
90
|
+
],
|
91
|
+
"Principal": {
|
92
|
+
"AWS": "arn:aws:iam::1:user/test"
|
93
|
+
}
|
94
|
+
}
|
95
|
+
]
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
47
99
|
}
|
48
100
|
EOS
|
49
101
|
assert_equal exp_template.chomp, act_template
|
@@ -3,7 +3,7 @@ require 'abstract_unit'
|
|
3
3
|
class EcsServiceTest < Minitest::Test
|
4
4
|
def test_normal
|
5
5
|
template = <<-EOS
|
6
|
-
_ecs_service "test", ref_cluster: "test",
|
6
|
+
_ecs_service "test", ref_cluster: "test", ref_desired: "test", ref_task: "test"
|
7
7
|
EOS
|
8
8
|
act_template = run_client_as_json(template)
|
9
9
|
exp_template = <<-EOS
|
@@ -17,7 +17,18 @@ _ecs_service "test", ref_cluster: "test", ref_desired_count: "test", ref_task: "
|
|
17
17
|
"DesiredCount": {
|
18
18
|
"Ref": "TestEcsDesiredCount"
|
19
19
|
},
|
20
|
-
"
|
20
|
+
"LaunchType": "EC2",
|
21
|
+
"ServiceName": {
|
22
|
+
"Fn::Join": [
|
23
|
+
"-",
|
24
|
+
[
|
25
|
+
{
|
26
|
+
"Ref": "Service"
|
27
|
+
},
|
28
|
+
"test"
|
29
|
+
]
|
30
|
+
]
|
31
|
+
},
|
21
32
|
"TaskDefinition": {
|
22
33
|
"Ref": "TestEcsTaskDefinition"
|
23
34
|
}
|
@@ -3,7 +3,7 @@ require 'abstract_unit'
|
|
3
3
|
class EcsTaskDefinitionTest < Minitest::Test
|
4
4
|
def test_normal
|
5
5
|
template = <<-EOS
|
6
|
-
_ecs_task_definition "test",
|
6
|
+
_ecs_task_definition "test", containers: [ { name: "test", image: "test", ports: [ { port: 80 } ] } ], volumes: [ "test": "/test" ]
|
7
7
|
EOS
|
8
8
|
act_template = run_client_as_json(template)
|
9
9
|
exp_template = <<-EOS
|
@@ -13,21 +13,51 @@ _ecs_task_definition "test", container_definitions: [ { name: "test", image: "te
|
|
13
13
|
"Properties": {
|
14
14
|
"Volumes": [
|
15
15
|
{
|
16
|
-
"Name": "test"
|
16
|
+
"Name": "test",
|
17
|
+
"Host": {
|
18
|
+
"SourcePath": "/test"
|
19
|
+
}
|
17
20
|
}
|
18
21
|
],
|
22
|
+
"Family": {
|
23
|
+
"Fn::Join": [
|
24
|
+
"-",
|
25
|
+
[
|
26
|
+
{
|
27
|
+
"Ref": "Service"
|
28
|
+
},
|
29
|
+
"test"
|
30
|
+
]
|
31
|
+
]
|
32
|
+
},
|
33
|
+
"NetworkMode": "bridge",
|
19
34
|
"ContainerDefinitions": [
|
20
35
|
{
|
21
|
-
"Cpu": "
|
36
|
+
"Cpu": "1",
|
37
|
+
"DisableNetworking": "false",
|
22
38
|
"Essential": "true",
|
39
|
+
"Hostname": {
|
40
|
+
"Fn::Join": [
|
41
|
+
"-",
|
42
|
+
[
|
43
|
+
{
|
44
|
+
"Ref": "Service"
|
45
|
+
},
|
46
|
+
"test"
|
47
|
+
]
|
48
|
+
]
|
49
|
+
},
|
23
50
|
"Image": "test",
|
24
51
|
"Memory": "300",
|
25
52
|
"Name": "test",
|
26
53
|
"PortMappings": [
|
27
54
|
{
|
28
|
-
"ContainerPort": "80"
|
55
|
+
"ContainerPort": "80",
|
56
|
+
"Protocol": "tcp"
|
29
57
|
}
|
30
|
-
]
|
58
|
+
],
|
59
|
+
"Privileged": "false",
|
60
|
+
"ReadonlyRootFilesystem": "false"
|
31
61
|
}
|
32
62
|
]
|
33
63
|
}
|
@@ -44,8 +74,8 @@ container1 = {
|
|
44
74
|
entry_point: [ "/usr/sbin/apache2", "-D", "FOREGROUND" ],
|
45
75
|
image: "amazon/amazon-ecs-sample",
|
46
76
|
memory: 500,
|
47
|
-
|
48
|
-
|
77
|
+
mounts: [ { source: "my-vol", path: "/var/www/my-vol" } ],
|
78
|
+
ports: [ { ref_port: "app", ref_host: "app" } ],
|
49
79
|
}
|
50
80
|
container2 = {
|
51
81
|
name: "busybox",
|
@@ -56,14 +86,14 @@ container2 = {
|
|
56
86
|
image: "busybox",
|
57
87
|
memory: 500,
|
58
88
|
port_mappings: nil,
|
59
|
-
|
89
|
+
volumes: [
|
60
90
|
{ ref_source: "app" }
|
61
91
|
],
|
62
92
|
}
|
63
93
|
volumes = [
|
64
|
-
{
|
94
|
+
{ "my-vol": "/var/lib/docker/vfs/dir/" },
|
65
95
|
]
|
66
|
-
_ecs_task_definition "test",
|
96
|
+
_ecs_task_definition "test", containers: [ container1, container2 ], volumes: volumes
|
67
97
|
EOS
|
68
98
|
act_template = run_client_as_json(template)
|
69
99
|
exp_template = <<-EOS
|
@@ -79,15 +109,41 @@ _ecs_task_definition "test", container_definitions: [ container1, container2 ],
|
|
79
109
|
}
|
80
110
|
}
|
81
111
|
],
|
112
|
+
"Family": {
|
113
|
+
"Fn::Join": [
|
114
|
+
"-",
|
115
|
+
[
|
116
|
+
{
|
117
|
+
"Ref": "Service"
|
118
|
+
},
|
119
|
+
"test"
|
120
|
+
]
|
121
|
+
]
|
122
|
+
},
|
123
|
+
"NetworkMode": "bridge",
|
82
124
|
"ContainerDefinitions": [
|
83
125
|
{
|
84
|
-
"Cpu": "
|
126
|
+
"Cpu": "1",
|
127
|
+
"DisableNetworking": "false",
|
85
128
|
"EntryPoint": [
|
86
129
|
"/usr/sbin/apache2",
|
87
130
|
"-D",
|
88
131
|
"FOREGROUND"
|
89
132
|
],
|
90
133
|
"Essential": "true",
|
134
|
+
"Hostname": {
|
135
|
+
"Fn::Join": [
|
136
|
+
"-",
|
137
|
+
[
|
138
|
+
{
|
139
|
+
"Ref": "Service"
|
140
|
+
},
|
141
|
+
{
|
142
|
+
"Ref": "App"
|
143
|
+
}
|
144
|
+
]
|
145
|
+
]
|
146
|
+
},
|
91
147
|
"Image": "amazon/amazon-ecs-sample",
|
92
148
|
"Memory": "500",
|
93
149
|
"MountPoints": [
|
@@ -107,23 +163,40 @@ _ecs_task_definition "test", container_definitions: [ container1, container2 ],
|
|
107
163
|
},
|
108
164
|
"HostPort": {
|
109
165
|
"Ref": "AppHostPort"
|
110
|
-
}
|
166
|
+
},
|
167
|
+
"Protocol": "tcp"
|
111
168
|
}
|
112
|
-
]
|
169
|
+
],
|
170
|
+
"Privileged": "false",
|
171
|
+
"ReadonlyRootFilesystem": "false"
|
113
172
|
},
|
114
173
|
{
|
115
174
|
"Command": [
|
116
175
|
"/bin/sh -c \\"while true; do /bin/date > /var/www/my-vol/date; sleep 1; done\\""
|
117
176
|
],
|
118
177
|
"Cpu": "10",
|
178
|
+
"DisableNetworking": "false",
|
119
179
|
"EntryPoint": [
|
120
180
|
"sh",
|
121
181
|
"-c"
|
122
182
|
],
|
123
183
|
"Essential": "false",
|
184
|
+
"Hostname": {
|
185
|
+
"Fn::Join": [
|
186
|
+
"-",
|
187
|
+
[
|
188
|
+
{
|
189
|
+
"Ref": "Service"
|
190
|
+
},
|
191
|
+
"busybox"
|
192
|
+
]
|
193
|
+
]
|
194
|
+
},
|
124
195
|
"Image": "busybox",
|
125
196
|
"Memory": "500",
|
126
197
|
"Name": "busybox",
|
198
|
+
"Privileged": "false",
|
199
|
+
"ReadonlyRootFilesystem": "false",
|
127
200
|
"VolumesFrom": [
|
128
201
|
{
|
129
202
|
"SourceContainer": {
|
@@ -22,16 +22,14 @@ _elasticache_cache_cluster "test", ref_security_groups: "test"
|
|
22
22
|
{
|
23
23
|
"Ref": "Service"
|
24
24
|
},
|
25
|
-
|
26
|
-
"Ref": "Name"
|
27
|
-
}
|
25
|
+
"test"
|
28
26
|
]
|
29
27
|
]
|
30
28
|
},
|
31
|
-
"Engine": "
|
32
|
-
"EngineVersion": "
|
29
|
+
"Engine": "#{ELASTICACHE_DEFAULT_ENGINE}",
|
30
|
+
"EngineVersion": "#{ELASTICACHE_DEFAULT_ENGINE_VERSION[:redis]}",
|
33
31
|
"NumCacheNodes": "1",
|
34
|
-
"Port": "
|
32
|
+
"Port": "#{PORT[:redis]}",
|
35
33
|
"PreferredMaintenanceWindow": "Thu:20:15-Thu:21:15",
|
36
34
|
"SnapshotRetentionLimit": "10",
|
37
35
|
"SnapshotWindow": "21:15-22:15",
|
@@ -19,7 +19,7 @@ _elasticache_replication_group "test", ref_security_groups: "test", ref_subnet:
|
|
19
19
|
"Ref": "TestCacheSubnetGroup"
|
20
20
|
},
|
21
21
|
"Engine": "redis",
|
22
|
-
"EngineVersion": "2.8.
|
22
|
+
"EngineVersion": "2.8.6",
|
23
23
|
"NumCacheClusters": "2",
|
24
24
|
"Port": "6379",
|
25
25
|
"PreferredCacheClusterAZs": {
|
@@ -12,6 +12,7 @@ _elasticbeanstalk_application_version "test", application: "test", ref_s3_bucket
|
|
12
12
|
"Type": "AWS::ElasticBeanstalk::ApplicationVersion",
|
13
13
|
"Properties": {
|
14
14
|
"ApplicationName": "test",
|
15
|
+
"Description": "test elasticbeanstalk application version description",
|
15
16
|
"SourceBundle": {
|
16
17
|
"S3Bucket": {
|
17
18
|
"Fn::Join": [
|
@@ -11,7 +11,8 @@ _elasticbeanstalk_application "test", application: "test"
|
|
11
11
|
"TestElasticbeanstalkApplication": {
|
12
12
|
"Type": "AWS::ElasticBeanstalk::Application",
|
13
13
|
"Properties": {
|
14
|
-
"ApplicationName": "test"
|
14
|
+
"ApplicationName": "test",
|
15
|
+
"Description": "test elasticbeanstalk application description"
|
15
16
|
}
|
16
17
|
}
|
17
18
|
}
|
@@ -13,7 +13,8 @@ _elasticbeanstalk_configuration_template "test", ref_application: "test"
|
|
13
13
|
"Properties": {
|
14
14
|
"ApplicationName": {
|
15
15
|
"Ref": "TestElasticbeanstalkApplication"
|
16
|
-
}
|
16
|
+
},
|
17
|
+
"Description": "test elasticbeanstalk configuration template description"
|
17
18
|
}
|
18
19
|
}
|
19
20
|
}
|
@@ -12,6 +12,7 @@ _elasticbeanstalk_configuration_template "test", application: "test", solution:
|
|
12
12
|
"Type": "AWS::ElasticBeanstalk::ConfigurationTemplate",
|
13
13
|
"Properties": {
|
14
14
|
"ApplicationName": "test",
|
15
|
+
"Description": "test elasticbeanstalk configuration template description",
|
15
16
|
"OptionSettings": [
|
16
17
|
{
|
17
18
|
"Namespace": "test",
|
@@ -34,9 +34,7 @@ _emr_cluster "test", job: { core: { name: "test" }, master: { name: "test" } }
|
|
34
34
|
{
|
35
35
|
"Ref": "Service"
|
36
36
|
},
|
37
|
-
|
38
|
-
"Ref": "Name"
|
39
|
-
}
|
37
|
+
"test"
|
40
38
|
]
|
41
39
|
]
|
42
40
|
},
|
@@ -112,17 +110,7 @@ _emr_cluster "test", job: { core: core, master: master, termination: true }, clu
|
|
112
110
|
"Tags": [
|
113
111
|
{
|
114
112
|
"Key": "Name",
|
115
|
-
"Value":
|
116
|
-
"Fn::Join": [
|
117
|
-
"-",
|
118
|
-
[
|
119
|
-
{
|
120
|
-
"Ref": "Service"
|
121
|
-
},
|
122
|
-
"test"
|
123
|
-
]
|
124
|
-
]
|
125
|
-
}
|
113
|
+
"Value": "TestCluster"
|
126
114
|
},
|
127
115
|
{
|
128
116
|
"Key": "Service",
|
@@ -25,9 +25,7 @@ _emr_instance_group_config "test", ref_cluster: "test"
|
|
25
25
|
{
|
26
26
|
"Ref": "Service"
|
27
27
|
},
|
28
|
-
|
29
|
-
"Ref": "Name"
|
30
|
-
}
|
28
|
+
"test"
|
31
29
|
]
|
32
30
|
]
|
33
31
|
}
|
@@ -40,7 +38,7 @@ _emr_instance_group_config "test", ref_cluster: "test"
|
|
40
38
|
|
41
39
|
def test_aws
|
42
40
|
template = <<-EOS
|
43
|
-
_emr_instance_group_config "test", ref_cluster: "cluster", instance_count: 2, instance_type: "m3.xlarge", instance_role: "TASK",
|
41
|
+
_emr_instance_group_config "test", ref_cluster: "cluster", instance_count: 2, instance_type: "m3.xlarge", instance_role: "TASK", config: "cfnTask2"
|
44
42
|
EOS
|
45
43
|
act_template = run_client_as_json(template)
|
46
44
|
exp_template = <<-EOS
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class EmrSecurityConfigurationTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_emr_security_configuration "test", configuration: { test: "test1" }
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestEmrSecurityConfiguration": {
|
12
|
+
"Type": "AWS::EMR::SecurityConfiguration",
|
13
|
+
"Properties": {
|
14
|
+
"Name": {
|
15
|
+
"Fn::Join": [
|
16
|
+
"-",
|
17
|
+
[
|
18
|
+
{
|
19
|
+
"Ref": "Service"
|
20
|
+
},
|
21
|
+
"test"
|
22
|
+
]
|
23
|
+
]
|
24
|
+
},
|
25
|
+
"SecurityConfiguration": {
|
26
|
+
"test": "test1"
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
EOS
|
32
|
+
assert_equal exp_template.chomp, act_template
|
33
|
+
end
|
34
|
+
end
|
@@ -25,9 +25,7 @@ _emr_step "test", ref_cluster: "test", jar: "test"
|
|
25
25
|
{
|
26
26
|
"Ref": "Service"
|
27
27
|
},
|
28
|
-
|
29
|
-
"Ref": "Name"
|
30
|
-
}
|
28
|
+
"test"
|
31
29
|
]
|
32
30
|
]
|
33
31
|
}
|
@@ -67,9 +65,7 @@ _emr_step "test", ref_cluster: "test", jar: "s3://emr-cfn-test/hadoop-mapreduce-
|
|
67
65
|
{
|
68
66
|
"Ref": "Service"
|
69
67
|
},
|
70
|
-
|
71
|
-
"Ref": "Name"
|
72
|
-
}
|
68
|
+
"test"
|
73
69
|
]
|
74
70
|
]
|
75
71
|
}
|