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
@@ -3,14 +3,7 @@ require 'abstract_unit'
|
|
3
3
|
class RdsDbInstanceTest < Minitest::Test
|
4
4
|
def test_normal
|
5
5
|
template = <<-EOS
|
6
|
-
_rds_db_instance "test",
|
7
|
-
ref_db_name: "test",
|
8
|
-
ref_port: "test",
|
9
|
-
ref_subnet: "test",
|
10
|
-
ref_security_groups: "test",
|
11
|
-
ref_user_name: "test",
|
12
|
-
ref_user_password: "test",
|
13
|
-
az: "test"
|
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", az: "test"
|
14
7
|
EOS
|
15
8
|
act_template = run_client_as_json(template)
|
16
9
|
exp_template = <<-EOS
|
@@ -31,9 +24,7 @@ _rds_db_instance "test",
|
|
31
24
|
{
|
32
25
|
"Ref": "Service"
|
33
26
|
},
|
34
|
-
|
35
|
-
"Ref": "Name"
|
36
|
-
}
|
27
|
+
"test"
|
37
28
|
]
|
38
29
|
]
|
39
30
|
},
|
@@ -45,7 +36,7 @@ _rds_db_instance "test",
|
|
45
36
|
"Ref": "TestDbSubnetGroup"
|
46
37
|
},
|
47
38
|
"Engine": "mysql",
|
48
|
-
"EngineVersion": "
|
39
|
+
"EngineVersion": "#{RDS_DEFAULT_ENGINE_VERSION[:mysql]}",
|
49
40
|
"MasterUsername": {
|
50
41
|
"Ref": "TestDbMasterUserName"
|
51
42
|
},
|
@@ -96,367 +87,6 @@ _rds_db_instance "test",
|
|
96
87
|
]
|
97
88
|
}
|
98
89
|
}
|
99
|
-
}
|
100
|
-
EOS
|
101
|
-
assert_equal exp_template.chomp, act_template
|
102
|
-
end
|
103
|
-
|
104
|
-
def test_single_master
|
105
|
-
template = <<-EOS
|
106
|
-
_rds_db_instance 'test',
|
107
|
-
instance_class: 'db.t2.micro',
|
108
|
-
engine: 'mysql', engine_version: '5.7.17',
|
109
|
-
ref_db_name: 'test',
|
110
|
-
ref_subnet: 'test',
|
111
|
-
ref_security_groups: %w( test ),
|
112
|
-
ref_port: 'test',
|
113
|
-
ref_user_name: 'test',
|
114
|
-
ref_user_password: 'test'
|
115
|
-
EOS
|
116
|
-
act_template = run_client_as_json(template)
|
117
|
-
exp_template = <<-EOS
|
118
|
-
{
|
119
|
-
"TestDbInstance": {
|
120
|
-
"Type": "AWS::RDS::DBInstance",
|
121
|
-
"Properties": {
|
122
|
-
"AllocatedStorage": "5",
|
123
|
-
"AllowMajorVersionUpgrade": "true",
|
124
|
-
"AutoMinorVersionUpgrade": "true",
|
125
|
-
"BackupRetentionPeriod": "7",
|
126
|
-
"DBInstanceClass": "db.t2.micro",
|
127
|
-
"DBInstanceIdentifier": {
|
128
|
-
"Fn::Join": [
|
129
|
-
"-",
|
130
|
-
[
|
131
|
-
{
|
132
|
-
"Ref": "Service"
|
133
|
-
},
|
134
|
-
{
|
135
|
-
"Ref": "Name"
|
136
|
-
}
|
137
|
-
]
|
138
|
-
]
|
139
|
-
},
|
140
|
-
"DBName": {
|
141
|
-
"Ref": "TestDbName"
|
142
|
-
},
|
143
|
-
"DBParameterGroupName": "default.mysql5.7",
|
144
|
-
"DBSubnetGroupName": {
|
145
|
-
"Ref": "TestDbSubnetGroup"
|
146
|
-
},
|
147
|
-
"Engine": "mysql",
|
148
|
-
"EngineVersion": "5.7.17",
|
149
|
-
"MasterUsername": {
|
150
|
-
"Ref": "TestDbMasterUserName"
|
151
|
-
},
|
152
|
-
"MasterUserPassword": {
|
153
|
-
"Ref": "TestDbMasterUserPassword"
|
154
|
-
},
|
155
|
-
"MonitoringInterval": "0",
|
156
|
-
"MultiAZ": "false",
|
157
|
-
"Port": {
|
158
|
-
"Ref": "TestDbPort"
|
159
|
-
},
|
160
|
-
"PreferredBackupWindow": "21:30-22:00",
|
161
|
-
"PreferredMaintenanceWindow": "Thu:20:30-Thu:21:00",
|
162
|
-
"PubliclyAccessible": "false",
|
163
|
-
"StorageType": "gp2",
|
164
|
-
"Tags": [
|
165
|
-
{
|
166
|
-
"Key": "Name",
|
167
|
-
"Value": {
|
168
|
-
"Fn::Join": [
|
169
|
-
"-",
|
170
|
-
[
|
171
|
-
{
|
172
|
-
"Ref": "Service"
|
173
|
-
},
|
174
|
-
"test"
|
175
|
-
]
|
176
|
-
]
|
177
|
-
}
|
178
|
-
},
|
179
|
-
{
|
180
|
-
"Key": "Service",
|
181
|
-
"Value": {
|
182
|
-
"Ref": "Service"
|
183
|
-
}
|
184
|
-
},
|
185
|
-
{
|
186
|
-
"Key": "Version",
|
187
|
-
"Value": {
|
188
|
-
"Ref": "Version"
|
189
|
-
}
|
190
|
-
}
|
191
|
-
],
|
192
|
-
"VPCSecurityGroups": [
|
193
|
-
{
|
194
|
-
"Ref": "TestSecurityGroup"
|
195
|
-
}
|
196
|
-
]
|
197
|
-
}
|
198
|
-
}
|
199
|
-
}
|
200
|
-
EOS
|
201
|
-
assert_equal exp_template.chomp, act_template
|
202
|
-
end
|
203
|
-
|
204
|
-
def test_cluster
|
205
|
-
template = <<-EOS
|
206
|
-
_rds_db_instance 'test cluster',
|
207
|
-
engine: 'aurora',
|
208
|
-
instance_class: 'db.t2.medium',
|
209
|
-
ref_cluster: 'test'
|
210
|
-
EOS
|
211
|
-
act_template = run_client_as_json(template)
|
212
|
-
exp_template = <<-EOS
|
213
|
-
{
|
214
|
-
"TestClusterDbInstance": {
|
215
|
-
"Type": "AWS::RDS::DBInstance",
|
216
|
-
"Properties": {
|
217
|
-
"AllowMajorVersionUpgrade": "true",
|
218
|
-
"AutoMinorVersionUpgrade": "true",
|
219
|
-
"DBClusterIdentifier": {
|
220
|
-
"Ref": "TestDbCluster"
|
221
|
-
},
|
222
|
-
"DBInstanceClass": "db.t2.medium",
|
223
|
-
"DBInstanceIdentifier": {
|
224
|
-
"Fn::Join": [
|
225
|
-
"-",
|
226
|
-
[
|
227
|
-
{
|
228
|
-
"Ref": "Service"
|
229
|
-
},
|
230
|
-
{
|
231
|
-
"Ref": "Name"
|
232
|
-
}
|
233
|
-
]
|
234
|
-
]
|
235
|
-
},
|
236
|
-
"DBParameterGroupName": "default.aurora5.6",
|
237
|
-
"Engine": "aurora",
|
238
|
-
"EngineVersion": "5.6.10a",
|
239
|
-
"MonitoringInterval": "0",
|
240
|
-
"PubliclyAccessible": "false",
|
241
|
-
"Tags": [
|
242
|
-
{
|
243
|
-
"Key": "Name",
|
244
|
-
"Value": {
|
245
|
-
"Fn::Join": [
|
246
|
-
"-",
|
247
|
-
[
|
248
|
-
{
|
249
|
-
"Ref": "Service"
|
250
|
-
},
|
251
|
-
"test-cluster"
|
252
|
-
]
|
253
|
-
]
|
254
|
-
}
|
255
|
-
},
|
256
|
-
{
|
257
|
-
"Key": "Service",
|
258
|
-
"Value": {
|
259
|
-
"Ref": "Service"
|
260
|
-
}
|
261
|
-
},
|
262
|
-
{
|
263
|
-
"Key": "Version",
|
264
|
-
"Value": {
|
265
|
-
"Ref": "Version"
|
266
|
-
}
|
267
|
-
}
|
268
|
-
]
|
269
|
-
}
|
270
|
-
}
|
271
|
-
}
|
272
|
-
EOS
|
273
|
-
assert_equal exp_template.chomp, act_template
|
274
|
-
end
|
275
|
-
|
276
|
-
def test_slave
|
277
|
-
template = <<-EOS
|
278
|
-
_rds_db_instance 'test',
|
279
|
-
master_instance: 'master',
|
280
|
-
ref_port: 'test',
|
281
|
-
source_db: 'master',
|
282
|
-
instance_class: 'db.t2.micro',
|
283
|
-
engine: 'mysql',
|
284
|
-
engine_version: '5.7.17',
|
285
|
-
ref_security_groups: %w( test )
|
286
|
-
EOS
|
287
|
-
act_template = run_client_as_json(template)
|
288
|
-
exp_template = <<-EOS
|
289
|
-
{
|
290
|
-
"TestDbInstance": {
|
291
|
-
"Type": "AWS::RDS::DBInstance",
|
292
|
-
"Properties": {
|
293
|
-
"AllocatedStorage": "5",
|
294
|
-
"AllowMajorVersionUpgrade": "true",
|
295
|
-
"AutoMinorVersionUpgrade": "true",
|
296
|
-
"DBInstanceClass": "db.t2.micro",
|
297
|
-
"DBInstanceIdentifier": {
|
298
|
-
"Fn::Join": [
|
299
|
-
"-",
|
300
|
-
[
|
301
|
-
{
|
302
|
-
"Ref": "Service"
|
303
|
-
},
|
304
|
-
{
|
305
|
-
"Ref": "Name"
|
306
|
-
}
|
307
|
-
]
|
308
|
-
]
|
309
|
-
},
|
310
|
-
"DBParameterGroupName": "default.mysql5.7",
|
311
|
-
"Engine": "mysql",
|
312
|
-
"EngineVersion": "5.7.17",
|
313
|
-
"MonitoringInterval": "0",
|
314
|
-
"MultiAZ": "false",
|
315
|
-
"Port": {
|
316
|
-
"Ref": "TestDbPort"
|
317
|
-
},
|
318
|
-
"PreferredMaintenanceWindow": "Thu:20:30-Thu:21:00",
|
319
|
-
"PubliclyAccessible": "false",
|
320
|
-
"SourceDBInstanceIdentifier": "master",
|
321
|
-
"StorageType": "gp2",
|
322
|
-
"Tags": [
|
323
|
-
{
|
324
|
-
"Key": "Name",
|
325
|
-
"Value": {
|
326
|
-
"Fn::Join": [
|
327
|
-
"-",
|
328
|
-
[
|
329
|
-
{
|
330
|
-
"Ref": "Service"
|
331
|
-
},
|
332
|
-
"test"
|
333
|
-
]
|
334
|
-
]
|
335
|
-
}
|
336
|
-
},
|
337
|
-
{
|
338
|
-
"Key": "Service",
|
339
|
-
"Value": {
|
340
|
-
"Ref": "Service"
|
341
|
-
}
|
342
|
-
},
|
343
|
-
{
|
344
|
-
"Key": "Version",
|
345
|
-
"Value": {
|
346
|
-
"Ref": "Version"
|
347
|
-
}
|
348
|
-
}
|
349
|
-
],
|
350
|
-
"VPCSecurityGroups": [
|
351
|
-
{
|
352
|
-
"Ref": "TestSecurityGroup"
|
353
|
-
}
|
354
|
-
]
|
355
|
-
},
|
356
|
-
"DependsOn": "MasterDbInstance"
|
357
|
-
}
|
358
|
-
}
|
359
|
-
EOS
|
360
|
-
assert_equal exp_template.chomp, act_template
|
361
|
-
end
|
362
|
-
|
363
|
-
def test_multiaz
|
364
|
-
template = <<-EOS
|
365
|
-
_rds_db_instance 'test',
|
366
|
-
instance_class: 'db.t2.micro',
|
367
|
-
engine: 'mysql',
|
368
|
-
engine_version: '5.7.17',
|
369
|
-
ref_db_name: 'test',
|
370
|
-
ref_subnet: 'test',
|
371
|
-
ref_security_groups: %w( test ),
|
372
|
-
ref_user_name: 'test',
|
373
|
-
ref_user_password: 'test',
|
374
|
-
ref_port: 'test',
|
375
|
-
multi_az: true
|
376
|
-
EOS
|
377
|
-
act_template = run_client_as_json(template)
|
378
|
-
exp_template = <<-EOS
|
379
|
-
{
|
380
|
-
"TestDbInstance": {
|
381
|
-
"Type": "AWS::RDS::DBInstance",
|
382
|
-
"Properties": {
|
383
|
-
"AllocatedStorage": "5",
|
384
|
-
"AllowMajorVersionUpgrade": "true",
|
385
|
-
"AutoMinorVersionUpgrade": "true",
|
386
|
-
"BackupRetentionPeriod": "7",
|
387
|
-
"DBInstanceClass": "db.t2.micro",
|
388
|
-
"DBInstanceIdentifier": {
|
389
|
-
"Fn::Join": [
|
390
|
-
"-",
|
391
|
-
[
|
392
|
-
{
|
393
|
-
"Ref": "Service"
|
394
|
-
},
|
395
|
-
{
|
396
|
-
"Ref": "Name"
|
397
|
-
}
|
398
|
-
]
|
399
|
-
]
|
400
|
-
},
|
401
|
-
"DBName": {
|
402
|
-
"Ref": "TestDbName"
|
403
|
-
},
|
404
|
-
"DBParameterGroupName": "default.mysql5.7",
|
405
|
-
"DBSubnetGroupName": {
|
406
|
-
"Ref": "TestDbSubnetGroup"
|
407
|
-
},
|
408
|
-
"Engine": "mysql",
|
409
|
-
"EngineVersion": "5.7.17",
|
410
|
-
"MasterUsername": {
|
411
|
-
"Ref": "TestDbMasterUserName"
|
412
|
-
},
|
413
|
-
"MasterUserPassword": {
|
414
|
-
"Ref": "TestDbMasterUserPassword"
|
415
|
-
},
|
416
|
-
"MonitoringInterval": "0",
|
417
|
-
"MultiAZ": "true",
|
418
|
-
"Port": {
|
419
|
-
"Ref": "TestDbPort"
|
420
|
-
},
|
421
|
-
"PreferredBackupWindow": "21:30-22:00",
|
422
|
-
"PreferredMaintenanceWindow": "Thu:20:30-Thu:21:00",
|
423
|
-
"PubliclyAccessible": "false",
|
424
|
-
"StorageType": "gp2",
|
425
|
-
"Tags": [
|
426
|
-
{
|
427
|
-
"Key": "Name",
|
428
|
-
"Value": {
|
429
|
-
"Fn::Join": [
|
430
|
-
"-",
|
431
|
-
[
|
432
|
-
{
|
433
|
-
"Ref": "Service"
|
434
|
-
},
|
435
|
-
"test"
|
436
|
-
]
|
437
|
-
]
|
438
|
-
}
|
439
|
-
},
|
440
|
-
{
|
441
|
-
"Key": "Service",
|
442
|
-
"Value": {
|
443
|
-
"Ref": "Service"
|
444
|
-
}
|
445
|
-
},
|
446
|
-
{
|
447
|
-
"Key": "Version",
|
448
|
-
"Value": {
|
449
|
-
"Ref": "Version"
|
450
|
-
}
|
451
|
-
}
|
452
|
-
],
|
453
|
-
"VPCSecurityGroups": [
|
454
|
-
{
|
455
|
-
"Ref": "TestSecurityGroup"
|
456
|
-
}
|
457
|
-
]
|
458
|
-
}
|
459
|
-
}
|
460
90
|
}
|
461
91
|
EOS
|
462
92
|
assert_equal exp_template.chomp, act_template
|
@@ -3,7 +3,7 @@ require 'abstract_unit'
|
|
3
3
|
class RdsDbParameterGroupTest < Minitest::Test
|
4
4
|
def test_normal
|
5
5
|
template = <<-EOS
|
6
|
-
_rds_db_parameter_group "test", parameters: { test: "test" }
|
6
|
+
_rds_db_parameter_group "test", engine: 'mysql', parameters: { test: "test" }
|
7
7
|
EOS
|
8
8
|
act_template = run_client_as_json(template)
|
9
9
|
exp_template = <<-EOS
|
@@ -3,7 +3,7 @@ require 'abstract_unit'
|
|
3
3
|
class RdsOptionGroupTest < Minitest::Test
|
4
4
|
def test_normal
|
5
5
|
template = <<-EOS
|
6
|
-
_rds_option_group "test", configurations: [ {
|
6
|
+
_rds_option_group "test", configurations: [ { name: "MEMCACHED" } ]
|
7
7
|
EOS
|
8
8
|
act_template = run_client_as_json(template)
|
9
9
|
exp_template = <<-EOS
|
@@ -14,7 +14,7 @@ _rds_option_group "test", configurations: [ { OptionName: "MEMCACHED" } ]
|
|
14
14
|
"EngineName": "mysql",
|
15
15
|
"MajorEngineVersion": "5.7",
|
16
16
|
"OptionGroupDescription": "test option group description",
|
17
|
-
"
|
17
|
+
"OptionConfigurations": [
|
18
18
|
{
|
19
19
|
"OptionName": "MEMCACHED"
|
20
20
|
}
|
@@ -19,6 +19,34 @@ _redshift_cluster_parameter_group "test", parameters: parameters
|
|
19
19
|
"ParameterName": "enable_user_activity_logging",
|
20
20
|
"ParameterValue": "true"
|
21
21
|
}
|
22
|
+
],
|
23
|
+
"Tags": [
|
24
|
+
{
|
25
|
+
"Key": "Name",
|
26
|
+
"Value": {
|
27
|
+
"Fn::Join": [
|
28
|
+
"-",
|
29
|
+
[
|
30
|
+
{
|
31
|
+
"Ref": "Service"
|
32
|
+
},
|
33
|
+
"test"
|
34
|
+
]
|
35
|
+
]
|
36
|
+
}
|
37
|
+
},
|
38
|
+
{
|
39
|
+
"Key": "Service",
|
40
|
+
"Value": {
|
41
|
+
"Ref": "Service"
|
42
|
+
}
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"Key": "Version",
|
46
|
+
"Value": {
|
47
|
+
"Ref": "Version"
|
48
|
+
}
|
49
|
+
}
|
22
50
|
]
|
23
51
|
}
|
24
52
|
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'abstract_unit'
|
2
|
+
|
3
|
+
class RedshiftClusterSecurityGroupTest < Minitest::Test
|
4
|
+
def test_normal
|
5
|
+
template = <<-EOS
|
6
|
+
_redshift_cluster_security_group "test"
|
7
|
+
EOS
|
8
|
+
act_template = run_client_as_json(template)
|
9
|
+
exp_template = <<-EOS
|
10
|
+
{
|
11
|
+
"TestRedshiftClusterSecurityGroup": {
|
12
|
+
"Type": "AWS::Redshift::ClusterSecurityGroup",
|
13
|
+
"Properties": {
|
14
|
+
"Description": "test redshift cluster security group description",
|
15
|
+
"Tags": [
|
16
|
+
{
|
17
|
+
"Key": "Name",
|
18
|
+
"Value": {
|
19
|
+
"Fn::Join": [
|
20
|
+
"-",
|
21
|
+
[
|
22
|
+
{
|
23
|
+
"Ref": "Service"
|
24
|
+
},
|
25
|
+
"test"
|
26
|
+
]
|
27
|
+
]
|
28
|
+
}
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"Key": "Service",
|
32
|
+
"Value": {
|
33
|
+
"Ref": "Service"
|
34
|
+
}
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"Key": "Version",
|
38
|
+
"Value": {
|
39
|
+
"Ref": "Version"
|
40
|
+
}
|
41
|
+
}
|
42
|
+
]
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
EOS
|
47
|
+
assert_equal exp_template.chomp, act_template
|
48
|
+
end
|
49
|
+
end
|
@@ -16,6 +16,34 @@ _redshift_cluster_subnet_group "test", ref_subnets: "test"
|
|
16
16
|
{
|
17
17
|
"Ref": "TestSubnet"
|
18
18
|
}
|
19
|
+
],
|
20
|
+
"Tags": [
|
21
|
+
{
|
22
|
+
"Key": "Name",
|
23
|
+
"Value": {
|
24
|
+
"Fn::Join": [
|
25
|
+
"-",
|
26
|
+
[
|
27
|
+
{
|
28
|
+
"Ref": "Service"
|
29
|
+
},
|
30
|
+
"test"
|
31
|
+
]
|
32
|
+
]
|
33
|
+
}
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"Key": "Service",
|
37
|
+
"Value": {
|
38
|
+
"Ref": "Service"
|
39
|
+
}
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"Key": "Version",
|
43
|
+
"Value": {
|
44
|
+
"Ref": "Version"
|
45
|
+
}
|
46
|
+
}
|
19
47
|
]
|
20
48
|
}
|
21
49
|
}
|
@@ -21,18 +21,46 @@ _redshift_cluster "test", ref_db_name: "test", ref_parameter: "test", ref_subnet
|
|
21
21
|
},
|
22
22
|
"ClusterType": "single-node",
|
23
23
|
"DBName": {
|
24
|
-
"Ref": "
|
24
|
+
"Ref": "TestRedshiftClusterDbName"
|
25
25
|
},
|
26
26
|
"MasterUsername": {
|
27
|
-
"Ref": "
|
27
|
+
"Ref": "TestRedshiftClusterMasterUserName"
|
28
28
|
},
|
29
29
|
"MasterUserPassword": {
|
30
|
-
"Ref": "
|
30
|
+
"Ref": "TestRedshiftClusterMasterUserPassword"
|
31
31
|
},
|
32
|
-
"NodeType": "
|
33
|
-
"Port": "
|
32
|
+
"NodeType": "#{REDSHIFT_DEFAULT_NODE_TYPE}",
|
33
|
+
"Port": "#{PORT[:redshift]}",
|
34
34
|
"PreferredMaintenanceWindow": "Thu:20:45-Thu:21:15",
|
35
35
|
"PubliclyAccessible": "false",
|
36
|
+
"Tags": [
|
37
|
+
{
|
38
|
+
"Key": "Name",
|
39
|
+
"Value": {
|
40
|
+
"Fn::Join": [
|
41
|
+
"-",
|
42
|
+
[
|
43
|
+
{
|
44
|
+
"Ref": "Service"
|
45
|
+
},
|
46
|
+
"test"
|
47
|
+
]
|
48
|
+
]
|
49
|
+
}
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"Key": "Service",
|
53
|
+
"Value": {
|
54
|
+
"Ref": "Service"
|
55
|
+
}
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"Key": "Version",
|
59
|
+
"Value": {
|
60
|
+
"Ref": "Version"
|
61
|
+
}
|
62
|
+
}
|
63
|
+
],
|
36
64
|
"VpcSecurityGroupIds": [
|
37
65
|
{
|
38
66
|
"Ref": "TestSecurityGroup"
|
@@ -19,9 +19,7 @@ _s3_bucket "test"
|
|
19
19
|
{
|
20
20
|
"Ref": "Service"
|
21
21
|
},
|
22
|
-
|
23
|
-
"Ref": "Name"
|
24
|
-
}
|
22
|
+
"test"
|
25
23
|
]
|
26
24
|
]
|
27
25
|
},
|
@@ -63,7 +61,7 @@ _s3_bucket "test"
|
|
63
61
|
|
64
62
|
def test_aws_website
|
65
63
|
template = <<-EOS
|
66
|
-
_s3_bucket "test", bucket: "
|
64
|
+
_s3_bucket "test", bucket: "bucket", website: { error: "error.html", index: "index.html", routing: [ routing: { http: "404", key_prefix: "out1/" }, redirect: { host: "ec2-11-22-333-44.compute-1.#{DOMAIN}", replace_key_prefix: "report-404/" } ] }
|
67
65
|
EOS
|
68
66
|
act_template = run_client_as_json(template)
|
69
67
|
exp_template = <<-EOS
|
@@ -72,21 +70,11 @@ _s3_bucket "test", bucket: "PublicBucket", website: { error: "error.html", index
|
|
72
70
|
"Type": "AWS::S3::Bucket",
|
73
71
|
"Properties": {
|
74
72
|
"AccessControl": "PublicRead",
|
75
|
-
"BucketName": "
|
73
|
+
"BucketName": "bucket",
|
76
74
|
"Tags": [
|
77
75
|
{
|
78
76
|
"Key": "Name",
|
79
|
-
"Value":
|
80
|
-
"Fn::Join": [
|
81
|
-
"-",
|
82
|
-
[
|
83
|
-
{
|
84
|
-
"Ref": "Service"
|
85
|
-
},
|
86
|
-
"test"
|
87
|
-
]
|
88
|
-
]
|
89
|
-
}
|
77
|
+
"Value": "bucket"
|
90
78
|
},
|
91
79
|
{
|
92
80
|
"Key": "Service",
|
@@ -107,7 +95,7 @@ _s3_bucket "test", bucket: "PublicBucket", website: { error: "error.html", index
|
|
107
95
|
"RoutingRules": [
|
108
96
|
{
|
109
97
|
"RedirectRule": {
|
110
|
-
"HostName": "ec2-11-22-333-44.compute-1
|
98
|
+
"HostName": "ec2-11-22-333-44.compute-1.#{DOMAIN}",
|
111
99
|
"ReplaceKeyPrefixWith": "report-404/"
|
112
100
|
},
|
113
101
|
"RoutingRuleCondition": {
|
@@ -143,9 +131,7 @@ _s3_bucket "test"
|
|
143
131
|
{
|
144
132
|
"Ref": "Service"
|
145
133
|
},
|
146
|
-
|
147
|
-
"Ref": "Name"
|
148
|
-
}
|
134
|
+
"test"
|
149
135
|
]
|
150
136
|
]
|
151
137
|
},
|