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
data/template/rds-db-instance.rb
CHANGED
@@ -5,171 +5,95 @@
|
|
5
5
|
require 'kumogata/template/helper'
|
6
6
|
|
7
7
|
name = _resource_name(args[:name], "db instance")
|
8
|
+
engine = _valid_values(args[:engine],
|
9
|
+
%w( mysql mariadb
|
10
|
+
oracle-se1 oracle-se oracle-ee
|
11
|
+
sqlserver-ee sqlserver-se sqlserver-ex sqlserver-web
|
12
|
+
postgres aurora aurora-mysql aurora-postgresql ),
|
13
|
+
RDS_DEFAULT_ENGINE)
|
8
14
|
allocated = _ref_string_default("allocated", args, "", 5)
|
9
15
|
allow = _bool("allow", args, true)
|
10
16
|
auto = _bool("auto", args, true)
|
11
17
|
az = _availability_zone(args, false)
|
12
|
-
backup_retention =
|
13
|
-
character =
|
18
|
+
backup_retention = args[:backup_retention] || 7
|
19
|
+
character = args[:character] || ""
|
14
20
|
copy_tags =
|
15
21
|
if args.key? :copy_tags
|
16
22
|
_bool("copy_tags", args, true)
|
17
23
|
else
|
18
24
|
""
|
19
25
|
end
|
20
|
-
cluster =
|
21
|
-
|
22
|
-
instance_class =
|
23
|
-
|
26
|
+
cluster = _ref_string("cluster", args, "db cluster")
|
27
|
+
is_cluster = cluster.empty? ? false : true
|
28
|
+
instance_class = _ref_string("instance_class", args, "db instance class")
|
29
|
+
instance_class = _valid_values(instance_class, RDS_INSTANCE_CLASSES, RDS_DEFAULT_INSTANCE_CLASS) unless instance_class.is_a? Hash
|
30
|
+
instance_id = _name("instance_id", args)
|
24
31
|
db_name = _ref_string("db_name", args, "db name")
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-security-group.html
|
29
|
-
db_security_groups = _ref_array("db_security_groups", args, "db security group")
|
32
|
+
parameter = _ref_string_default("parameter", args, "db parameter group", "default.mysql5.7")
|
33
|
+
security = _ref_array("security_groups", args, "security group")
|
34
|
+
subnet_group = _ref_string("subnet_group", args, "db subnet group")
|
30
35
|
snapshot = _ref_string("snapshot", args, "db snapshot")
|
31
|
-
|
32
|
-
|
33
|
-
domain_iam = _ref_string("domain_iam", args, "db domain iam")
|
34
|
-
# http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html
|
35
|
-
engine = _valid_values(args[:engine],
|
36
|
-
%w( aurora mariadb mysql
|
37
|
-
oracle-ee oracle-se2 oracle-se1 oracle-se postgres
|
38
|
-
sqlserver-ee sqlserver-se sqlserver-ex sqlserver-web ), RDS_DEFAULT_ENGINE)
|
36
|
+
domain = args[:domain] || ""
|
37
|
+
domain_iam = args[:domain_iam] || ""
|
39
38
|
engine_version = _ref_string_default("engine_version", args, "db engine version", RDS_DEFAULT_ENGINE_VERSION[engine.to_sym])
|
40
|
-
iops =
|
41
|
-
if _ref_key?("iops", args, "db iops")
|
42
|
-
_ref_string_default("iops", args, "db iops", 1000)
|
43
|
-
else
|
44
|
-
""
|
45
|
-
end
|
46
|
-
kms = _ref_attr_string("kms", "Arn", args)
|
47
|
-
license = _valid_values(args[:license], %w( license-included bring-your-own-license general-public-license ))
|
39
|
+
iops = args[:iops] || ""
|
48
40
|
user_name = _ref_string("user_name", args, "db master user name")
|
49
41
|
user_password = _ref_string("user_password", args, "db master user password")
|
50
|
-
monitoring_interval =
|
51
|
-
|
42
|
+
monitoring_interval = _valid_values(args[:monitoring_interval], %w( 0 1 5 10 15 30 60 ), 0)
|
43
|
+
monitoring_role = _ref_attr_string('monitoring_role', 'Arn', args, 'role')
|
52
44
|
multi_az = _bool("multi_az", args, false)
|
53
45
|
option = _ref_string("option", args, "db option group")
|
54
46
|
port = _ref_string_default("port", args, "db port", PORT[engine.to_sym])
|
55
47
|
backup_window = _window_time("rds", args[:backup_start] || DEFAULT_SNAPSHOT_TIME[:rds])
|
56
48
|
maintenance = _maintenance_window("rds", args[:maintenance] || DEFAULT_MAINTENANCE_TIME[:rds])
|
57
49
|
publicly = _bool("publicly", args, false)
|
58
|
-
source_db = _ref_string("source_db", args, "db
|
59
|
-
|
50
|
+
source_db = _ref_string("source_db", args, "db source db")
|
51
|
+
storage_encrypted = _bool("encrypted", args, false)
|
60
52
|
storage_type = _valid_values(args[:storage_type], %w( standard gp2 io1 ), "gp2")
|
61
53
|
tags = _tags(args)
|
62
|
-
timezone =
|
54
|
+
timezone = args[:timezone] || ""
|
63
55
|
security_groups = _ref_array("security_groups", args, "security group")
|
64
|
-
## TODO use helper
|
65
|
-
depends = _resource_name(args[:master_instance], "db instance") unless _empty? source_db
|
66
|
-
|
67
|
-
allocated = "" unless _empty? cluster
|
68
|
-
character = "" if engine =~ /aurora/
|
69
|
-
parameter =
|
70
|
-
if _empty? parameter
|
71
|
-
if engine == "mysql" and engine_version =~ /5.7/
|
72
|
-
"default.mysql5.7"
|
73
|
-
elsif engine == "aurora" and engine_version =~ /5.6/
|
74
|
-
"default.aurora5.6"
|
75
|
-
elsif engine == "postgres" and engine_version =~ /9.4/
|
76
|
-
"default.postgres9.4"
|
77
|
-
elsif engine == "mariadb" and engine_version =~ /10.0/
|
78
|
-
"default.mariadb10.0"
|
79
|
-
else
|
80
|
-
nil
|
81
|
-
end
|
82
|
-
else
|
83
|
-
nil
|
84
|
-
end
|
85
|
-
instance_id = instance_id.downcase if instance_id.is_a? String
|
86
|
-
if engine !~ /sqlserver/
|
87
|
-
domain = ""
|
88
|
-
domain_iam = ""
|
89
|
-
end
|
90
|
-
db_name = "" unless _empty? snapshot
|
91
|
-
iops = "" if storage_type != "io1"
|
92
|
-
multi_az = false unless _empty? az
|
93
|
-
source_db = "" if engine !~ /(mysql|mariadb|postgres)/
|
94
|
-
unless _empty? source_db
|
95
|
-
multi_az = false
|
96
|
-
snapshot = ""
|
97
|
-
backup_retention = ""
|
98
|
-
db_name = ""
|
99
|
-
subnet = ""
|
100
|
-
user_name = ""
|
101
|
-
user_password = ""
|
102
|
-
backup_window = ""
|
103
|
-
end
|
104
|
-
encrypted = true unless _empty? kms
|
105
|
-
if encrypted
|
106
|
-
cluster = ""
|
107
|
-
snapshot = ""
|
108
|
-
source_db = ""
|
109
|
-
end
|
110
|
-
security_groups = "" unless _empty? db_security_groups
|
111
|
-
unless _empty? cluster
|
112
|
-
allocated = ""
|
113
|
-
backup_retention = ""
|
114
|
-
character = ""
|
115
|
-
db_security_groups = []
|
116
|
-
db_name = ""
|
117
|
-
subnet = ""
|
118
|
-
user_name = ""
|
119
|
-
user_password = ""
|
120
|
-
multi_az = ""
|
121
|
-
option = ""
|
122
|
-
backup_window = ""
|
123
|
-
maintenance = ""
|
124
|
-
port = ""
|
125
|
-
source_db = ""
|
126
|
-
security_groups = []
|
127
|
-
backup_window = ""
|
128
|
-
maintenance = ""
|
129
|
-
storage_type = ""
|
130
|
-
end
|
131
56
|
|
132
57
|
_(name) do
|
133
58
|
Type "AWS::RDS::DBInstance"
|
134
59
|
Properties do
|
135
|
-
AllocatedStorage allocated unless
|
60
|
+
AllocatedStorage allocated unless is_cluster
|
136
61
|
AllowMajorVersionUpgrade allow
|
137
62
|
AutoMinorVersionUpgrade auto
|
138
|
-
AvailabilityZone az
|
139
|
-
BackupRetentionPeriod backup_retention
|
140
|
-
CharacterSetName character
|
141
|
-
CopyTagsToSnapshot copy_tags unless
|
142
|
-
DBClusterIdentifier cluster
|
63
|
+
AvailabilityZone az if !multi_az and !is_cluster
|
64
|
+
BackupRetentionPeriod backup_retention if 0 < backup_retention and !is_cluster
|
65
|
+
CharacterSetName character if !character.empty? and engine =~ /^oracle.*$/
|
66
|
+
CopyTagsToSnapshot copy_tags unless copy_tags.empty?
|
67
|
+
DBClusterIdentifier cluster if is_cluster
|
143
68
|
DBInstanceClass instance_class
|
144
|
-
DBInstanceIdentifier instance_id
|
145
|
-
DBName db_name
|
146
|
-
DBParameterGroupName parameter unless
|
147
|
-
DBSecurityGroups
|
148
|
-
DBSnapshotIdentifier snapshot unless
|
149
|
-
DBSubnetGroupName
|
150
|
-
Domain domain unless
|
151
|
-
DomainIAMRoleName domain_iam unless
|
69
|
+
DBInstanceIdentifier instance_id
|
70
|
+
DBName db_name if snapshot.empty? and !is_cluster
|
71
|
+
DBParameterGroupName parameter unless parameter.empty?
|
72
|
+
DBSecurityGroups security unless !security_groups.empty? and !is_cluster
|
73
|
+
DBSnapshotIdentifier snapshot unless snapshot.empty?
|
74
|
+
DBSubnetGroupName subnet_group
|
75
|
+
Domain domain unless domain.empty? and engine !~ /sqlserver/
|
76
|
+
DomainIAMRoleName domain_iam unless domain_iam.empty? and engine !~ /sqlserver/
|
152
77
|
Engine engine
|
153
78
|
EngineVersion engine_version
|
154
|
-
Iops iops unless
|
155
|
-
KmsKeyId
|
156
|
-
LicenseModel
|
157
|
-
MasterUsername user_name unless
|
158
|
-
MasterUserPassword user_password unless
|
159
|
-
MonitoringInterval monitoring_interval
|
160
|
-
MonitoringRoleArn
|
161
|
-
MultiAZ multi_az
|
162
|
-
OptionGroupName option unless
|
163
|
-
Port port unless
|
164
|
-
PreferredBackupWindow backup_window unless
|
165
|
-
PreferredMaintenanceWindow maintenance unless
|
79
|
+
Iops iops unless iops.empty?
|
80
|
+
#KmsKeyId
|
81
|
+
#LicenseModel
|
82
|
+
MasterUsername user_name unless is_cluster
|
83
|
+
MasterUserPassword user_password unless is_cluster
|
84
|
+
MonitoringInterval monitoring_interval
|
85
|
+
MonitoringRoleArn monitoring_role unless monitoring_role.empty?
|
86
|
+
MultiAZ multi_az
|
87
|
+
OptionGroupName option unless option.empty?
|
88
|
+
Port port unless is_cluster
|
89
|
+
PreferredBackupWindow backup_window unless is_cluster
|
90
|
+
PreferredMaintenanceWindow maintenance unless is_cluster
|
166
91
|
PubliclyAccessible publicly
|
167
|
-
SourceDBInstanceIdentifier source_db unless
|
168
|
-
StorageEncrypted
|
169
|
-
StorageType storage_type unless
|
92
|
+
SourceDBInstanceIdentifier source_db unless source_db.empty?
|
93
|
+
StorageEncrypted storage_encrypted if storage_encrypted == true and !is_cluster
|
94
|
+
StorageType storage_type unless is_cluster
|
170
95
|
Tags tags
|
171
|
-
Timezone timezone unless
|
172
|
-
VPCSecurityGroups security_groups
|
96
|
+
Timezone timezone unless timezone.empty?
|
97
|
+
VPCSecurityGroups security_groups if !security_groups.empty? and !is_cluster
|
173
98
|
end
|
174
|
-
DependsOn depends unless _empty? depends
|
175
99
|
end
|
@@ -3,13 +3,39 @@
|
|
3
3
|
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-dbparametergroup.html
|
4
4
|
#
|
5
5
|
require 'kumogata/template/helper'
|
6
|
+
require 'kumogata/template/rds'
|
7
|
+
|
8
|
+
engine = _valid_values(args[:engine],
|
9
|
+
%w( mysql mariadb
|
10
|
+
oracle-se1 oracle-se oracle-ee
|
11
|
+
sqlserver-ee sqlserver-se sqlserver-ex sqlserver-web
|
12
|
+
postgresql aurora aurora-mysql aurora-postgresql ),
|
13
|
+
'mysql')
|
14
|
+
default_family =
|
15
|
+
case engine
|
16
|
+
when 'mysql'
|
17
|
+
'mysql5.7'
|
18
|
+
when 'mariadb'
|
19
|
+
'mariadb10.2'
|
20
|
+
when 'postgresql'
|
21
|
+
'postgres9.6'
|
22
|
+
when 'aurora'
|
23
|
+
'aurora5.6'
|
24
|
+
when 'aurora-mysql'
|
25
|
+
'aurora-mysql5.7'
|
26
|
+
when 'aurora-postgresql'
|
27
|
+
'aurora-postgresql9.6'
|
28
|
+
end
|
6
29
|
|
7
30
|
name = _resource_name(args[:name], "db parameter group")
|
8
|
-
description =
|
9
|
-
|
10
|
-
|
31
|
+
description = _ref_string_default("description", args, '',
|
32
|
+
"#{args[:name]} db parameter group description")
|
33
|
+
family = _ref_string_default("family", args, "db parameter group", default_family)
|
34
|
+
parameters = args[:parameters] || {}
|
11
35
|
tags = _tags(args)
|
12
36
|
|
37
|
+
parameters = parameters.merge(_rds_to_parameter_charset(args[:charset])) if args.key? :charset
|
38
|
+
|
13
39
|
_(name) do
|
14
40
|
Type "AWS::RDS::DBParameterGroup"
|
15
41
|
Properties do
|
@@ -5,7 +5,7 @@
|
|
5
5
|
require 'kumogata/template/helper'
|
6
6
|
|
7
7
|
name = _resource_name(args[:name], "db subnet group")
|
8
|
-
description =
|
8
|
+
description = _ref_string_default("description", args, '', "#{args[:name]} db subnet group description")
|
9
9
|
subnets = _ref_array("subnets", args, "subnet")
|
10
10
|
tags = _tags(args)
|
11
11
|
|
@@ -3,6 +3,7 @@
|
|
3
3
|
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-eventsubscription.html
|
4
4
|
#
|
5
5
|
require 'kumogata/template/helper'
|
6
|
+
require 'kumogata/template/rds'
|
6
7
|
|
7
8
|
name = _resource_name(args[:name], "event subscription")
|
8
9
|
enabled = _bool("enabled", args, true)
|
@@ -13,10 +14,7 @@ event_categories = args[:categories] ||
|
|
13
14
|
sns = _ref_attr_string("sns", "Arn", args, "role")
|
14
15
|
sns = _ref_string("sns_arn", args) if sns.empty?
|
15
16
|
sources = _ref_array("sources", args, "db instance")
|
16
|
-
source_type =
|
17
|
-
%w( db-instance db-parameter-group
|
18
|
-
db-security-group db-snapshot ),
|
19
|
-
"db-instance")
|
17
|
+
source_type = _rds_to_event_subscription_source(args[:source_type])
|
20
18
|
source_prefix =
|
21
19
|
case source_type
|
22
20
|
when "db-instance"
|
@@ -3,12 +3,35 @@
|
|
3
3
|
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-optiongroup.html
|
4
4
|
#
|
5
5
|
require 'kumogata/template/helper'
|
6
|
+
require 'kumogata/template/rds'
|
6
7
|
|
7
8
|
name = _resource_name(args[:name], "option group")
|
8
|
-
engine = args[:engine]
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
engine = _valid_values(args[:engine],
|
10
|
+
%w( mysql mariadb
|
11
|
+
oracle-se1 oracle-se oracle-ee
|
12
|
+
sqlserver-ee sqlserver-se sqlserver-ex sqlserver-web
|
13
|
+
postgres aurora aurora-mysql aurora-postgresql ),
|
14
|
+
RDS_DEFAULT_ENGINE)
|
15
|
+
major =
|
16
|
+
case engine
|
17
|
+
when 'mysql'
|
18
|
+
'5.7'
|
19
|
+
when 'mariadb'
|
20
|
+
'10.0'
|
21
|
+
when 'postgres'
|
22
|
+
'9.6'
|
23
|
+
when 'aurora'
|
24
|
+
'5.6'
|
25
|
+
when 'aurora-mysql'
|
26
|
+
'5.7'
|
27
|
+
when 'aurora-postgresql'
|
28
|
+
'9.6'
|
29
|
+
else
|
30
|
+
args[:major] || ""
|
31
|
+
end
|
32
|
+
description = _ref_string_default("description", args, '',
|
33
|
+
"#{args[:name]} option group description")
|
34
|
+
configurations = _rds_option_group_configurations(args)
|
12
35
|
tags = _tags(args)
|
13
36
|
|
14
37
|
_(name) do
|
@@ -17,7 +40,7 @@ _(name) do
|
|
17
40
|
EngineName engine
|
18
41
|
MajorEngineVersion major
|
19
42
|
OptionGroupDescription description
|
20
|
-
|
43
|
+
OptionConfigurations configurations
|
21
44
|
Tags tags
|
22
45
|
end
|
23
46
|
end
|
@@ -6,9 +6,10 @@ require 'kumogata/template/helper'
|
|
6
6
|
require 'kumogata/template/redshift'
|
7
7
|
|
8
8
|
name = _resource_name(args[:name], "redshift cluster parameter group")
|
9
|
-
description =
|
9
|
+
description = _ref_string_default("description", args, '', "#{args[:name]} redshift cluster parameter group description")
|
10
10
|
family = args[:family] || "redshift-1.0"
|
11
11
|
parameters = _redshift_parameters(args)
|
12
|
+
tags = _tags(args)
|
12
13
|
|
13
14
|
_(name) do
|
14
15
|
Type "AWS::Redshift::ClusterParameterGroup"
|
@@ -16,5 +17,6 @@ _(name) do
|
|
16
17
|
Description description
|
17
18
|
ParameterGroupFamily family
|
18
19
|
Parameters parameters
|
20
|
+
Tags tags
|
19
21
|
end
|
20
22
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# Redshift ClusterSecurityGroup resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersecuritygroup.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "redshift cluster security group")
|
8
|
+
description = _ref_string_default("description", args, '', "#{args[:name]} redshift cluster security group description")
|
9
|
+
tags = _tags(args)
|
10
|
+
|
11
|
+
_(name) do
|
12
|
+
Type "AWS::Redshift::ClusterSecurityGroup"
|
13
|
+
Properties do
|
14
|
+
Description description
|
15
|
+
Tags tags
|
16
|
+
end
|
17
|
+
end
|
@@ -5,13 +5,15 @@
|
|
5
5
|
require 'kumogata/template/helper'
|
6
6
|
|
7
7
|
name = _resource_name(args[:name], "redshift cluster subnet group")
|
8
|
-
description =
|
8
|
+
description = _ref_string_default("description", args, '', "#{args[:name]} redshift cluster subnet group description")
|
9
9
|
subnets = _ref_array("subnets", args, "subnet")
|
10
|
+
tags = _tags(args)
|
10
11
|
|
11
12
|
_(name) do
|
12
13
|
Type "AWS::Redshift::ClusterSubnetGroup"
|
13
14
|
Properties do
|
14
15
|
Description description
|
15
16
|
SubnetIds subnets
|
17
|
+
Tags tags
|
16
18
|
end
|
17
19
|
end
|
@@ -3,31 +3,32 @@
|
|
3
3
|
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html
|
4
4
|
#
|
5
5
|
require 'kumogata/template/helper'
|
6
|
+
require 'kumogata/template/redshift'
|
6
7
|
|
7
8
|
name = _resource_name(args[:name], "redshift cluster")
|
8
9
|
allow = _bool("allow", args, true)
|
9
10
|
snapshot_retention = args[:snapshot_retention] || DEFAULT_SNAPSHOT_NUM
|
10
|
-
az = _availability_zone(args, false)
|
11
|
+
az = _availability_zone(args, false, "redshift cluster zone name")
|
11
12
|
parameter = _ref_string("parameter", args, "redshift cluster parameter group")
|
12
13
|
subnet = _ref_string("subnet", args, "redshift cluster subnet group")
|
13
|
-
|
14
|
+
num = args[:num] || 1
|
15
|
+
type = (num == 1) ? "single-node" : "multi-node"
|
14
16
|
version = args[:version] || ""
|
15
|
-
db_name = _ref_string("db_name", args, "db name")
|
17
|
+
db_name = _ref_string("db_name", args, "redshift cluster db name")
|
16
18
|
elastic = args[:elastic] || ""
|
17
19
|
encrypted = _bool("encrypted", args, false)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
node =
|
23
|
-
num = args[:num] || 1
|
20
|
+
roles = _ref_array("roles", args, "role", "Arn")
|
21
|
+
logging = _redshift_logging(args)
|
22
|
+
user_name = _ref_string("user_name", args, "redshift cluster master user name")
|
23
|
+
user_password = _ref_string("user_password", args, "redshift cluster master user password")
|
24
|
+
node = _ref_string_default("node", args, "redshift cluster node types", REDSHIFT_DEFAULT_NODE_TYPE)
|
24
25
|
owner = args[:owner] || ""
|
25
|
-
port =
|
26
|
-
port = PORT[:redshift] if port.empty?
|
26
|
+
port = _ref_string_default("port", args, "redshift cluster port", PORT[:redshift])
|
27
27
|
maintenance = _maintenance_window("redshift", args[:maintenance] || DEFAULT_MAINTENANCE_TIME[:redshift])
|
28
28
|
publicly = _bool("publicly", args, false)
|
29
29
|
snapshot_cluster = args[:snapshot_cluster] || ""
|
30
30
|
snapshot_id = args[:snapshot_id] || ""
|
31
|
+
tags = _tags(args)
|
31
32
|
security_groups = _ref_array("security_groups", args, "security group")
|
32
33
|
|
33
34
|
_(name) do
|
@@ -46,8 +47,9 @@ _(name) do
|
|
46
47
|
Encrypted encrypted if encrypted == true
|
47
48
|
#HsmClientCertificateIdentifie
|
48
49
|
#HsmConfigurationIdentifier
|
49
|
-
IamRoles
|
50
|
+
IamRoles roles unless roles .empty?
|
50
51
|
#KmsKeyId
|
52
|
+
LoggingProperties logging unless logging.empty?
|
51
53
|
MasterUsername user_name
|
52
54
|
MasterUserPassword user_password
|
53
55
|
NodeType node
|
@@ -58,6 +60,7 @@ _(name) do
|
|
58
60
|
PubliclyAccessible publicly
|
59
61
|
SnapshotClusterIdentifier snapshot_cluster unless snapshot_cluster.empty?
|
60
62
|
SnapshotIdentifier snapshot_id unless snapshot_id.empty?
|
63
|
+
Tags tags
|
61
64
|
VpcSecurityGroupIds security_groups unless security_groups.empty?
|
62
65
|
end
|
63
66
|
end
|
data/template/s3-bucket.rb
CHANGED
@@ -7,21 +7,25 @@ require 'kumogata/template/s3'
|
|
7
7
|
|
8
8
|
name = _resource_name(args[:name], "bucket")
|
9
9
|
access =
|
10
|
-
if args.key? :
|
11
|
-
"PublicRead"
|
12
|
-
else
|
10
|
+
if args.key? :access
|
13
11
|
_s3_to_access(args[:access])
|
12
|
+
else
|
13
|
+
''
|
14
14
|
end
|
15
|
-
bucket =
|
15
|
+
bucket = _name("bucket", args)
|
16
16
|
cors = _s3_cors(args)
|
17
17
|
lifecycle = _s3_lifecycle(args)
|
18
18
|
logging = _s3_logging(args)
|
19
19
|
notification = _s3_notification(args)
|
20
20
|
replication = _s3_replication(args)
|
21
|
-
tags = _tags(args)
|
21
|
+
tags = _tags(args, "bucket")
|
22
22
|
versioning = _s3_versioning(args)
|
23
23
|
website = _s3_website(args)
|
24
24
|
deletion_policy = _s3_to_deletion_policy(args[:deletion_policy])
|
25
|
+
depends = _depends([ { ref_lambda_permission: 'lambda permission' } ], args)
|
26
|
+
|
27
|
+
access = "PublicRead" if !website.empty? and access == ''
|
28
|
+
access = "Private" if access.empty?
|
25
29
|
|
26
30
|
_(name) do
|
27
31
|
Type "AWS::S3::Bucket"
|
@@ -38,4 +42,5 @@ _(name) do
|
|
38
42
|
WebsiteConfiguration website unless website.empty?
|
39
43
|
end
|
40
44
|
DeletionPolicy deletion_policy
|
45
|
+
DependsOn depends unless depends.empty?
|
41
46
|
end
|
data/template/sns-topic.rb
CHANGED
@@ -6,9 +6,9 @@ require 'kumogata/template/helper'
|
|
6
6
|
require 'kumogata/template/sns'
|
7
7
|
|
8
8
|
name = _resource_name(args[:name], "topic")
|
9
|
-
display =
|
9
|
+
display = _name("display", args)
|
10
10
|
subscription = _sns_subscription_list(args)
|
11
|
-
topic =
|
11
|
+
topic = _name("topic", args)
|
12
12
|
|
13
13
|
_(name) do
|
14
14
|
Type "AWS::SNS::Topic"
|
data/template/sqs-queue.rb
CHANGED
@@ -20,7 +20,7 @@ fifo =
|
|
20
20
|
end
|
21
21
|
max = args[:max] || 262144 # default 256KiB
|
22
22
|
retention = args[:retention] || 345600 # default 4 days
|
23
|
-
queue =
|
23
|
+
queue = _name("queue", args)
|
24
24
|
receive = args[:receive] || 0
|
25
25
|
redrive = args[:redrive] || ""
|
26
26
|
visibility = args[:visibility] || 30 # default 30 seconds
|
data/test/abstract_unit.rb
CHANGED
@@ -5,20 +5,13 @@ require 'kumogata2/plugin/ruby'
|
|
5
5
|
require 'json'
|
6
6
|
require 'tempfile'
|
7
7
|
require 'yaml'
|
8
|
+
require 'kumogata/template/const'
|
8
9
|
|
9
10
|
# for only test
|
10
11
|
ENV['TZ'] = 'Asia/Tokyo'
|
11
12
|
|
12
|
-
class Kumogata2::Client
|
13
|
-
include Kumogata2::Logger::Helper
|
14
|
-
|
15
|
-
def initialize(options)
|
16
|
-
@options = options.kind_of?(Hashie::Mash) ? options : Hashie::Mash.new(options)
|
17
|
-
@plugin_by_ext = {}
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
13
|
class Kumogata2::Plugin::Ruby::Context
|
14
|
+
remove_method :define_template_func
|
22
15
|
def define_template_func(scope, path_or_url)
|
23
16
|
functions = ""
|
24
17
|
Dir.glob("template/*.rb").all? do |file|
|