ruby-terraform 1.6.0.pre.2 → 1.6.0.pre.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +4 -2
  3. data/README.md +36 -11
  4. data/Rakefile +1 -1
  5. data/lib/ruby_terraform/commands/apply.rb +5 -0
  6. data/lib/ruby_terraform/commands/base.rb +4 -0
  7. data/lib/ruby_terraform/commands/destroy.rb +5 -0
  8. data/lib/ruby_terraform/commands/force_unlock.rb +5 -0
  9. data/lib/ruby_terraform/commands/format.rb +5 -0
  10. data/lib/ruby_terraform/commands/get.rb +5 -0
  11. data/lib/ruby_terraform/commands/graph.rb +5 -0
  12. data/lib/ruby_terraform/commands/import.rb +5 -0
  13. data/lib/ruby_terraform/commands/init.rb +5 -0
  14. data/lib/ruby_terraform/commands/login.rb +5 -0
  15. data/lib/ruby_terraform/commands/logout.rb +5 -0
  16. data/lib/ruby_terraform/commands/output.rb +5 -0
  17. data/lib/ruby_terraform/commands/plan.rb +5 -0
  18. data/lib/ruby_terraform/commands/providers.rb +5 -0
  19. data/lib/ruby_terraform/commands/providers_lock.rb +5 -0
  20. data/lib/ruby_terraform/commands/providers_mirror.rb +5 -0
  21. data/lib/ruby_terraform/commands/providers_schema.rb +5 -0
  22. data/lib/ruby_terraform/commands/refresh.rb +5 -0
  23. data/lib/ruby_terraform/commands/show.rb +5 -0
  24. data/lib/ruby_terraform/commands/state_list.rb +5 -0
  25. data/lib/ruby_terraform/commands/state_move.rb +5 -0
  26. data/lib/ruby_terraform/commands/state_pull.rb +5 -0
  27. data/lib/ruby_terraform/commands/state_push.rb +5 -0
  28. data/lib/ruby_terraform/commands/state_remove.rb +5 -0
  29. data/lib/ruby_terraform/commands/state_replace_provider.rb +5 -0
  30. data/lib/ruby_terraform/commands/state_show.rb +5 -0
  31. data/lib/ruby_terraform/commands/taint.rb +5 -0
  32. data/lib/ruby_terraform/commands/untaint.rb +5 -0
  33. data/lib/ruby_terraform/commands/validate.rb +5 -0
  34. data/lib/ruby_terraform/commands/workspace_delete.rb +5 -0
  35. data/lib/ruby_terraform/commands/workspace_list.rb +5 -0
  36. data/lib/ruby_terraform/commands/workspace_new.rb +5 -0
  37. data/lib/ruby_terraform/commands/workspace_select.rb +5 -0
  38. data/lib/ruby_terraform/commands/workspace_show.rb +5 -0
  39. data/lib/ruby_terraform/version.rb +1 -1
  40. data/lib/ruby_terraform.rb +237 -74
  41. metadata +2 -2
@@ -95,6 +95,10 @@ module RubyTerraform
95
95
  # @option parameters [Array<String>] :var_files An array of paths to
96
96
  # terraform var files; if both +:var_file+ and +:var_files+ are provided,
97
97
  # all var files will be passed to terraform.
98
+ # @param [Hash<String, Object>] invocation_options Additional options
99
+ # controlling the invocation of the command.
100
+ # @option invocation_options [Hash<String, String>] :environment A map
101
+ # of environment variables to expose at command invocation time.
98
102
  #
99
103
  # @example Basic Invocation
100
104
  # RubyTerraform.apply(
@@ -103,8 +107,8 @@ module RubyTerraform
103
107
  # region: 'eu-central'
104
108
  # })
105
109
  #
106
- def apply(parameters = {})
107
- exec(RubyTerraform::Commands::Apply, parameters)
110
+ def apply(parameters = {}, invocation_options = {})
111
+ exec(RubyTerraform::Commands::Apply, parameters, invocation_options)
108
112
  end
109
113
 
110
114
  # Invokes the +terraform destroy+ command which destroys terraform managed
@@ -170,8 +174,9 @@ module RubyTerraform
170
174
  # region: 'eu-central'
171
175
  # })
172
176
  #
173
- def destroy(parameters = {})
174
- exec(RubyTerraform::Commands::Destroy, parameters)
177
+ def destroy(parameters = {}, invocation_options = {})
178
+ exec(RubyTerraform::Commands::Destroy,
179
+ parameters, invocation_options)
175
180
  end
176
181
 
177
182
  # Invokes the +terraform force-unlock+ command which manually unlocks the
@@ -192,13 +197,18 @@ module RubyTerraform
192
197
  # switch to before executing the given subcommand.
193
198
  # @option parameters [Boolean] :force (false) If +true+, does not ask for
194
199
  # input for unlock confirmation.
200
+ # @param [Hash<String, Object>] invocation_options Additional options
201
+ # controlling the invocation of the command.
202
+ # @option invocation_options [Hash<String, String>] :environment A map
203
+ # of environment variables to expose at command invocation time.
195
204
  #
196
205
  # @example Basic Invocation
197
206
  # RubyTerraform.force_unlock(
198
207
  # lock_id: '50e844a7-ebb0-fcfd-da85-5cce5bd1ec90')
199
208
  #
200
- def force_unlock(parameters = {})
201
- exec(RubyTerraform::Commands::ForceUnlock, parameters)
209
+ def force_unlock(parameters = {}, invocation_options = {})
210
+ exec(RubyTerraform::Commands::ForceUnlock,
211
+ parameters, invocation_options)
202
212
  end
203
213
 
204
214
  # Invokes the +terraform fmt+ command which rewrites all terraform
@@ -232,13 +242,18 @@ module RubyTerraform
232
242
  # @option parameters [Boolean] :recursive (false) If +true+, also processes
233
243
  # files in subdirectories; by default, only the provided +:directory+ is
234
244
  # processed.
245
+ # @param [Hash<String, Object>] invocation_options Additional options
246
+ # controlling the invocation of the command.
247
+ # @option invocation_options [Hash<String, String>] :environment A map
248
+ # of environment variables to expose at command invocation time.
235
249
  #
236
250
  # @example Basic Invocation
237
251
  # RubyTerraform.format(
238
252
  # directory: 'infra/networking')
239
253
  #
240
- def format(parameters = {})
241
- exec(RubyTerraform::Commands::Format, parameters)
254
+ def format(parameters = {}, invocation_options = {})
255
+ exec(RubyTerraform::Commands::Format,
256
+ parameters, invocation_options)
242
257
  end
243
258
  alias fmt format
244
259
 
@@ -264,13 +279,18 @@ module RubyTerraform
264
279
  # newest versions available.
265
280
  # @option parameters [Boolean] :no_color (false) Whether or not the output
266
281
  # from the command should be in color.
282
+ # @param [Hash<String, Object>] invocation_options Additional options
283
+ # controlling the invocation of the command.
284
+ # @option invocation_options [Hash<String, String>] :environment A map
285
+ # of environment variables to expose at command invocation time.
267
286
  #
268
287
  # @example Basic Invocation
269
288
  # RubyTerraform.get(
270
289
  # directory: 'infra/networking')
271
290
  #
272
- def get(parameters = {})
273
- exec(RubyTerraform::Commands::Get, parameters)
291
+ def get(parameters = {}, invocation_options = {})
292
+ exec(RubyTerraform::Commands::Get,
293
+ parameters, invocation_options)
274
294
  end
275
295
 
276
296
  # Invokes the +terraform graph+ command which outputs the visual execution
@@ -304,12 +324,17 @@ module RubyTerraform
304
324
  # otherwise.
305
325
  # @option parameters [Integer] :module_depth In prior versions of terraform,
306
326
  # specified the depth of modules to show in the output (deprecated).
327
+ # @param [Hash<String, Object>] invocation_options Additional options
328
+ # controlling the invocation of the command.
329
+ # @option invocation_options [Hash<String, String>] :environment A map
330
+ # of environment variables to expose at command invocation time.
307
331
  #
308
332
  # @example Basic Invocation
309
333
  # RubyTerraform.graph
310
334
  #
311
- def graph(parameters = {})
312
- exec(RubyTerraform::Commands::Graph, parameters)
335
+ def graph(parameters = {}, invocation_options = {})
336
+ exec(RubyTerraform::Commands::Graph,
337
+ parameters, invocation_options)
313
338
  end
314
339
 
315
340
  # Invokes the +terraform import+ command which imports existing
@@ -390,6 +415,10 @@ module RubyTerraform
390
415
  # even if remote and local Terraform versions differ; this may result in
391
416
  # an unusable Terraform Cloud workspace, and should be used with extreme
392
417
  # caution.
418
+ # @param [Hash<String, Object>] invocation_options Additional options
419
+ # controlling the invocation of the command.
420
+ # @option invocation_options [Hash<String, String>] :environment A map
421
+ # of environment variables to expose at command invocation time.
393
422
  #
394
423
  # @example Basic Invocation
395
424
  # RubyTerraform.import(
@@ -400,8 +429,9 @@ module RubyTerraform
400
429
  # region: 'eu-central'
401
430
  # })
402
431
  #
403
- def import(parameters = {})
404
- exec(RubyTerraform::Commands::Import, parameters)
432
+ def import(parameters = {}, invocation_options = {})
433
+ exec(RubyTerraform::Commands::Import,
434
+ parameters, invocation_options)
405
435
  end
406
436
 
407
437
  # Invokes the +terraform init+ command which initializes a new or existing
@@ -466,14 +496,19 @@ module RubyTerraform
466
496
  # 0.15).
467
497
  # @option parameters [String] :lockfile Sets a dependency lockfile mode;
468
498
  # currently only "readonly" is valid.
499
+ # @param [Hash<String, Object>] invocation_options Additional options
500
+ # controlling the invocation of the command.
501
+ # @option invocation_options [Hash<String, String>] :environment A map
502
+ # of environment variables to expose at command invocation time.
469
503
  #
470
504
  # @example Basic Invocation
471
505
  # RubyTerraform.init(
472
506
  # from_module: 'some/module/path',
473
507
  # path: 'infra/module')
474
508
  #
475
- def init(parameters = {})
476
- exec(RubyTerraform::Commands::Init, parameters)
509
+ def init(parameters = {}, invocation_options = {})
510
+ exec(RubyTerraform::Commands::Init,
511
+ parameters, invocation_options)
477
512
  end
478
513
 
479
514
  # Invokes the +terraform login+ command which retrieves an authentication
@@ -490,12 +525,17 @@ module RubyTerraform
490
525
  # @param parameters The parameters used to invoke the command
491
526
  # @option parameters [String] :chdir The path of a working directory to
492
527
  # switch to before executing the given subcommand.
528
+ # @param [Hash<String, Object>] invocation_options Additional options
529
+ # controlling the invocation of the command.
530
+ # @option invocation_options [Hash<String, String>] :environment A map
531
+ # of environment variables to expose at command invocation time.
493
532
  #
494
533
  # @example Basic Invocation
495
534
  # RubyTerraform.login
496
535
  #
497
- def login(parameters = {})
498
- exec(RubyTerraform::Commands::Login, parameters)
536
+ def login(parameters = {}, invocation_options = {})
537
+ exec(RubyTerraform::Commands::Login,
538
+ parameters, invocation_options)
499
539
  end
500
540
 
501
541
  # Invokes the +terraform logout+ command which removes locally-stored
@@ -509,12 +549,17 @@ module RubyTerraform
509
549
  # @param parameters The parameters used to invoke the command
510
550
  # @option parameters [String] :chdir The path of a working directory to
511
551
  # switch to before executing the given subcommand.
552
+ # @param [Hash<String, Object>] invocation_options Additional options
553
+ # controlling the invocation of the command.
554
+ # @option invocation_options [Hash<String, String>] :environment A map
555
+ # of environment variables to expose at command invocation time.
512
556
  #
513
557
  # @example Basic Invocation
514
558
  # RubyTerraform.logout
515
559
  #
516
- def logout(parameters = {})
517
- exec(RubyTerraform::Commands::Logout, parameters)
560
+ def logout(parameters = {}, invocation_options = {})
561
+ exec(RubyTerraform::Commands::Logout,
562
+ parameters, invocation_options)
518
563
  end
519
564
 
520
565
  # Invokes the +terraform output+ command which reads an output variable from
@@ -535,13 +580,18 @@ module RubyTerraform
535
580
  # @option parameters [Boolean] :raw (false) If +true+, for value types that
536
581
  # can be automatically converted to a string, will print the raw string
537
582
  # directly, rather than a human-oriented representation of the value.
583
+ # @param [Hash<String, Object>] invocation_options Additional options
584
+ # controlling the invocation of the command.
585
+ # @option invocation_options [Hash<String, String>] :environment A map
586
+ # of environment variables to expose at command invocation time.
538
587
  #
539
588
  # @example Basic Invocation
540
589
  # RubyTerraform.output(
541
590
  # name: 'vpc_id')
542
591
  #
543
- def output(parameters = {})
544
- exec(RubyTerraform::Commands::Output, parameters)
592
+ def output(parameters = {}, invocation_options = {})
593
+ exec(RubyTerraform::Commands::Output,
594
+ parameters, invocation_options)
545
595
  end
546
596
 
547
597
  # Invokes the +terraform plan+ command which generates a speculative
@@ -607,6 +657,10 @@ module RubyTerraform
607
657
  # @option parameters [Array<String>] :var_files An array of paths to
608
658
  # terraform var files; if both +:var_file+ and +:var_files+ are provided,
609
659
  # all var files will be passed to terraform.
660
+ # @param [Hash<String, Object>] invocation_options Additional options
661
+ # controlling the invocation of the command.
662
+ # @option invocation_options [Hash<String, String>] :environment A map
663
+ # of environment variables to expose at command invocation time.
610
664
  #
611
665
  # @example Basic Invocation
612
666
  # RubyTerraform.plan(
@@ -615,8 +669,8 @@ module RubyTerraform
615
669
  # region: 'eu-central'
616
670
  # })
617
671
  #
618
- def plan(parameters = {})
619
- exec(RubyTerraform::Commands::Plan, parameters)
672
+ def plan(parameters = {}, invocation_options = {})
673
+ exec(RubyTerraform::Commands::Plan, parameters, invocation_options)
620
674
  end
621
675
 
622
676
  # Invokes the +terraform providers+ command which prints out a tree of
@@ -633,12 +687,17 @@ module RubyTerraform
633
687
  # terraform 0.15, use +:chdir+ instead).
634
688
  # @option parameters [String] :chdir The path of a working directory to
635
689
  # switch to before executing the given subcommand.
690
+ # @param [Hash<String, Object>] invocation_options Additional options
691
+ # controlling the invocation of the command.
692
+ # @option invocation_options [Hash<String, String>] :environment A map
693
+ # of environment variables to expose at command invocation time.
636
694
  #
637
695
  # @example Basic Invocation
638
696
  # RubyTerraform.providers
639
697
  #
640
- def providers(parameters = {})
641
- exec(RubyTerraform::Commands::Providers, parameters)
698
+ def providers(parameters = {}, invocation_options = {})
699
+ exec(RubyTerraform::Commands::Providers,
700
+ parameters, invocation_options)
642
701
  end
643
702
 
644
703
  # Invokes the +terraform providers lock+ command which writes out dependency
@@ -700,6 +759,10 @@ module RubyTerraform
700
759
  # to request package checksums for; see +:platform+ for more details; if
701
760
  # both +:platform+ and +:platforms+ are provided, all platforms will be
702
761
  # passed to Terraform.
762
+ # @param [Hash<String, Object>] invocation_options Additional options
763
+ # controlling the invocation of the command.
764
+ # @option invocation_options [Hash<String, String>] :environment A map
765
+ # of environment variables to expose at command invocation time.
703
766
  #
704
767
  # @example Basic Invocation
705
768
  # RubyTerraform.providers_lock(
@@ -707,8 +770,9 @@ module RubyTerraform
707
770
  # platforms: ["windows_amd64", "darwin_amd64", "linux_amd64"],
708
771
  # provider: "tf.example.com/ourcompany/ourplatform")
709
772
  #
710
- def providers_lock(parameters = {})
711
- exec(RubyTerraform::Commands::ProvidersLock, parameters)
773
+ def providers_lock(parameters = {}, invocation_options = {})
774
+ exec(RubyTerraform::Commands::ProvidersLock,
775
+ parameters, invocation_options)
712
776
  end
713
777
 
714
778
  # Invokes the +terraform providers mirror+ command which saves local copies
@@ -742,14 +806,19 @@ module RubyTerraform
742
806
  # to build a mirror for for; see +:platform+ for more details; if both
743
807
  # +:platform+ and +:platforms+ are provided, all platforms will be passed
744
808
  # to Terraform.
809
+ # @param [Hash<String, Object>] invocation_options Additional options
810
+ # controlling the invocation of the command.
811
+ # @option invocation_options [Hash<String, String>] :environment A map
812
+ # of environment variables to expose at command invocation time.
745
813
  #
746
814
  # @example Basic Invocation
747
815
  # RubyTerraform.providers_mirror(
748
816
  # directory: './plugins',
749
817
  # platforms: ["windows_amd64", "darwin_amd64", "linux_amd64"])
750
818
  #
751
- def providers_mirror(parameters = {})
752
- exec(RubyTerraform::Commands::ProvidersMirror, parameters)
819
+ def providers_mirror(parameters = {}, invocation_options = {})
820
+ exec(RubyTerraform::Commands::ProvidersMirror,
821
+ parameters, invocation_options)
753
822
  end
754
823
 
755
824
  # Invokes the +terraform providers schema+ command which prints out a json
@@ -759,13 +828,18 @@ module RubyTerraform
759
828
  # @param parameters The parameters used to invoke the command
760
829
  # @option parameters [String] :chdir The path of a working directory to
761
830
  # switch to before executing the given subcommand.
831
+ # @param [Hash<String, Object>] invocation_options Additional options
832
+ # controlling the invocation of the command.
833
+ # @option invocation_options [Hash<String, String>] :environment A map
834
+ # of environment variables to expose at command invocation time.
762
835
  #
763
836
  # @example Basic Invocation
764
837
  # RubyTerraform.providers_schema(
765
838
  # directory: 'infra/networking')
766
839
  #
767
- def providers_schema(parameters = {})
768
- exec(RubyTerraform::Commands::ProvidersSchema, parameters)
840
+ def providers_schema(parameters = {}, invocation_options = {})
841
+ exec(RubyTerraform::Commands::ProvidersSchema,
842
+ parameters, invocation_options)
769
843
  end
770
844
 
771
845
  # Invokes the +terraform refresh+ command which updates the state file of
@@ -826,6 +900,10 @@ module RubyTerraform
826
900
  # @option parameters [Array<String>] :var_files An array of paths to
827
901
  # terraform var files; if both +:var_file+ and +:var_files+ are provided,
828
902
  # all var files will be passed to terraform.
903
+ # @param [Hash<String, Object>] invocation_options Additional options
904
+ # controlling the invocation of the command.
905
+ # @option invocation_options [Hash<String, String>] :environment A map
906
+ # of environment variables to expose at command invocation time.
829
907
  #
830
908
  # @example Basic Invocation
831
909
  # RubyTerraform.refresh(
@@ -834,8 +912,8 @@ module RubyTerraform
834
912
  # region: 'eu-central'
835
913
  # })
836
914
  #
837
- def refresh(parameters = {})
838
- exec(RubyTerraform::Commands::Refresh, parameters)
915
+ def refresh(parameters = {}, invocation_options = {})
916
+ exec(RubyTerraform::Commands::Refresh, parameters, invocation_options)
839
917
  end
840
918
 
841
919
  # Invokes the +terraform show+ command which reads and outputs a Terraform
@@ -851,12 +929,17 @@ module RubyTerraform
851
929
  # from the command should be in color.
852
930
  # @option parameters [Boolean] :json (false) If +true+, outputs the
853
931
  # Terraform plan or state in a machine-readable form.
932
+ # @param [Hash<String, Object>] invocation_options Additional options
933
+ # controlling the invocation of the command.
934
+ # @option invocation_options [Hash<String, String>] :environment A map
935
+ # of environment variables to expose at command invocation time.
854
936
  #
855
937
  # @example Basic Invocation
856
938
  # RubyTerraform.show
857
939
  #
858
- def show(parameters = {})
859
- exec(RubyTerraform::Commands::Show, parameters)
940
+ def show(parameters = {}, invocation_options = {})
941
+ exec(RubyTerraform::Commands::Show,
942
+ parameters, invocation_options)
860
943
  end
861
944
 
862
945
  # Invokes the +terraform state list+ command which lists resources in the
@@ -892,12 +975,17 @@ module RubyTerraform
892
975
  # @option parameters [String] :id When provided, filters the results to
893
976
  # include only instances whose resource types have an attribute named "id"
894
977
  # whose value equals the given id string.
978
+ # @param [Hash<String, Object>] invocation_options Additional options
979
+ # controlling the invocation of the command.
980
+ # @option invocation_options [Hash<String, String>] :environment A map
981
+ # of environment variables to expose at command invocation time.
895
982
  #
896
983
  # @example Basic Invocation
897
984
  # RubyTerraform.state_list
898
985
  #
899
- def state_list(parameters = {})
900
- exec(RubyTerraform::Commands::StateList, parameters)
986
+ def state_list(parameters = {}, invocation_options = {})
987
+ exec(RubyTerraform::Commands::StateList,
988
+ parameters, invocation_options)
901
989
  end
902
990
 
903
991
  # Invokes the +terraform state mv+ command which moves an item in the state.
@@ -951,14 +1039,19 @@ module RubyTerraform
951
1039
  # to continue even if remote and local Terraform versions are
952
1040
  # incompatible; this may result in an unusable workspace, and should be
953
1041
  # used with extreme caution.
1042
+ # @param [Hash<String, Object>] invocation_options Additional options
1043
+ # controlling the invocation of the command.
1044
+ # @option invocation_options [Hash<String, String>] :environment A map
1045
+ # of environment variables to expose at command invocation time.
954
1046
  #
955
1047
  # @example Basic Invocation
956
1048
  # RubyTerraform.state_move(
957
1049
  # source: 'packet_device.worker',
958
1050
  # destination: 'packet_device.helper')
959
1051
  #
960
- def state_move(parameters = {})
961
- exec(RubyTerraform::Commands::StateMove, parameters)
1052
+ def state_move(parameters = {}, invocation_options = {})
1053
+ exec(RubyTerraform::Commands::StateMove,
1054
+ parameters, invocation_options)
962
1055
  end
963
1056
  alias state_mv state_move
964
1057
 
@@ -975,12 +1068,17 @@ module RubyTerraform
975
1068
  # @param parameters The parameters used to invoke the command
976
1069
  # @option parameters [String] :chdir The path of a working directory to
977
1070
  # switch to before executing the given subcommand.
1071
+ # @param [Hash<String, Object>] invocation_options Additional options
1072
+ # controlling the invocation of the command.
1073
+ # @option invocation_options [Hash<String, String>] :environment A map
1074
+ # of environment variables to expose at command invocation time.
978
1075
  #
979
1076
  # @example Basic Invocation
980
1077
  # RubyTerraform.state_pull
981
1078
  #
982
- def state_pull(parameters = {})
983
- exec(RubyTerraform::Commands::StatePull, parameters)
1079
+ def state_pull(parameters = {}, invocation_options = {})
1080
+ exec(RubyTerraform::Commands::StatePull,
1081
+ parameters, invocation_options)
984
1082
  end
985
1083
 
986
1084
  # Invokes the +terraform state push+ command which updates remote state from
@@ -1014,13 +1112,18 @@ module RubyTerraform
1014
1112
  # continue even if remote and local Terraform versions are incompatible;
1015
1113
  # this may result in an unusable workspace, and should be used with
1016
1114
  # extreme caution.
1115
+ # @param [Hash<String, Object>] invocation_options Additional options
1116
+ # controlling the invocation of the command.
1117
+ # @option invocation_options [Hash<String, String>] :environment A map
1118
+ # of environment variables to expose at command invocation time.
1017
1119
  #
1018
1120
  # @example Basic Invocation
1019
1121
  # RubyTerraform.state_push(
1020
1122
  # path: 'some/statefile.tfstate')
1021
1123
  #
1022
- def state_push(parameters = {})
1023
- exec(RubyTerraform::Commands::StatePush, parameters)
1124
+ def state_push(parameters = {}, invocation_options = {})
1125
+ exec(RubyTerraform::Commands::StatePush,
1126
+ parameters, invocation_options)
1024
1127
  end
1025
1128
 
1026
1129
  # Invokes the +terraform state rm+ command which removes one or more items
@@ -1063,13 +1166,18 @@ module RubyTerraform
1063
1166
  # to continue even if remote and local Terraform versions are
1064
1167
  # incompatible; this may result in an unusable workspace, and should be
1065
1168
  # used with extreme caution.
1169
+ # @param [Hash<String, Object>] invocation_options Additional options
1170
+ # controlling the invocation of the command.
1171
+ # @option invocation_options [Hash<String, String>] :environment A map
1172
+ # of environment variables to expose at command invocation time.
1066
1173
  #
1067
1174
  # @example Basic Invocation
1068
1175
  # RubyTerraform.state_remove(
1069
1176
  # address: 'packet_device.worker')
1070
1177
  #
1071
- def state_remove(parameters = {})
1072
- exec(RubyTerraform::Commands::StateRemove, parameters)
1178
+ def state_remove(parameters = {}, invocation_options = {})
1179
+ exec(RubyTerraform::Commands::StateRemove,
1180
+ parameters, invocation_options)
1073
1181
  end
1074
1182
  alias state_rm state_remove
1075
1183
 
@@ -1100,14 +1208,19 @@ module RubyTerraform
1100
1208
  # to continue even if remote and local Terraform versions are
1101
1209
  # incompatible; this may result in an unusable workspace, and should be
1102
1210
  # used with extreme caution.
1211
+ # @param [Hash<String, Object>] invocation_options Additional options
1212
+ # controlling the invocation of the command.
1213
+ # @option invocation_options [Hash<String, String>] :environment A map
1214
+ # of environment variables to expose at command invocation time.
1103
1215
  #
1104
1216
  # @example Basic Invocation
1105
1217
  # RubyTerraform.state_replace_provider(
1106
1218
  # from: 'hashicorp/aws',
1107
1219
  # to: 'registry.acme.corp/acme/aws')
1108
1220
  #
1109
- def state_replace_provider(parameters = {})
1110
- exec(RubyTerraform::Commands::StateReplaceProvider, parameters)
1221
+ def state_replace_provider(parameters = {}, invocation_options = {})
1222
+ exec(RubyTerraform::Commands::StateReplaceProvider,
1223
+ parameters, invocation_options)
1111
1224
  end
1112
1225
 
1113
1226
  # Invokes the +terraform state show+ command which shows the attributes of a
@@ -1122,13 +1235,18 @@ module RubyTerraform
1122
1235
  # resource address of the resource instance to show; required.
1123
1236
  # @option parameters [String] :chdir The path of a working directory to
1124
1237
  # switch to before executing the given subcommand.
1238
+ # @param [Hash<String, Object>] invocation_options Additional options
1239
+ # controlling the invocation of the command.
1240
+ # @option invocation_options [Hash<String, String>] :environment A map
1241
+ # of environment variables to expose at command invocation time.
1125
1242
  #
1126
1243
  # @example Basic Invocation
1127
1244
  # RubyTerraform.state_show(
1128
1245
  # address: 'packet_device.worker')
1129
1246
  #
1130
- def state_show(parameters = {})
1131
- exec(RubyTerraform::Commands::StateShow, parameters)
1247
+ def state_show(parameters = {}, invocation_options = {})
1248
+ exec(RubyTerraform::Commands::StateShow,
1249
+ parameters, invocation_options)
1132
1250
  end
1133
1251
 
1134
1252
  # Invokes the +terraform taint+ command which marks a resource instance as
@@ -1183,13 +1301,18 @@ module RubyTerraform
1183
1301
  # to continue even if remote and local Terraform versions are
1184
1302
  # incompatible; this may result in an unusable workspace, and should be
1185
1303
  # used with extreme caution.
1304
+ # @param [Hash<String, Object>] invocation_options Additional options
1305
+ # controlling the invocation of the command.
1306
+ # @option invocation_options [Hash<String, String>] :environment A map
1307
+ # of environment variables to expose at command invocation time.
1186
1308
  #
1187
1309
  # @example Basic Invocation
1188
1310
  # RubyTerraform.taint(
1189
1311
  # address: 'aws_security_group.allow_all')
1190
1312
  #
1191
- def taint(parameters = {})
1192
- exec(RubyTerraform::Commands::Taint, parameters)
1313
+ def taint(parameters = {}, invocation_options = {})
1314
+ exec(RubyTerraform::Commands::Taint,
1315
+ parameters, invocation_options)
1193
1316
  end
1194
1317
 
1195
1318
  # Invokes the +terraform untaint+ command which removes the 'tainted' state
@@ -1237,13 +1360,18 @@ module RubyTerraform
1237
1360
  # to continue even if remote and local Terraform versions are
1238
1361
  # incompatible; this may result in an unusable workspace, and should be
1239
1362
  # used with extreme caution.
1363
+ # @param [Hash<String, Object>] invocation_options Additional options
1364
+ # controlling the invocation of the command.
1365
+ # @option invocation_options [Hash<String, String>] :environment A map
1366
+ # of environment variables to expose at command invocation time.
1240
1367
  #
1241
1368
  # @example Basic Invocation
1242
1369
  # RubyTerraform.untaint(
1243
1370
  # name: 'aws_security_group.allow_all')
1244
1371
  #
1245
- def untaint(parameters = {})
1246
- exec(RubyTerraform::Commands::Untaint, parameters)
1372
+ def untaint(parameters = {}, invocation_options = {})
1373
+ exec(RubyTerraform::Commands::Untaint,
1374
+ parameters, invocation_options)
1247
1375
  end
1248
1376
 
1249
1377
  # Invokes the +terraform validate+ command which checks whether a
@@ -1283,13 +1411,18 @@ module RubyTerraform
1283
1411
  # editor integrations and other automated systems; always disables color.
1284
1412
  # @option parameters [Boolean] :no_color (false) Whether or not the output
1285
1413
  # from the command should be in color.
1414
+ # @param [Hash<String, Object>] invocation_options Additional options
1415
+ # controlling the invocation of the command.
1416
+ # @option invocation_options [Hash<String, String>] :environment A map
1417
+ # of environment variables to expose at command invocation time.
1286
1418
  #
1287
1419
  # @example Basic Invocation
1288
1420
  # RubyTerraform.validate(
1289
1421
  # directory: 'infra/networking')
1290
1422
  #
1291
- def validate(parameters = {})
1292
- exec(RubyTerraform::Commands::Validate, parameters)
1423
+ def validate(parameters = {}, invocation_options = {})
1424
+ exec(RubyTerraform::Commands::Validate,
1425
+ parameters, invocation_options)
1293
1426
  end
1294
1427
 
1295
1428
  # Invokes the +terraform workspace delete+ command which deletes a
@@ -1310,13 +1443,18 @@ module RubyTerraform
1310
1443
  # file.
1311
1444
  # @option parameters [String] :lock_timeout ("0s") The duration to retry a
1312
1445
  # state lock.
1446
+ # @param [Hash<String, Object>] invocation_options Additional options
1447
+ # controlling the invocation of the command.
1448
+ # @option invocation_options [Hash<String, String>] :environment A map
1449
+ # of environment variables to expose at command invocation time.
1313
1450
  #
1314
1451
  # @example Basic Invocation
1315
1452
  # RubyTerraform.workspace_delete(
1316
1453
  # name: 'example')
1317
1454
  #
1318
- def workspace_delete(parameters = {})
1319
- exec(RubyTerraform::Commands::WorkspaceDelete, parameters)
1455
+ def workspace_delete(parameters = {}, invocation_options = {})
1456
+ exec(RubyTerraform::Commands::WorkspaceDelete,
1457
+ parameters, invocation_options)
1320
1458
  end
1321
1459
 
1322
1460
  # Invokes the +terraform workspace list+ command which lists workspaces.
@@ -1327,13 +1465,18 @@ module RubyTerraform
1327
1465
  # terraform 0.15, use +:chdir+ instead).
1328
1466
  # @option parameters [String] :chdir the path of a working directory to
1329
1467
  # switch to before executing the given subcommand.
1468
+ # @param [Hash<String, Object>] invocation_options Additional options
1469
+ # controlling the invocation of the command.
1470
+ # @option invocation_options [Hash<String, String>] :environment A map
1471
+ # of environment variables to expose at command invocation time.
1330
1472
  #
1331
1473
  # @example Basic Invocation
1332
1474
  # RubyTerraform.workspace_list(
1333
1475
  # directory: 'infra/networking')
1334
1476
  #
1335
- def workspace_list(parameters = {})
1336
- exec(RubyTerraform::Commands::WorkspaceList, parameters)
1477
+ def workspace_list(parameters = {}, invocation_options = {})
1478
+ exec(RubyTerraform::Commands::WorkspaceList,
1479
+ parameters, invocation_options)
1337
1480
  end
1338
1481
 
1339
1482
  # Invokes the +terraform workspace new+ command which creates a new
@@ -1354,13 +1497,18 @@ module RubyTerraform
1354
1497
  # state lock.
1355
1498
  # @option parameters [String] :state The path to a state file to copy into
1356
1499
  # the new workspace.
1500
+ # @param [Hash<String, Object>] invocation_options Additional options
1501
+ # controlling the invocation of the command.
1502
+ # @option invocation_options [Hash<String, String>] :environment A map
1503
+ # of environment variables to expose at command invocation time.
1357
1504
  #
1358
1505
  # @example Basic Invocation
1359
1506
  # RubyTerraform.workspace_new(
1360
1507
  # name: 'example')
1361
1508
  #
1362
- def workspace_new(parameters = {})
1363
- exec(RubyTerraform::Commands::WorkspaceNew, parameters)
1509
+ def workspace_new(parameters = {}, invocation_options = {})
1510
+ exec(RubyTerraform::Commands::WorkspaceNew,
1511
+ parameters, invocation_options)
1364
1512
  end
1365
1513
 
1366
1514
  # Invokes the +terraform workspace select+ command which selects a
@@ -1374,13 +1522,18 @@ module RubyTerraform
1374
1522
  # terraform 0.15, use +:chdir+ instead).
1375
1523
  # @option parameters [String] :chdir The path of a working directory to
1376
1524
  # switch to before executing the given subcommand.
1525
+ # @param [Hash<String, Object>] invocation_options Additional options
1526
+ # controlling the invocation of the command.
1527
+ # @option invocation_options [Hash<String, String>] :environment A map
1528
+ # of environment variables to expose at command invocation time.
1377
1529
  #
1378
1530
  # @example BasicInvocation
1379
1531
  # RubyTerraform.workspace_select(
1380
1532
  # name: 'example')
1381
1533
  #
1382
- def workspace_select(parameters = {})
1383
- exec(RubyTerraform::Commands::WorkspaceSelect, parameters)
1534
+ def workspace_select(parameters = {}, invocation_options = {})
1535
+ exec(RubyTerraform::Commands::WorkspaceSelect,
1536
+ parameters, invocation_options)
1384
1537
  end
1385
1538
 
1386
1539
  # Invokes the +terraform workspace show+ command which shows the name of the
@@ -1389,28 +1542,38 @@ module RubyTerraform
1389
1542
  # @param parameters The parameters used to invoke the command
1390
1543
  # @option parameters [String] :chdir The path of a working directory to
1391
1544
  # switch to before executing the given subcommand.
1545
+ # @param [Hash<String, Object>] invocation_options Additional options
1546
+ # controlling the invocation of the command.
1547
+ # @option invocation_options [Hash<String, String>] :environment A map
1548
+ # of environment variables to expose at command invocation time.
1392
1549
  #
1393
1550
  # @example Basic Invocation
1394
1551
  # RubyTerraform.workspace_show
1395
1552
  #
1396
- def workspace_show(parameters = {})
1397
- exec(RubyTerraform::Commands::WorkspaceShow, parameters)
1553
+ def workspace_show(parameters = {}, invocation_options = {})
1554
+ exec(RubyTerraform::Commands::WorkspaceShow,
1555
+ parameters, invocation_options)
1398
1556
  end
1399
1557
 
1400
1558
  # rubocop:disable Metrics/MethodLength
1401
1559
 
1402
- def workspace(parameters = {})
1560
+ def workspace(parameters = {}, invocation_options = {})
1403
1561
  case parameters[:operation]
1404
1562
  when nil, 'list'
1405
- exec(RubyTerraform::Commands::WorkspaceList, parameters)
1563
+ exec(RubyTerraform::Commands::WorkspaceList,
1564
+ parameters, invocation_options)
1406
1565
  when 'select'
1407
- exec(RubyTerraform::Commands::WorkspaceSelect, parameters)
1566
+ exec(RubyTerraform::Commands::WorkspaceSelect,
1567
+ parameters, invocation_options)
1408
1568
  when 'new'
1409
- exec(RubyTerraform::Commands::WorkspaceNew, parameters)
1569
+ exec(RubyTerraform::Commands::WorkspaceNew,
1570
+ parameters, invocation_options)
1410
1571
  when 'delete'
1411
- exec(RubyTerraform::Commands::WorkspaceDelete, parameters)
1572
+ exec(RubyTerraform::Commands::WorkspaceDelete,
1573
+ parameters, invocation_options)
1412
1574
  when 'show'
1413
- exec(RubyTerraform::Commands::WorkspaceShow, parameters)
1575
+ exec(RubyTerraform::Commands::WorkspaceShow,
1576
+ parameters, invocation_options)
1414
1577
  else
1415
1578
  raise(
1416
1579
  "Invalid operation '#{parameters[:operation]}' supplied to workspace"
@@ -1422,8 +1585,8 @@ module RubyTerraform
1422
1585
 
1423
1586
  private
1424
1587
 
1425
- def exec(command_class, parameters)
1426
- command_class.new.execute(parameters)
1588
+ def exec(command_class, parameters, invocation_options)
1589
+ command_class.new.execute(parameters, invocation_options)
1427
1590
  end
1428
1591
  end
1429
1592