kumogata-template 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +54 -0
- data/.travis.yml +8 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +75 -0
- data/README.md +204 -0
- data/Rakefile +23 -0
- data/bin/kumogata-template +9 -0
- data/kumogata-template.gemspec +26 -0
- data/lib/kumogata/template.rb +17 -0
- data/lib/kumogata/template/autoscaling.rb +77 -0
- data/lib/kumogata/template/cloudwatch.rb +28 -0
- data/lib/kumogata/template/codedeploy.rb +85 -0
- data/lib/kumogata/template/const.rb +175 -0
- data/lib/kumogata/template/datapipeline.rb +90 -0
- data/lib/kumogata/template/dynamodb.rb +111 -0
- data/lib/kumogata/template/ec2.rb +165 -0
- data/lib/kumogata/template/ecs.rb +119 -0
- data/lib/kumogata/template/elasticbeanstalk.rb +33 -0
- data/lib/kumogata/template/elb.rb +132 -0
- data/lib/kumogata/template/emr.rb +166 -0
- data/lib/kumogata/template/events.rb +25 -0
- data/lib/kumogata/template/ext/argument_parser.rb +8 -0
- data/lib/kumogata/template/ext/kumogata.rb +103 -0
- data/lib/kumogata/template/helper.rb +211 -0
- data/lib/kumogata/template/iam.rb +96 -0
- data/lib/kumogata/template/lambda.rb +34 -0
- data/lib/kumogata/template/s3.rb +223 -0
- data/lib/kumogata/template/sns.rb +25 -0
- data/lib/kumogata/template/version.rb +1 -0
- data/template/_template.rb +25 -0
- data/template/autoscaling-group.rb +47 -0
- data/template/autoscaling-launch-configuration.rb +54 -0
- data/template/autoscaling-lifecycle-hook.rb +27 -0
- data/template/autoscaling-scaling-policy.rb +33 -0
- data/template/autoscaling-scheduled-action.rb +37 -0
- data/template/cloudtrail.rb +39 -0
- data/template/cloudwatch-alarm.rb +45 -0
- data/template/codedeploy-application.rb +15 -0
- data/template/codedeploy-deployment-config.rb +23 -0
- data/template/codedeploy-deployment-group.rb +35 -0
- data/template/datapipeline-pipeline.rb +28 -0
- data/template/dynamodb-table.rb +33 -0
- data/template/ec2-eip-association.rb +23 -0
- data/template/ec2-eip.rb +17 -0
- data/template/ec2-instance.rb +65 -0
- data/template/ec2-internet-gateway.rb +15 -0
- data/template/ec2-nat-gateway.rb +17 -0
- data/template/ec2-network-acl-entry.rb +30 -0
- data/template/ec2-network-acl.rb +17 -0
- data/template/ec2-route-table.rb +17 -0
- data/template/ec2-route.rb +27 -0
- data/template/ec2-security-group.rb +24 -0
- data/template/ec2-subnet-network-acl-association.rb +17 -0
- data/template/ec2-subnet-route-table-association.rb +17 -0
- data/template/ec2-subnet.rb +23 -0
- data/template/ec2-volume-attachment.rb +19 -0
- data/template/ec2-volume.rb +31 -0
- data/template/ec2-vpc-endpoint.rb +23 -0
- data/template/ec2-vpc-gateway-attachment.rb +19 -0
- data/template/ec2-vpc.rb +24 -0
- data/template/ecs-cluster.rb +11 -0
- data/template/ecs-service.rb +24 -0
- data/template/ecs-task-definition.rb +18 -0
- data/template/elasticache-cache-cluster.rb +63 -0
- data/template/elasticache-parameter-group.rb +20 -0
- data/template/elasticache-replication-group.rb +58 -0
- data/template/elasticache-subnet-group.rb +17 -0
- data/template/elasticbeanstalk-application-version.rb +24 -0
- data/template/elasticbeanstalk-application.rb +17 -0
- data/template/elasticbeanstalk-configuration-template.rb +31 -0
- data/template/elasticbeanstalk-environment.rb +44 -0
- data/template/elb-loadbalancer.rb +46 -0
- data/template/emr-cluster.rb +39 -0
- data/template/emr-instance-group-config.rb +33 -0
- data/template/emr-step.rb +22 -0
- data/template/events-rule.rb +28 -0
- data/template/iam-access-key.rb +19 -0
- data/template/iam-group.rb +20 -0
- data/template/iam-instance-profile.rb +17 -0
- data/template/iam-managed-policy.rb +28 -0
- data/template/iam-policy.rb +26 -0
- data/template/iam-role.rb +21 -0
- data/template/iam-user-to-group-addition.rb +17 -0
- data/template/iam-user.rb +24 -0
- data/template/lambda-alias.rb +21 -0
- data/template/lambda-event-source-mapping.rb +24 -0
- data/template/lambda-function.rb +34 -0
- data/template/lambda-permission.rb +26 -0
- data/template/lambda-version.rb +19 -0
- data/template/mappings-ec2.rb +85 -0
- data/template/output-access-key.rb +6 -0
- data/template/output-arn.rb +6 -0
- data/template/output-autoscaling.rb +6 -0
- data/template/output-az.rb +6 -0
- data/template/output-dynamodb.rb +6 -0
- data/template/output-ec2.rb +8 -0
- data/template/output-elasticache.rb +30 -0
- data/template/output-elb.rb +12 -0
- data/template/output-emr.rb +6 -0
- data/template/output-rds.rb +10 -0
- data/template/output-redshift.rb +10 -0
- data/template/output-s3.rb +8 -0
- data/template/output-security-group.rb +5 -0
- data/template/output-sqs.rb +5 -0
- data/template/output-topic.rb +6 -0
- data/template/output-vpc.rb +10 -0
- data/template/output.rb +29 -0
- data/template/parameter-ec2.rb +22 -0
- data/template/parameter-elasticache.rb +9 -0
- data/template/parameter-rds.rb +9 -0
- data/template/parameter-redshift.rb +9 -0
- data/template/parameter.rb +20 -0
- data/template/rds-db-cluster-parameter-group.rb +22 -0
- data/template/rds-db-cluster.rb +47 -0
- data/template/rds-db-instance.rb +82 -0
- data/template/rds-db-parameter-group.rb +21 -0
- data/template/rds-db-subnet-group.rb +19 -0
- data/template/rds-event-subscription.rb +42 -0
- data/template/rds-option-group.rb +23 -0
- data/template/redshift-cluster-parameter-group.rb +19 -0
- data/template/redshift-cluster-subnet-group.rb +17 -0
- data/template/redshift-cluster.rb +60 -0
- data/template/s3-bucket-policy.rb +20 -0
- data/template/s3-bucket.rb +42 -0
- data/template/sns-topic.rb +20 -0
- data/template/sqs-queue.rb +27 -0
- data/test/_template.rb +26 -0
- data/test/abstract_unit.rb +101 -0
- data/test/autoscaling_test.rb +109 -0
- data/test/codedeploy_test.rb +117 -0
- data/test/datapipeline_test.rb +142 -0
- data/test/dynamodb_test.rb +184 -0
- data/test/ec2_test.rb +286 -0
- data/test/ecs_test.rb +135 -0
- data/test/elasticbeanstalk_test.rb +56 -0
- data/test/elb_test.rb +147 -0
- data/test/emr_test.rb +193 -0
- data/test/events_test.rb +22 -0
- data/test/helper_test.rb +547 -0
- data/test/iam_test.rb +93 -0
- data/test/lambda_test.rb +41 -0
- data/test/s3_test.rb +195 -0
- data/test/sns_test.rb +27 -0
- data/test/template/autoscaling-group_test.rb +177 -0
- data/test/template/autoscaling-launch-configuration_test.rb +117 -0
- data/test/template/autoscaling-lifecycle-hook_test.rb +33 -0
- data/test/template/autoscaling-scaling-policy_test.rb +26 -0
- data/test/template/autoscaling-scheduled-action_test.rb +26 -0
- data/test/template/cloudtrail_test.rb +55 -0
- data/test/template/cloudwatch-alarm_test.rb +38 -0
- data/test/template/codedeploy-application_test.rb +21 -0
- data/test/template/codedeploy-deployment-config_test.rb +26 -0
- data/test/template/codedeploy-deployment-group_test.rb +48 -0
- data/test/template/datapipeline-pipeline_test.rb +358 -0
- data/test/template/dynamodb-table_test.rb +94 -0
- data/test/template/ec2-eip-association_test.rb +22 -0
- data/test/template/ec2-eip_test.rb +21 -0
- data/test/template/ec2-instance_test.rb +95 -0
- data/test/template/ec2-internet-gateway_test.rb +48 -0
- data/test/template/ec2-nat-gateway_test.rb +22 -0
- data/test/template/ec2-network-acl-entry_test.rb +61 -0
- data/test/template/ec2-network-acl_test.rb +51 -0
- data/test/template/ec2-route-table_test.rb +49 -0
- data/test/template/ec2-route_test.rb +21 -0
- data/test/template/ec2-security-group_test.rb +50 -0
- data/test/template/ec2-subnet-netwokr-acl-association_test.rb +26 -0
- data/test/template/ec2-subnet-route-table-association_test.rb +22 -0
- data/test/template/ec2-subnet_test.rb +51 -0
- data/test/template/ec2-volume-attachment_test.rb +24 -0
- data/test/template/ec2-volume_test.rb +52 -0
- data/test/template/ec2-vpc-gateway-attachment_test.rb +23 -0
- data/test/template/ec2-vpc_test.rb +102 -0
- data/test/template/ecs-cluster_test.rb +18 -0
- data/test/template/ecs-service_test.rb +29 -0
- data/test/template/ecs-task-definition_test.rb +143 -0
- data/test/template/elasticache-cache-cluster_test.rb +77 -0
- data/test/template/elasticache-parameter-group_test.rb +25 -0
- data/test/template/elasticache-replication-group_test.rb +45 -0
- data/test/template/elasticache-subnet-group_test.rb +26 -0
- data/test/template/elasticbeanstalk-application-version_test.rb +27 -0
- data/test/template/elasticbeanstalk-application_test.rb +21 -0
- data/test/template/elasticbeanstalk-configuration-template_test.rb +23 -0
- data/test/template/elasticbeanstalk-environment_test.rb +56 -0
- data/test/template/elasticbeanstalk-template_test.rb +33 -0
- data/test/template/elb-loadbalancer_test.rb +94 -0
- data/test/template/emr-cluster_test.rb +147 -0
- data/test/template/emr-instance-group-config_test.rb +65 -0
- data/test/template/emr-step_test.rb +82 -0
- data/test/template/events-rule_test.rb +34 -0
- data/test/template/iam-access-key_test.rb +22 -0
- data/test/template/iam-group_test.rb +21 -0
- data/test/template/iam-instance-profile_test.rb +24 -0
- data/test/template/iam-managed-policy_test.rb +35 -0
- data/test/template/iam-policy_test.rb +52 -0
- data/test/template/iam-role_test.rb +37 -0
- data/test/template/iam-user-to-group-addition_test.rb +24 -0
- data/test/template/iam-user_test.rb +21 -0
- data/test/template/lambda-alias_test.rb +46 -0
- data/test/template/lambda-event-source-mapping_test.rb +36 -0
- data/test/template/lambda-function_test.rb +34 -0
- data/test/template/lambda-permission_test.rb +32 -0
- data/test/template/lambda-version_test.rb +27 -0
- data/test/template/mappings-ec2_test.rb +92 -0
- data/test/template/output-access-key_test.rb +30 -0
- data/test/template/output-arn_test.rb +30 -0
- data/test/template/output-autoscaling_test.rb +27 -0
- data/test/template/output-az_test.rb +31 -0
- data/test/template/output-dynamodb_test.rb +21 -0
- data/test/template/output-ec2_test.rb +82 -0
- data/test/template/output-elasticache_test.rb +107 -0
- data/test/template/output-elb_test.rb +48 -0
- data/test/template/output-emr_test.rb +30 -0
- data/test/template/output-rds_test.rb +39 -0
- data/test/template/output-redshift_test.rb +39 -0
- data/test/template/output-s3_test.rb +52 -0
- data/test/template/output-security-group_test.rb +21 -0
- data/test/template/output-sqs_test.rb +21 -0
- data/test/template/output-topic_test.rb +30 -0
- data/test/template/output-vpc_test.rb +48 -0
- data/test/template/output_test.rb +87 -0
- data/test/template/parameter-ec2_test.rb +44 -0
- data/test/template/parameter-elasticache_test.rb +30 -0
- data/test/template/parameter-rds_test.rb +30 -0
- data/test/template/parameter-redshift_test.rb +30 -0
- data/test/template/parameter_test.rb +40 -0
- data/test/template/rds-db-cluster-parameter-group_test.rb +53 -0
- data/test/template/rds-db-cluster_test.rb +84 -0
- data/test/template/rds-db-instance_test.rb +93 -0
- data/test/template/rds-db-parameter-group_test.rb +53 -0
- data/test/template/rds-db-subnet-group.rb +54 -0
- data/test/template/rds-event-subscription_test.rb +48 -0
- data/test/template/rds-option-group_test.rb +56 -0
- data/test/template/redshift-cluster-parameter-group_test.rb +28 -0
- data/test/template/redshift-cluster-subnet-group_test.rb +26 -0
- data/test/template/redshift-cluster_test.rb +47 -0
- data/test/template/s3-bucket-policy_test.rb +40 -0
- data/test/template/s3-bucket_test.rb +127 -0
- data/test/template/sns-topic_test.rb +42 -0
- data/test/template/sqs-queue_test.rb +25 -0
- metadata +468 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
#
|
2
|
+
# EC2 InternetGateway resource
|
3
|
+
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-internet-gateway.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "internet gateway")
|
8
|
+
tags = _tags(args)
|
9
|
+
|
10
|
+
_(name) do
|
11
|
+
Type "AWS::EC2::InternetGateway"
|
12
|
+
Properties do
|
13
|
+
Tags tags
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# EC2 NATGateway resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-natgateway.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "nat gateway")
|
8
|
+
allocation = _ref_attr_string("allocation", "AllocationId", args, "eip")
|
9
|
+
subnet = _ref_string("subnet", args, "subnet")
|
10
|
+
|
11
|
+
_(name) do
|
12
|
+
Type "AWS::EC2::NatGateway"
|
13
|
+
Properties do
|
14
|
+
AllocationId allocation
|
15
|
+
SubnetId subnet
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#
|
2
|
+
# EC2 Network ACL Entry resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
require 'kumogata/template/ec2'
|
7
|
+
|
8
|
+
name = _resource_name(args[:name], "network acl entry")
|
9
|
+
cidr = args[:cidr] || "0.0.0.0/0"
|
10
|
+
egress = _bool("egress", args, false)
|
11
|
+
icmp = args[:icmp] || ""
|
12
|
+
network_acl = _ref_string("network_acl", args, "network acl")
|
13
|
+
port_range = _ec2_port_range(args)
|
14
|
+
protocol = _ec2_protocol_number(args[:protocol])
|
15
|
+
rule_action = _valid_values(args[:action], %w( allow deny ), "allow")
|
16
|
+
rule_number = _valid_numbers(args[:number], 1, 32766, 100)
|
17
|
+
|
18
|
+
_(name) do
|
19
|
+
Type "AWS::EC2::NetworkAclEntry"
|
20
|
+
Properties do
|
21
|
+
CidrBlock cidr
|
22
|
+
Egress egress
|
23
|
+
Icmp icmp if protocol == 1
|
24
|
+
NetworkAclId network_acl
|
25
|
+
PortRange port_range if protocol == -1 or protocol == 6 or protocol == 17
|
26
|
+
Protocol protocol
|
27
|
+
RuleAction rule_action
|
28
|
+
RuleNumber rule_number
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# EC2 Network ACL resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "network acl")
|
8
|
+
tags = _tags(args)
|
9
|
+
vpc = _ref_string("vpc", args, "vpc")
|
10
|
+
|
11
|
+
_(name) do
|
12
|
+
Type "AWS::EC2::NetworkAcl"
|
13
|
+
Properties do
|
14
|
+
Tags tags
|
15
|
+
VpcId vpc
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# EC2 Route Table resource
|
3
|
+
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route-table.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "route table")
|
8
|
+
vpc = _ref_string("vpc", args, "vpc")
|
9
|
+
tags = _tags(args)
|
10
|
+
|
11
|
+
_(name) do
|
12
|
+
Type "AWS::EC2::RouteTable"
|
13
|
+
Properties do
|
14
|
+
VpcId vpc
|
15
|
+
Tags tags
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#
|
2
|
+
# EC2 Route resource
|
3
|
+
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "route")
|
8
|
+
destination_cidr = args[:destination_cidr] || "0.0.0.0/0"
|
9
|
+
gateway = _ref_string("gateway", args, "internet gateway")
|
10
|
+
instance = _ref_string("instance", args, "intance")
|
11
|
+
nat_gateway = _ref_string("nat_gateway", args, "nat gateway")
|
12
|
+
network_interface = _ref_string("network_interface", args)
|
13
|
+
route_table = _ref_string("route_table", args, "route table")
|
14
|
+
vpc_peering_connection = _ref_string("vpc_peering_connection", args)
|
15
|
+
|
16
|
+
_(name) do
|
17
|
+
Type "AWS::EC2::Route"
|
18
|
+
Properties do
|
19
|
+
DestinationCidrBlock destination_cidr
|
20
|
+
GatewayId gateway unless gateway.empty?
|
21
|
+
InstanceId instance unless instance.empty?
|
22
|
+
NatGatewayId nat_gateway unless nat_gateway.empty?
|
23
|
+
NetworkInterfaceId network_interface unless network_interface.empty?
|
24
|
+
RouteTableId route_table unless route_table.empty?
|
25
|
+
VpcPeeringConnectionId vpc_peering_connection unless vpc_peering_connection.empty?
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#
|
2
|
+
# EC2 Security Group resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
require 'kumogata/template/ec2'
|
7
|
+
|
8
|
+
name = _resource_name(args[:name], "security group")
|
9
|
+
description = args[:description] || "#{args[:name]} security group description"
|
10
|
+
egress = _ec2_security_group_egresses("egress", args)
|
11
|
+
ingress = _ec2_security_group_ingresses("ingress", args)
|
12
|
+
tags = _tags(args)
|
13
|
+
vpc = _ref_string("vpc", args, "vpc")
|
14
|
+
|
15
|
+
_(name) do
|
16
|
+
Type "AWS::EC2::SecurityGroup"
|
17
|
+
Properties do
|
18
|
+
GroupDescription description
|
19
|
+
SecurityGroupEgress egress unless egress.empty?
|
20
|
+
SecurityGroupIngress ingress unless ingress.empty?
|
21
|
+
Tags tags
|
22
|
+
VpcId vpc unless vpc.empty?
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# EC2 Subnet Network Acl Association resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-network-acl-assoc.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "subnet network acl association")
|
8
|
+
subnet = _ref_string("subnet", args, "subnet")
|
9
|
+
network_acl = _ref_string("network_acl", args, "network acl")
|
10
|
+
|
11
|
+
_(name) do
|
12
|
+
Type "AWS::EC2::SubnetNetworkAclAssociation"
|
13
|
+
Properties do
|
14
|
+
SubnetId subnet
|
15
|
+
NetworkAclId network_acl
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# EC2 SubnetRouteTableAssociation
|
3
|
+
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-route-table-assoc.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "subnet route table association")
|
8
|
+
route_table = _ref_string("route_table", args, "route table")
|
9
|
+
subnet = _ref_string("subnet", args, "subnet")
|
10
|
+
|
11
|
+
_(name) do
|
12
|
+
Type "AWS::EC2::SubnetRouteTableAssociation"
|
13
|
+
Properties do
|
14
|
+
RouteTableId route_table
|
15
|
+
SubnetId subnet
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#
|
2
|
+
# EC2 Subnet resource
|
3
|
+
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "subnet")
|
8
|
+
az = _availability_zone(args, false)
|
9
|
+
cidr = args[:cidr] || "10.1.0.0/24"
|
10
|
+
map_public_ip_on_launch = _bool("map_public_ip_on_launch", args, true)
|
11
|
+
tags = _tags(args)
|
12
|
+
vpc = _ref_string("vpc", args, "vpc")
|
13
|
+
|
14
|
+
_(name) do
|
15
|
+
Type "AWS::EC2::Subnet"
|
16
|
+
Properties do
|
17
|
+
AvailabilityZone az unless az.empty?
|
18
|
+
CidrBlock cidr
|
19
|
+
MapPublicIpOnLaunch map_public_ip_on_launch
|
20
|
+
Tags tags
|
21
|
+
VpcId vpc
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# EC2 Volume Attachment resource
|
3
|
+
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volumeattachment.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "volume attachment")
|
8
|
+
device = args[:device] || "/dev/sdb"
|
9
|
+
instance = _ref_string("instance", args, "instance")
|
10
|
+
volume = _ref_string("volume", args, "volume")
|
11
|
+
|
12
|
+
_(name) do
|
13
|
+
Type "AWS::EC2::VolumeAttachment"
|
14
|
+
Properties do
|
15
|
+
Device device
|
16
|
+
InstanceId instance
|
17
|
+
VolumeId volume
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#
|
2
|
+
# EC2 Volume resource
|
3
|
+
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "volume")
|
8
|
+
auto_enable = _bool("auto_enable", args, false)
|
9
|
+
az = _availability_zone(args)
|
10
|
+
encrypted = _bool("encrypted", args, false)
|
11
|
+
iops = args[:iops] || 300
|
12
|
+
size = _ref_string("size", args)
|
13
|
+
size = 10 if size.empty?
|
14
|
+
snapshot = args[:snapshot] || ""
|
15
|
+
tags = _tags(args)
|
16
|
+
type = _valid_values(args[:type], %w( io1 gp2 sc1 st1 ), "gp2")
|
17
|
+
|
18
|
+
_(name) do
|
19
|
+
Type AWS::EC2::Volume
|
20
|
+
Properties do
|
21
|
+
AutoEnableIO auto_enable
|
22
|
+
AvailabilityZone az
|
23
|
+
Encrypted encrypted if encrypted == true
|
24
|
+
Iops iops if type == "io1"
|
25
|
+
#KmsKeyId
|
26
|
+
Size size if snapshot.empty?
|
27
|
+
SnapshotId snapshot unless snapshot.empty?
|
28
|
+
Tags tags
|
29
|
+
VolumeType type
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#
|
2
|
+
# EC2 VPC endpoint resource
|
3
|
+
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "vpc endpoint")
|
8
|
+
route_tables = _ref_array("route_tables", args, "route table")
|
9
|
+
service_name = "com.amazonaws.#{args[:region]}.s3" # now s3 support only
|
10
|
+
vpc = _ref_string("vpc", args, "vpc")
|
11
|
+
|
12
|
+
_(name) do
|
13
|
+
Type "AWS::EC2::VPCEndpoint"
|
14
|
+
Properties do
|
15
|
+
PolicyDocument do
|
16
|
+
Version "2012-10-17"
|
17
|
+
Statement _iam_policy_document("policy_document", args)
|
18
|
+
end
|
19
|
+
RouteTableIds route_tables
|
20
|
+
ServiceName service_name
|
21
|
+
VpcId vpc
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# EC2 VPCGatewayAttachment resource
|
3
|
+
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "vpc gateway attachment")
|
8
|
+
internet_gateway = _ref_string("internet_gateway", args, "internet gateway")
|
9
|
+
vpc = _ref_string("vpc", args, "vpc")
|
10
|
+
vpc_gateway = _ref_string("vpc_gateway", args, "vpc gateway")
|
11
|
+
|
12
|
+
_(name) do
|
13
|
+
Type "AWS::EC2::VPCGatewayAttachment"
|
14
|
+
Properties do
|
15
|
+
InternetGatewayId internet_gateway
|
16
|
+
VpcId vpc
|
17
|
+
VpnGatewayId vpc_gateway unless vpc_gateway.empty?
|
18
|
+
end
|
19
|
+
end
|
data/template/ec2-vpc.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#
|
2
|
+
# EC2 VPC resource
|
3
|
+
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "vpc")
|
8
|
+
cidr = args[:cidr] || "191.168.1.0/16"
|
9
|
+
dns_support = _bool("dns_support", args, true)
|
10
|
+
dns_hostnames = args[:dns_hostnames] || dns_support
|
11
|
+
instance_tenancy = _valid_values(args[:instance_tenancy],
|
12
|
+
%w( default dedicated ), "default")
|
13
|
+
tags = _tags(args)
|
14
|
+
|
15
|
+
_(name) do
|
16
|
+
Type "AWS::EC2::VPC"
|
17
|
+
Properties do
|
18
|
+
CidrBlock cidr
|
19
|
+
EnableDnsSupport dns_support
|
20
|
+
EnableDnsHostnames dns_hostnames
|
21
|
+
InstanceTenancy instance_tenancy
|
22
|
+
Tags tags
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#
|
2
|
+
# ECS Clusteer resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-cluster.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "ecs cluster")
|
8
|
+
|
9
|
+
_(name) do
|
10
|
+
Type "AWS::ECS::Cluster"
|
11
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#
|
2
|
+
# ECS Service resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
require 'kumogata/template/ecs'
|
7
|
+
|
8
|
+
name = _resource_name(args[:name], "ecs service")
|
9
|
+
cluster = _ref_string("cluster", args, "ecs cluster")
|
10
|
+
desired = _ref_string("desired_count", args, "ecs desired count")
|
11
|
+
load_balancers = _ecs_load_balancers(args)
|
12
|
+
role = args[:role] || ""
|
13
|
+
task = _ref_string("task", args, "ecs task definition")
|
14
|
+
|
15
|
+
_(name) do
|
16
|
+
Type "AWS::ECS::Service"
|
17
|
+
Properties do
|
18
|
+
Cluster cluster
|
19
|
+
DesiredCount desired
|
20
|
+
LoadBalancers load_balancers unless load_balancers.empty?
|
21
|
+
Role role unless role.empty?
|
22
|
+
TaskDefinition task
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# ECS TaskDefinition resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
require 'kumogata/template/ecs'
|
7
|
+
|
8
|
+
name = _resource_name(args[:name], "ecs task definition")
|
9
|
+
definitions = _ecs_container_definitions(args)
|
10
|
+
volumes = _ecs_volumes(args)
|
11
|
+
|
12
|
+
_(name) do
|
13
|
+
Type "AWS::ECS::TaskDefinition"
|
14
|
+
Properties do
|
15
|
+
ContainerDefinitions definitions
|
16
|
+
Volumes volumes
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
#
|
2
|
+
# ElastiCache CacheCluster resource
|
3
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html
|
4
|
+
#
|
5
|
+
require 'kumogata/template/helper'
|
6
|
+
|
7
|
+
name = _resource_name(args[:name], "cache cluster")
|
8
|
+
engine = _valid_values(args[:engine], %w( memcached redis ), ELASTICACHE_DEFAULT_ENGINE)
|
9
|
+
auto = _bool("auto", args, true)
|
10
|
+
azmode = args[:azmode] || ""
|
11
|
+
node = _ref_string("node", args, "cache node types")
|
12
|
+
node = _valid_values(node, ELASTICACHE_NODE_TYPES, ELASTICACHE_DEFAULT_NODE_TYPE) unless node.is_a? Hash
|
13
|
+
parameter = _ref_string("parameter", args, "cache parameter group")
|
14
|
+
if parameter.empty?
|
15
|
+
if engine == "memcached"
|
16
|
+
parameter = "default.memcached1.4"
|
17
|
+
else
|
18
|
+
parameter = "default.redis2.8"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
subnet = _ref_string("subnet", args, "cache subnet group")
|
22
|
+
cluster = _ref_name("cluster", args, "cache cluster")
|
23
|
+
engine_version = _ref_string("engine_version", args, "cache engine version")
|
24
|
+
engine_version = ELASTICACHE_DEFAULT_ENGINE_VERSION[engine.to_sym] if engine_version.empty?
|
25
|
+
notification = _ref_attr_string("notification", "Arn", args)
|
26
|
+
notification = _ref_string("notification_arn", args) if notification.empty?
|
27
|
+
num = args[:num] || 1
|
28
|
+
port = _ref_string("port", args)
|
29
|
+
port = PORT[engine.to_sym] if port.empty?
|
30
|
+
az = _availability_zone(args, false)
|
31
|
+
azs = _availability_zones(args, false)
|
32
|
+
maintenance = _maintenance_window("elasticache", args[:maintenance] || DEFAULT_MAINTENANCE_TIME[:elasticache])
|
33
|
+
snapshot_retention = args[:snapshot_retention] || DEFAULT_SNAPSHOT_NUM
|
34
|
+
snapshot_window = _window_time("elasticache", args[:snapshot_window_start] || DEFAULT_SNAPSHOT_TIME[:elasticache])
|
35
|
+
tags = _tags(args)
|
36
|
+
security_groups = _ref_array("security_groups", args, "security group")
|
37
|
+
|
38
|
+
_(name) do
|
39
|
+
Type "AWS::ElastiCache::CacheCluster"
|
40
|
+
Properties do
|
41
|
+
AutoMinorVersionUpgrade auto
|
42
|
+
AZMode azmode unless azmode.empty? and engine == "redis"
|
43
|
+
CacheNodeType node
|
44
|
+
CacheParameterGroupName parameter
|
45
|
+
#CacheSecurityGroupNamesk security_groups if security_group_ids.empty?
|
46
|
+
CacheSubnetGroupName subnet
|
47
|
+
ClusterName cluster
|
48
|
+
Engine engine
|
49
|
+
EngineVersion engine_version
|
50
|
+
NotificationTopicArn notification unless notification.empty?
|
51
|
+
NumCacheNodes num
|
52
|
+
Port port
|
53
|
+
PreferredAvailabilityZone az if engine == "redis" and !az.empty?
|
54
|
+
PreferredAvailabilityZones azs if engine == "memached" and !azs.empty?
|
55
|
+
PreferredMaintenanceWindow maintenance
|
56
|
+
#SnapshotArns
|
57
|
+
#SnapshotName
|
58
|
+
SnapshotRetentionLimit snapshot_retention if engine == "redis"
|
59
|
+
SnapshotWindow snapshot_window if engine == "redis"
|
60
|
+
Tags tags
|
61
|
+
VpcSecurityGroupIds security_groups unless security_groups.empty?
|
62
|
+
end
|
63
|
+
end
|