1
1
#!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
require 'optparse'
3
5
4
6
def main
5
7
options = {
6
8
counts : {
7
9
com : Integer ( ENV . fetch ( 'COUNT_COM' , '0' ) ) ,
8
- org : Integer ( ENV . fetch ( 'COUNT_ORG' , '0' ) ) ,
10
+ org : Integer ( ENV . fetch ( 'COUNT_ORG' , '0' ) )
9
11
} ,
10
12
env : ENV . fetch ( 'ENV' , 'staging' ) ,
11
13
index : ENV . fetch ( 'INDEX' , '1' ) ,
@@ -14,7 +16,7 @@ def main
14
16
project : ENV . fetch ( 'PROJECT' , 'notset' ) ,
15
17
region : ENV . fetch ( 'REGION' , 'us-central1' ) ,
16
18
terraform : ENV . fetch ( 'TERRAFORM' , 'terraform' ) ,
17
- zones : ENV . fetch ( 'ZONES' , 'a,b,c,f' ) . split ( ',' ) . map ( &:strip ) ,
19
+ zones : ENV . fetch ( 'ZONES' , 'a,b,c,f' ) . split ( ',' ) . map ( &:strip )
18
20
}
19
21
20
22
OptionParser . new do |opts |
@@ -70,7 +72,7 @@ def main
70
72
zones = options . fetch ( :zones )
71
73
72
74
to_import = {
73
- 'heroku_app.gcloud_cleanup' => "gcloud-cleanup-#{ env } -#{ index } " ,
75
+ 'heroku_app.gcloud_cleanup' => "gcloud-cleanup-#{ env } -#{ index } "
74
76
}
75
77
76
78
%i[ com org ] . each do |site |
@@ -90,9 +92,10 @@ def main
90
92
command = %W[
91
93
#{ terraform } import module.#{ module_name } .#{ resource } #{ importable }
92
94
]
93
- $stderr . puts ( "---> #{ command . join ( ' ' ) } " )
95
+ warn ( "---> #{ command . join ( ' ' ) } " )
94
96
next if noop
95
- system ( *command ) || $stderr. puts ( '---? already imported?' )
97
+
98
+ system ( *command ) || warn ( '---? already imported?' )
96
99
end
97
100
98
101
0
0 commit comments