cfndsl 0.15.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +3 -0
- data/.rubocop.yml +6 -6
- data/.travis.yml +10 -5
- data/CHANGELOG.md +721 -400
- data/Gemfile +2 -0
- data/README.md +85 -23
- data/Rakefile +28 -6
- data/TODO.md +18 -0
- data/UPGRADING.md +22 -0
- data/cfndsl.gemspec +17 -16
- data/exe/cfndsl +5 -0
- data/lib/cfndsl.rb +3 -113
- data/lib/cfndsl/aws/cloud_formation_template.rb +10 -1
- data/lib/cfndsl/aws/patches/000_CloudFormationResourceSpecification.json +51726 -0
- data/lib/cfndsl/aws/patches/000_sam.spec.json +1242 -0
- data/lib/cfndsl/aws/patches/100_sam.spec_DeploymentPreference_patch.json +64 -0
- data/lib/cfndsl/aws/patches/200_Scrutinies_patch.json +86 -0
- data/lib/cfndsl/aws/patches/500_Cognito_IdentityPoolRoleAttachment_patches.json +25 -0
- data/lib/cfndsl/aws/patches/500_IoT1Click_patch_PlacementTemplate_DeviceTemplates.json +20 -0
- data/lib/cfndsl/aws/patches/500_NetworkAclEntry_patch.json +16 -0
- data/lib/cfndsl/aws/patches/500_SAM_Serverless_Function_S3Event_Events_patch.json +16 -0
- data/lib/cfndsl/aws/patches/500_SAM_Serverless_Function_S3Location_Version_patch.json +16 -0
- data/lib/cfndsl/aws/patches/500_SSM_AssociationName_patch.json +16 -0
- data/lib/cfndsl/aws/patches/500_VPCEndpoint_patch.json +17 -0
- data/lib/cfndsl/aws/patches/510_ElasticSearch_Domain_patches.json +15 -0
- data/lib/cfndsl/aws/patches/520_ServiceDiscovery_InstanceAttributes_patch.json +16 -0
- data/lib/cfndsl/aws/patches/600_RefKinds_patch.json +3654 -0
- data/lib/cfndsl/aws/patches/700_SAM_Serverless_Function_InlineCode_patch.json +20 -0
- data/lib/cfndsl/aws/patches/800_List_types_patch.json +115 -0
- data/lib/cfndsl/aws/resource_specification.json +39955 -9293
- data/lib/cfndsl/aws/types.rb +5 -3
- data/lib/cfndsl/cfnlego.rb +34 -0
- data/lib/{cfnlego → cfndsl/cfnlego}/cloudformation.erb +0 -0
- data/lib/{cfnlego → cfndsl/cfnlego}/cloudformation.rb +3 -1
- data/lib/{cfnlego → cfndsl/cfnlego}/resource.rb +5 -8
- data/lib/cfndsl/cloudformation.rb +114 -0
- data/lib/cfndsl/conditions.rb +13 -1
- data/lib/cfndsl/creation_policy.rb +3 -1
- data/lib/cfndsl/deep_merge.rb +4 -0
- data/lib/cfndsl/external_parameters.rb +12 -13
- data/lib/cfndsl/globals.rb +51 -10
- data/lib/cfndsl/json_serialisable_object.rb +4 -2
- data/lib/cfndsl/jsonable.rb +51 -68
- data/lib/cfndsl/mappings.rb +3 -1
- data/lib/cfndsl/module.rb +18 -5
- data/lib/cfndsl/names.rb +2 -0
- data/lib/cfndsl/orchestration_template.rb +193 -73
- data/lib/cfndsl/outputs.rb +7 -1
- data/lib/cfndsl/parameters.rb +3 -1
- data/lib/cfndsl/plurals.rb +23 -10
- data/lib/cfndsl/properties.rb +3 -1
- data/lib/cfndsl/rake_task.rb +217 -15
- data/lib/cfndsl/ref_check.rb +21 -11
- data/lib/cfndsl/resources.rb +8 -19
- data/lib/cfndsl/rules.rb +46 -0
- data/lib/cfndsl/runner.rb +143 -0
- data/lib/cfndsl/specification.rb +82 -84
- data/lib/cfndsl/types.rb +212 -95
- data/lib/cfndsl/update_policy.rb +3 -1
- data/lib/cfndsl/version.rb +3 -1
- data/lib/deep_merge/core.rb +10 -6
- data/lib/deep_merge/deep_merge.rb +3 -1
- data/sample/autoscale.rb +1 -1
- data/sample/autoscale2.rb +4 -3
- data/sample/circular.rb +2 -0
- data/sample/codedeploy.rb +3 -1
- data/sample/config_service.rb +5 -3
- data/sample/ecs.rb +3 -1
- data/sample/export.rb +5 -3
- data/sample/iam_policies.rb +2 -0
- data/sample/import.rb +4 -2
- data/sample/lambda.rb +3 -1
- data/sample/s3.rb +2 -0
- data/sample/t1.rb +3 -1
- data/sample/vpc_example.rb +3 -1
- data/sample/vpc_with_vpn_example.rb +3 -1
- data/spec/aws/ec2_security_group_spec.rb +2 -0
- data/spec/aws/ecs_task_definition_spec.rb +2 -0
- data/spec/aws/iam_managed_policy_spec.rb +2 -0
- data/spec/aws/kms_alias_spec.rb +2 -0
- data/spec/aws/list_type_patches_spec.rb +35 -0
- data/spec/aws/logs_log_group_spec.rb +2 -0
- data/spec/aws/nested_arrays_spec.rb +194 -0
- data/spec/aws/rds_db_instance_spec.rb +2 -0
- data/spec/aws/serverless_spec.rb +2 -2
- data/spec/cfndsl_spec.rb +102 -63
- data/spec/cli_spec.rb +52 -49
- data/spec/cloud_formation_template_spec.rb +235 -0
- data/spec/condition_spec.rb +24 -0
- data/spec/deep_merge_spec.rb +2 -0
- data/spec/direct_ruby_spec.rb +19 -0
- data/spec/external_parameters_spec.rb +25 -20
- data/spec/fixtures/condition-assertion.json +1 -0
- data/spec/fixtures/params.json +1 -0
- data/spec/fixtures/params.yaml +2 -0
- data/spec/fixtures/params_struct1.yaml +4 -0
- data/spec/fixtures/params_struct2.yaml +4 -0
- data/spec/fixtures/rule-assertion.json +1 -0
- data/spec/fixtures/test.rb +12 -4
- data/spec/generate_spec.rb +4 -0
- data/spec/jsonable_spec.rb +2 -0
- data/spec/metadata_spec.rb +2 -0
- data/spec/names_spec.rb +2 -0
- data/spec/output_spec.rb +2 -0
- data/spec/plurals_spec.rb +2 -0
- data/spec/resource_name_spec.rb +21 -0
- data/spec/resources_spec.rb +2 -7
- data/spec/rule_spec.rb +17 -0
- data/spec/spec_helper.rb +4 -7
- data/spec/support/shared_examples/orchestration_template.rb +17 -2
- data/spec/transform_spec.rb +2 -0
- data/spec/types_definition_spec.rb +6 -7
- metadata +79 -25
- data/bin/cfndsl +0 -143
- data/lib/cfndsl/errors.rb +0 -29
- data/lib/cfndsl/os/heat_template.rb +0 -16
- data/lib/cfndsl/os/types.rb +0 -12
- data/lib/cfndsl/os/types.yaml +0 -2423
- data/lib/cfndsl/patches.rb +0 -98
- data/lib/cfnlego.rb +0 -42
- data/spec/fixtures/heattest.rb +0 -22
- data/spec/heat_template_spec.rb +0 -5
data/lib/cfndsl/patches.rb
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
module CfnDsl
|
2
|
-
# Module for handling inconsistencies in the published resource specification from AWS
|
3
|
-
module Patches
|
4
|
-
# Missing/malformed resources from the resource specification
|
5
|
-
# rubocop:disable Metrics/MethodLength
|
6
|
-
def self.resources
|
7
|
-
{
|
8
|
-
'AWS::Serverless::Function' => {
|
9
|
-
'Properties' => {
|
10
|
-
'Handler' => { 'PrimitiveType' => 'String' },
|
11
|
-
'Runtime' => { 'PrimitiveType' => 'String' },
|
12
|
-
'CodeUri' => { 'PrimitiveType' => 'String' },
|
13
|
-
'Description' => { 'PrimitiveType' => 'String' },
|
14
|
-
'MemorySize' => { 'PrimitiveType' => 'Integer' },
|
15
|
-
'Timeout' => { 'PrimitiveType' => 'Integer' },
|
16
|
-
'Environment' => { 'PrimitiveType' => 'Json' },
|
17
|
-
'Events' => { 'PrimitiveType' => 'Json' },
|
18
|
-
'Policies' => { 'Type' => 'List', 'ItemType' => 'Policy' }
|
19
|
-
}
|
20
|
-
},
|
21
|
-
'AWS::Serverless::Api' => {
|
22
|
-
'Properties' => {
|
23
|
-
'StageName' => { 'PrimitiveType' => 'String' },
|
24
|
-
'DefinitionUri' => { 'PrimitiveType' => 'String' },
|
25
|
-
'CacheClusterEnabled' => { 'PrimitiveType' => 'Boolean' },
|
26
|
-
'CacheClusterSize' => { 'PrimitiveType' => 'String' },
|
27
|
-
'Variables' => { 'PrimitiveType' => 'Json' }
|
28
|
-
}
|
29
|
-
},
|
30
|
-
'AWS::Serverless::SimpleTable' => {
|
31
|
-
'Properties' => {
|
32
|
-
'PrimaryKey' => { 'Type' => 'PrimaryKey' },
|
33
|
-
'ProvisionedThroughput' => { 'Type' => 'ProvisionedThroughput' }
|
34
|
-
}
|
35
|
-
},
|
36
|
-
'AWS::SSM::Parameter' => {
|
37
|
-
'Properties' => {
|
38
|
-
'Name' => { 'PrimitiveType' => 'String' },
|
39
|
-
'Description' => { 'PrimitiveType' => 'String' },
|
40
|
-
'Type' => { 'PrimitiveType' => 'String' },
|
41
|
-
'Value' => { 'PrimitiveType' => 'String' }
|
42
|
-
}
|
43
|
-
},
|
44
|
-
'AWS::EC2::VPNGatewayConnection' => {
|
45
|
-
'Properties' => {
|
46
|
-
'Type' => { 'PrimitiveType' => 'String' },
|
47
|
-
'Tags' => { 'Type' => 'List', 'ItemType' => 'Tag' }
|
48
|
-
}
|
49
|
-
},
|
50
|
-
'AWS::EC2::EIPAssociation' => {
|
51
|
-
'Properties' => {
|
52
|
-
'AllocationId' => { 'PrimitiveType' => 'String' },
|
53
|
-
'EIP' => { 'PrimitiveType' => 'String' },
|
54
|
-
'InstanceId' => { 'PrimitiveType' => 'String' },
|
55
|
-
'NetworkInterfaceId' => { 'PrimitiveType' => 'String' },
|
56
|
-
'PrivateIpAddress' => { 'PrimitiveType' => 'String' }
|
57
|
-
}
|
58
|
-
},
|
59
|
-
'AWS::Config::ConfigurationRecorder' => {
|
60
|
-
'Properties' => {
|
61
|
-
'Name' => { 'PrimitiveType' => 'String' },
|
62
|
-
'RecordingGroup' => { 'Type' => 'RecordingGroup' },
|
63
|
-
'RoleARN' => { 'PrimitiveType' => 'String' }
|
64
|
-
}
|
65
|
-
}
|
66
|
-
}
|
67
|
-
end
|
68
|
-
|
69
|
-
# Missing/malformed types from the resource specification
|
70
|
-
def self.types
|
71
|
-
{
|
72
|
-
'AWS::Serverless::SimpleTable.PrimaryKey' => {
|
73
|
-
'Properties' => {
|
74
|
-
'Name' => { 'PrimitiveType' => 'String' },
|
75
|
-
'Type' => { 'PrimitiveType' => 'String' }
|
76
|
-
}
|
77
|
-
},
|
78
|
-
'AWS::Serverless::SimpleTable.ProvisionedThroughput' => {
|
79
|
-
'Properties' => {
|
80
|
-
'ReadCapacityUnits' => { 'PrimitiveType' => 'Integer' },
|
81
|
-
'WriteCapacityUnits' => { 'PrimitiveType' => 'Integer' }
|
82
|
-
}
|
83
|
-
},
|
84
|
-
'AWS::Serverless::Function.Policy' => {
|
85
|
-
'Properties' => {
|
86
|
-
'PolicyDocument' => { 'PrimitiveType' => 'Json' },
|
87
|
-
'PolicyName' => { 'PrimitiveType' => 'String' }
|
88
|
-
}
|
89
|
-
},
|
90
|
-
'AWS::Cognito::IdentityPoolRoleAttachment.RulesConfigurationType' => {
|
91
|
-
'Properties' => {
|
92
|
-
'Rules' => { 'Type' => 'List', 'ItemType' => 'MappingRule' }
|
93
|
-
}
|
94
|
-
}
|
95
|
-
}
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
data/lib/cfnlego.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
require 'erb'
|
3
|
-
require 'cfnlego/cloudformation'
|
4
|
-
require 'cfnlego/resource'
|
5
|
-
require 'net/http'
|
6
|
-
require 'uri'
|
7
|
-
|
8
|
-
# Cfnlego
|
9
|
-
module Cfnlego
|
10
|
-
def self.Resources
|
11
|
-
content = fetch_resource_content
|
12
|
-
supported_resources = JSON.parse(content)
|
13
|
-
resources = []
|
14
|
-
supported_resources['ResourceTypes'].each do |resource, _value|
|
15
|
-
resources << resource
|
16
|
-
end
|
17
|
-
resources
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.fetch_resource_content
|
21
|
-
File.read(CfnDsl.specification_file)
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.run(options)
|
25
|
-
# Constructure Resources
|
26
|
-
resources = []
|
27
|
-
options[:resources].each do |r|
|
28
|
-
/(.*),(.*)/.match(r) do |m|
|
29
|
-
type = m[1]
|
30
|
-
name = m[2]
|
31
|
-
resources << Cfnlego::Resource.new(type, name)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
begin
|
36
|
-
return Cfnlego::CloudFormation.new(resources).render
|
37
|
-
rescue RuntimeError => e
|
38
|
-
$stderr.puts "Error: #{e.message}"
|
39
|
-
end
|
40
|
-
nil
|
41
|
-
end
|
42
|
-
end
|
data/spec/fixtures/heattest.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Heat do
|
2
|
-
Description 'Test'
|
3
|
-
|
4
|
-
Parameter('One') do
|
5
|
-
String
|
6
|
-
Default 'Test'
|
7
|
-
MaxLength 15
|
8
|
-
end
|
9
|
-
|
10
|
-
Parameter('Two') do
|
11
|
-
String
|
12
|
-
Default 'Test'
|
13
|
-
MaxLength 15
|
14
|
-
end
|
15
|
-
|
16
|
-
Output(:One, FnBase64(Ref('One')))
|
17
|
-
|
18
|
-
Server('MyInstance') do
|
19
|
-
flavor 'asdfa'
|
20
|
-
image 'asdad'
|
21
|
-
end
|
22
|
-
end
|