aws-insight 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +84 -0
  5. data/.travis.yml +19 -0
  6. data/CHANGELOG.md +336 -0
  7. data/CODE_OF_CONDUCT.md +13 -0
  8. data/CONTRIBUTING.md +62 -0
  9. data/Gemfile +19 -0
  10. data/Guardfile +12 -0
  11. data/LICENSE +22 -0
  12. data/README.md +393 -0
  13. data/Rakefile +6 -0
  14. data/bin/terraforming +5 -0
  15. data/contrib/zsh-completion/_terraforming +65 -0
  16. data/lib/terraforming.rb +54 -0
  17. data/lib/terraforming/cli.rb +340 -0
  18. data/lib/terraforming/resource/alb.rb +98 -0
  19. data/lib/terraforming/resource/auto_scaling_group.rb +90 -0
  20. data/lib/terraforming/resource/cloud_watch_alarm.rb +87 -0
  21. data/lib/terraforming/resource/config.rb +98 -0
  22. data/lib/terraforming/resource/db_parameter_group.rb +58 -0
  23. data/lib/terraforming/resource/db_security_group.rb +57 -0
  24. data/lib/terraforming/resource/db_subnet_group.rb +52 -0
  25. data/lib/terraforming/resource/ec2.rb +130 -0
  26. data/lib/terraforming/resource/efs_file_system.rb +60 -0
  27. data/lib/terraforming/resource/eip.rb +66 -0
  28. data/lib/terraforming/resource/elasti_cache_cluster.rb +80 -0
  29. data/lib/terraforming/resource/elasti_cache_subnet_group.rb +56 -0
  30. data/lib/terraforming/resource/elb.rb +203 -0
  31. data/lib/terraforming/resource/iam_group.rb +54 -0
  32. data/lib/terraforming/resource/iam_group_membership.rb +63 -0
  33. data/lib/terraforming/resource/iam_group_policy.rb +71 -0
  34. data/lib/terraforming/resource/iam_instance_profile.rb +54 -0
  35. data/lib/terraforming/resource/iam_policy.rb +63 -0
  36. data/lib/terraforming/resource/iam_policy_attachment.rb +86 -0
  37. data/lib/terraforming/resource/iam_role.rb +56 -0
  38. data/lib/terraforming/resource/iam_role_policy.rb +71 -0
  39. data/lib/terraforming/resource/iam_user.rb +55 -0
  40. data/lib/terraforming/resource/iam_user_policy.rb +71 -0
  41. data/lib/terraforming/resource/internet_gateway.rb +54 -0
  42. data/lib/terraforming/resource/kms_alias.rb +55 -0
  43. data/lib/terraforming/resource/kms_key.rb +84 -0
  44. data/lib/terraforming/resource/launch_configuration.rb +106 -0
  45. data/lib/terraforming/resource/nat_gateway.rb +57 -0
  46. data/lib/terraforming/resource/network_acl.rb +83 -0
  47. data/lib/terraforming/resource/network_interface.rb +68 -0
  48. data/lib/terraforming/resource/rds.rb +74 -0
  49. data/lib/terraforming/resource/redshift.rb +67 -0
  50. data/lib/terraforming/resource/route53_record.rb +106 -0
  51. data/lib/terraforming/resource/route53_zone.rb +89 -0
  52. data/lib/terraforming/resource/route_table.rb +122 -0
  53. data/lib/terraforming/resource/route_table_association.rb +59 -0
  54. data/lib/terraforming/resource/s3.rb +69 -0
  55. data/lib/terraforming/resource/security_group.rb +188 -0
  56. data/lib/terraforming/resource/sns_topic.rb +75 -0
  57. data/lib/terraforming/resource/sns_topic_subscription.rb +83 -0
  58. data/lib/terraforming/resource/sqs.rb +70 -0
  59. data/lib/terraforming/resource/subnet.rb +55 -0
  60. data/lib/terraforming/resource/vpc.rb +67 -0
  61. data/lib/terraforming/resource/vpn_gateway.rb +55 -0
  62. data/lib/terraforming/template/tf/alb.erb +28 -0
  63. data/lib/terraforming/template/tf/auto_scaling_group.erb +28 -0
  64. data/lib/terraforming/template/tf/cloud_watch_alarm.erb +33 -0
  65. data/lib/terraforming/template/tf/db_parameter_group.erb +17 -0
  66. data/lib/terraforming/template/tf/db_security_group.erb +26 -0
  67. data/lib/terraforming/template/tf/db_subnet_group.erb +8 -0
  68. data/lib/terraforming/template/tf/ec2.erb +56 -0
  69. data/lib/terraforming/template/tf/eip.erb +11 -0
  70. data/lib/terraforming/template/tf/elasti_cache_cluster.erb +22 -0
  71. data/lib/terraforming/template/tf/elasti_cache_subnet_group.erb +8 -0
  72. data/lib/terraforming/template/tf/elastic_filesystem.erb +18 -0
  73. data/lib/terraforming/template/tf/elb.erb +51 -0
  74. data/lib/terraforming/template/tf/iam_group.erb +7 -0
  75. data/lib/terraforming/template/tf/iam_group_membership.erb +8 -0
  76. data/lib/terraforming/template/tf/iam_group_policy.erb +10 -0
  77. data/lib/terraforming/template/tf/iam_instance_profile.erb +8 -0
  78. data/lib/terraforming/template/tf/iam_policy.erb +12 -0
  79. data/lib/terraforming/template/tf/iam_policy_attachment.erb +10 -0
  80. data/lib/terraforming/template/tf/iam_role.erb +10 -0
  81. data/lib/terraforming/template/tf/iam_role_policy.erb +10 -0
  82. data/lib/terraforming/template/tf/iam_user.erb +7 -0
  83. data/lib/terraforming/template/tf/iam_user_policy.erb +10 -0
  84. data/lib/terraforming/template/tf/internet_gateway.erb +14 -0
  85. data/lib/terraforming/template/tf/kms_alias.erb +7 -0
  86. data/lib/terraforming/template/tf/kms_key.erb +13 -0
  87. data/lib/terraforming/template/tf/launch_configuration.erb +68 -0
  88. data/lib/terraforming/template/tf/nat_gateway.erb +9 -0
  89. data/lib/terraforming/template/tf/network_acl.erb +43 -0
  90. data/lib/terraforming/template/tf/network_interface.erb +22 -0
  91. data/lib/terraforming/template/tf/rds.erb +25 -0
  92. data/lib/terraforming/template/tf/redshift.erb +23 -0
  93. data/lib/terraforming/template/tf/route53_record.erb +52 -0
  94. data/lib/terraforming/template/tf/route53_zone.erb +18 -0
  95. data/lib/terraforming/template/tf/route_table.erb +34 -0
  96. data/lib/terraforming/template/tf/route_table_association.erb +9 -0
  97. data/lib/terraforming/template/tf/s3.erb +12 -0
  98. data/lib/terraforming/template/tf/security_group.erb +56 -0
  99. data/lib/terraforming/template/tf/sns_topic.erb +17 -0
  100. data/lib/terraforming/template/tf/sns_topic_subscription.erb +23 -0
  101. data/lib/terraforming/template/tf/sqs.erb +21 -0
  102. data/lib/terraforming/template/tf/subnet.erb +15 -0
  103. data/lib/terraforming/template/tf/vpc.erb +15 -0
  104. data/lib/terraforming/template/tf/vpn_gateway.erb +14 -0
  105. data/lib/terraforming/util.rb +30 -0
  106. data/lib/terraforming/version.rb +3 -0
  107. data/script/console +14 -0
  108. data/script/generate +97 -0
  109. data/script/setup +7 -0
  110. data/templates/resource.erb.erb +3 -0
  111. data/templates/resource.rb.erb +31 -0
  112. data/templates/resource_spec.rb.erb +39 -0
  113. data/terraforming.gemspec +31 -0
  114. metadata +271 -0
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "terraforming"
4
+
5
+ Terraforming::CLI.start(ARGV)
@@ -0,0 +1,65 @@
1
+ #compdef terraforming
2
+
3
+ function _terraforming() {
4
+ local context curcontext=$curcontext state line
5
+ typeset -A opt_args
6
+ local ret=1
7
+
8
+ _arguments -C \
9
+ '1: :__terraforming_sub_commands' \
10
+ '*:: :->args' \
11
+ && ret=0
12
+
13
+ case $state in
14
+ (args)
15
+ case $words[1] in
16
+ (help)
17
+ _arguments -C \
18
+ '1: :__terraforming_sub_commands' \
19
+ '(-)*:: :->null_state' \
20
+ && ret=0
21
+ ;;
22
+ (*)
23
+ _arguments -C \
24
+ '--merge=[(TFSTATE) tfstate file to merge]:tfstate file to merge:_files' \
25
+ '--overwrite[Overwrite existing tfstate]' \
26
+ '--no-overwrite[Do not overwrite existing tfstate]' \
27
+ '--tfstate[Generate tfstate]' \
28
+ '--no-tfstate[Do not generate tfstate]' \
29
+ '--profile[(PROFILE) AWS credentials profile]:AWS credentials profile:__profiles' \
30
+ && ret=0
31
+ ;;
32
+ esac
33
+ ;;
34
+ esac
35
+
36
+ return ret
37
+ }
38
+
39
+ __terraforming_sub_commands() {
40
+ local -a _c
41
+
42
+ _c=(
43
+ "${(@f)$(terraforming --help \
44
+ | grep ' terraforming' \
45
+ | sed -E 's/^ terraforming //g' \
46
+ | sed -E 's/ *(\[COMMAND\])? *# /:/g')}"
47
+ )
48
+
49
+ _describe -t commands terraforming_sub_commands _c
50
+ }
51
+
52
+ __profiles() {
53
+ local _profile_path="${HOME}/.aws/credentials"
54
+ local -a _profiles
55
+
56
+ _profiles=(
57
+ ${(@f)"$(_call_program profiles \
58
+ "grep -E '^\[.*\]$' "$_profile_path" \
59
+ | sed -e 's/\[//' -e 's/\]//'")"}
60
+ )
61
+
62
+ _describe -t profiles Profiles _profiles
63
+ }
64
+
65
+ _terraforming "$@"
@@ -0,0 +1,54 @@
1
+ require "aws-sdk-core"
2
+ require "erb"
3
+ require "multi_json"
4
+ require "thor"
5
+ require "zlib"
6
+
7
+ require "terraforming/util"
8
+ require "terraforming/version"
9
+
10
+ require "terraforming/cli"
11
+ require "terraforming/resource/alb"
12
+ require "terraforming/resource/auto_scaling_group"
13
+ require "terraforming/resource/cloud_watch_alarm"
14
+ require "terraforming/resource/db_parameter_group"
15
+ require "terraforming/resource/db_security_group"
16
+ require "terraforming/resource/db_subnet_group"
17
+ require "terraforming/resource/ec2"
18
+ require "terraforming/resource/eip"
19
+ require "terraforming/resource/elasti_cache_cluster"
20
+ require "terraforming/resource/elasti_cache_subnet_group"
21
+ require "terraforming/resource/efs_file_system"
22
+ require "terraforming/resource/elb"
23
+ require "terraforming/resource/iam_group"
24
+ require "terraforming/resource/iam_group_membership"
25
+ require "terraforming/resource/iam_group_policy"
26
+ require "terraforming/resource/iam_instance_profile"
27
+ require "terraforming/resource/iam_policy"
28
+ require "terraforming/resource/iam_policy_attachment"
29
+ require "terraforming/resource/iam_role"
30
+ require "terraforming/resource/iam_role_policy"
31
+ require "terraforming/resource/iam_user"
32
+ require "terraforming/resource/iam_user_policy"
33
+ require "terraforming/resource/kms_alias"
34
+ require "terraforming/resource/kms_key"
35
+ require "terraforming/resource/launch_configuration"
36
+ require "terraforming/resource/internet_gateway"
37
+ require "terraforming/resource/nat_gateway"
38
+ require "terraforming/resource/network_acl"
39
+ require "terraforming/resource/network_interface"
40
+ require "terraforming/resource/rds"
41
+ require "terraforming/resource/redshift"
42
+ require "terraforming/resource/route_table"
43
+ require "terraforming/resource/route_table_association"
44
+ require "terraforming/resource/route53_record"
45
+ require "terraforming/resource/route53_zone"
46
+ require "terraforming/resource/s3"
47
+ require "terraforming/resource/security_group"
48
+ require "terraforming/resource/subnet"
49
+ require "terraforming/resource/sqs"
50
+ require "terraforming/resource/vpc"
51
+ require "terraforming/resource/vpn_gateway"
52
+ require "terraforming/resource/sns_topic"
53
+ require "terraforming/resource/sns_topic_subscription"
54
+ require "terraforming/resource/config"
@@ -0,0 +1,340 @@
1
+ module Terraforming
2
+ class CLI < Thor
3
+ class_option :merge, type: :string, desc: "tfstate file to merge"
4
+ class_option :overwrite, type: :boolean, desc: "Overwrite existing tfstate"
5
+ class_option :tfstate, type: :boolean, desc: "Generate tfstate"
6
+ class_option :profile, type: :string, desc: "AWS credentials profile"
7
+ class_option :region, type: :string, desc: "AWS region"
8
+ class_option :use_bundled_cert,
9
+ type: :boolean,
10
+ desc: "Use the bundled CA certificate from AWS SDK"
11
+
12
+ desc "all", "all"
13
+ def all
14
+ executeAll([
15
+ # Terraforming::Resource::ALB,
16
+ # Terraforming::Resource::AutoScalingGroup,
17
+ Terraforming::Resource::CloudWatchAlarm,
18
+ # Terraforming::Resource::DBParameterGroup,
19
+ # Terraforming::Resource::DBSecurityGroup,
20
+ # Terraforming::Resource::DBSubnetGroup,
21
+ Terraforming::Resource::EC2,
22
+ Terraforming::Resource::ElastiCacheCluster,
23
+ # Terraforming::Resource::ElastiCacheSubnetGroup,
24
+ Terraforming::Resource::EIP,
25
+ Terraforming::Resource::EFSFileSystem,
26
+ Terraforming::Resource::ELB,
27
+ # Terraforming::Resource::IAMGroup,
28
+ # Terraforming::Resource::IAMGroupMembership,
29
+ # Terraforming::Resource::IAMGroupPolicy,
30
+ # Terraforming::Resource::IAMInstanceProfile,
31
+ # Terraforming::Resource::IAMPolicy,
32
+ # Terraforming::Resource::IAMPolicyAttachment,
33
+ # Terraforming::Resource::IAMRole,
34
+ # Terraforming::Resource::IAMRolePolicy,
35
+ # Terraforming::Resource::IAMUser,
36
+ # Terraforming::Resource::IAMUserPolicy,
37
+ # Terraforming::Resource::KMSAlias,
38
+ Terraforming::Resource::KMSKey,
39
+ # Terraforming::Resource::LaunchConfiguration,
40
+ Terraforming::Resource::InternetGateway,
41
+ # Terraforming::Resource::NetworkACL,
42
+ Terraforming::Resource::NATGateway,
43
+ # Terraforming::Resource::NetworkInterface,
44
+ Terraforming::Resource::Route53Record,
45
+ Terraforming::Resource::Route53Zone,
46
+ Terraforming::Resource::RDS,
47
+ Terraforming::Resource::Redshift,
48
+ # Terraforming::Resource::RouteTable,
49
+ # Terraforming::Resource::RouteTableAssociation,
50
+ Terraforming::Resource::S3,
51
+ # Terraforming::Resource::SecurityGroup,
52
+ # Terraforming::Resource::Subnet,
53
+ Terraforming::Resource::SQS,
54
+ # Terraforming::Resource::VPC,
55
+ Terraforming::Resource::VPNGateway,
56
+ Terraforming::Resource::SNSTopic,
57
+ Terraforming::Resource::SNSTopicSubscription,
58
+ Terraforming::Resource::Config,
59
+ ], options)
60
+ end
61
+
62
+ desc "alb", "ALB"
63
+ def alb
64
+ execute(Terraforming::Resource::ALB, options)
65
+ end
66
+
67
+ desc "asg", "AutoScaling Group"
68
+ def asg
69
+ execute(Terraforming::Resource::AutoScalingGroup, options)
70
+ end
71
+
72
+ desc "cwa", "CloudWatch Alarm"
73
+ def cwa
74
+ execute(Terraforming::Resource::CloudWatchAlarm, options)
75
+ end
76
+
77
+ desc "dbpg", "Database Parameter Group"
78
+ def dbpg
79
+ execute(Terraforming::Resource::DBParameterGroup, options)
80
+ end
81
+
82
+ desc "dbsg", "Database Security Group"
83
+ def dbsg
84
+ execute(Terraforming::Resource::DBSecurityGroup, options)
85
+ end
86
+
87
+ desc "dbsn", "Database Subnet Group"
88
+ def dbsn
89
+ execute(Terraforming::Resource::DBSubnetGroup, options)
90
+ end
91
+
92
+ desc "ec2", "EC2"
93
+ def ec2
94
+ execute(Terraforming::Resource::EC2, options)
95
+ end
96
+
97
+ desc "ecc", "ElastiCache Cluster"
98
+ def ecc
99
+ execute(Terraforming::Resource::ElastiCacheCluster, options)
100
+ end
101
+
102
+ desc "ecsn", "ElastiCache Subnet Group"
103
+ def ecsn
104
+ execute(Terraforming::Resource::ElastiCacheSubnetGroup, options)
105
+ end
106
+
107
+ desc "eip", "EIP"
108
+ def eip
109
+ execute(Terraforming::Resource::EIP, options)
110
+ end
111
+
112
+ desc "efs", "EFS File System"
113
+ def efs
114
+ execute(Terraforming::Resource::EFSFileSystem, options)
115
+ end
116
+
117
+ desc "elb", "ELB"
118
+ def elb
119
+ execute(Terraforming::Resource::ELB, options)
120
+ end
121
+
122
+ desc "iamg", "IAM Group"
123
+ def iamg
124
+ execute(Terraforming::Resource::IAMGroup, options)
125
+ end
126
+
127
+ desc "iamgm", "IAM Group Membership"
128
+ def iamgm
129
+ execute(Terraforming::Resource::IAMGroupMembership, options)
130
+ end
131
+
132
+ desc "iamgp", "IAM Group Policy"
133
+ def iamgp
134
+ execute(Terraforming::Resource::IAMGroupPolicy, options)
135
+ end
136
+
137
+ desc "iamip", "IAM Instance Profile"
138
+ def iamip
139
+ execute(Terraforming::Resource::IAMInstanceProfile, options)
140
+ end
141
+
142
+ desc "iamp", "IAM Policy"
143
+ def iamp
144
+ execute(Terraforming::Resource::IAMPolicy, options)
145
+ end
146
+
147
+ desc "iampa", "IAM Policy Attachment"
148
+ def iampa
149
+ execute(Terraforming::Resource::IAMPolicyAttachment, options)
150
+ end
151
+
152
+ desc "iamr", "IAM Role"
153
+ def iamr
154
+ execute(Terraforming::Resource::IAMRole, options)
155
+ end
156
+
157
+ desc "iamrp", "IAM Role Policy"
158
+ def iamrp
159
+ execute(Terraforming::Resource::IAMRolePolicy, options)
160
+ end
161
+
162
+ desc "iamu", "IAM User"
163
+ def iamu
164
+ execute(Terraforming::Resource::IAMUser, options)
165
+ end
166
+
167
+ desc "iamup", "IAM User Policy"
168
+ def iamup
169
+ execute(Terraforming::Resource::IAMUserPolicy, options)
170
+ end
171
+
172
+ desc "kmsa", "KMS Key Alias"
173
+ def kmsa
174
+ execute(Terraforming::Resource::KMSAlias, options)
175
+ end
176
+
177
+ desc "kmsk", "KMS Key"
178
+ def kmsk
179
+ execute(Terraforming::Resource::KMSKey, options)
180
+ end
181
+
182
+ desc "lc", "Launch Configuration"
183
+ def lc
184
+ execute(Terraforming::Resource::LaunchConfiguration, options)
185
+ end
186
+
187
+ desc "igw", "Internet Gateway"
188
+ def igw
189
+ execute(Terraforming::Resource::InternetGateway, options)
190
+ end
191
+
192
+ desc "nacl", "Network ACL"
193
+ def nacl
194
+ execute(Terraforming::Resource::NetworkACL, options)
195
+ end
196
+
197
+ desc "nat", "NAT Gateway"
198
+ def nat
199
+ execute(Terraforming::Resource::NATGateway, options)
200
+ end
201
+
202
+ desc "nif", "Network Interface"
203
+ def nif
204
+ execute(Terraforming::Resource::NetworkInterface, options)
205
+ end
206
+
207
+ desc "r53r", "Route53 Record"
208
+ def r53r
209
+ execute(Terraforming::Resource::Route53Record, options)
210
+ end
211
+
212
+ desc "r53z", "Route53 Hosted Zone"
213
+ def r53z
214
+ execute(Terraforming::Resource::Route53Zone, options)
215
+ end
216
+
217
+ desc "rds", "RDS"
218
+ def rds
219
+ execute(Terraforming::Resource::RDS, options)
220
+ end
221
+
222
+ desc "rs", "Redshift"
223
+ def rs
224
+ execute(Terraforming::Resource::Redshift, options)
225
+ end
226
+
227
+ desc "rt", "Route Table"
228
+ def rt
229
+ execute(Terraforming::Resource::RouteTable, options)
230
+ end
231
+
232
+ desc "rta", "Route Table Association"
233
+ def rta
234
+ execute(Terraforming::Resource::RouteTableAssociation, options)
235
+ end
236
+
237
+ desc "s3", "S3"
238
+ def s3
239
+ execute(Terraforming::Resource::S3, options)
240
+ end
241
+
242
+ desc "sg", "Security Group"
243
+ def sg
244
+ execute(Terraforming::Resource::SecurityGroup, options)
245
+ end
246
+
247
+ desc "sn", "Subnet"
248
+ def sn
249
+ execute(Terraforming::Resource::Subnet, options)
250
+ end
251
+
252
+ desc "sqs", "SQS"
253
+ def sqs
254
+ execute(Terraforming::Resource::SQS, options)
255
+ end
256
+
257
+ desc "vpc", "VPC"
258
+ def vpc
259
+ execute(Terraforming::Resource::VPC, options)
260
+ end
261
+
262
+ desc "vgw", "VPN Gateway"
263
+ def vgw
264
+ execute(Terraforming::Resource::VPNGateway, options)
265
+ end
266
+
267
+ desc "snst", "SNS Topic"
268
+ def snst
269
+ execute(Terraforming::Resource::SNSTopic, options)
270
+ end
271
+
272
+ desc "snss", "SNS Subscription"
273
+ def snss
274
+ execute(Terraforming::Resource::SNSTopicSubscription, options)
275
+ end
276
+
277
+ private
278
+
279
+ def executeAll(klasses, options)
280
+ configure_aws(options)
281
+ results = Hash.new
282
+ klasses.each { |klass|
283
+ begin
284
+ results[klass.name.split('::')[-1]] = klass.tfstate
285
+ rescue Exception => e
286
+ puts e
287
+ end
288
+ }
289
+ puts MultiJson.encode(results, pretty: true)
290
+ end
291
+
292
+ def configure_aws(options)
293
+ Aws.config[:credentials] = Aws::SharedCredentials.new(profile_name: options[:profile]) if options[:profile]
294
+ Aws.config[:region] = options[:region] if options[:region]
295
+ Aws.use_bundled_cert! if options[:use_bundled_cert]
296
+ end
297
+
298
+ def execute(klass, options)
299
+ configure_aws(options)
300
+ result = options[:tfstate] ? tfstate(klass, options[:merge]) : tf(klass)
301
+
302
+ if options[:tfstate] && options[:merge] && options[:overwrite]
303
+ open(options[:merge], "w+") do |f|
304
+ f.write(result)
305
+ f.flush
306
+ end
307
+ else
308
+ puts result
309
+ end
310
+ end
311
+
312
+ def tf(klass)
313
+ klass.tf
314
+ end
315
+
316
+ def tfstate(klass, tfstate_path)
317
+ tfstate = tfstate_path ? MultiJson.load(open(tfstate_path).read) : tfstate_skeleton
318
+ tfstate["serial"] = tfstate["serial"] + 1
319
+ tfstate["modules"][0]["resources"] = tfstate["modules"][0]["resources"].merge(klass.tfstate)
320
+
321
+ MultiJson.encode(tfstate, pretty: true)
322
+ end
323
+
324
+ def tfstate_skeleton
325
+ {
326
+ "version" => 1,
327
+ "serial" => 0,
328
+ "modules" => [
329
+ {
330
+ "path" => [
331
+ "root"
332
+ ],
333
+ "outputs" => {},
334
+ "resources" => {},
335
+ }
336
+ ]
337
+ }
338
+ end
339
+ end
340
+ end