belt 0.3.26 → 0.3.27

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a5cf0b2661bd7ea2b9e0e2ebe13fcb6090506bb3b268a606b6d5fd6b4e21511
4
- data.tar.gz: 344bd5cce8ca35f81e0b8ba5e4c4a43a182bb031a56ddc9db01ec2bd5a01ba26
3
+ metadata.gz: 19b006b12335ff6d66a4834d47b1a2d69e29b1f6d82c81d17cb842cf8cd3b929
4
+ data.tar.gz: b0c23c9f91bfac292603928ad63bdc28ac75fc0d9f306a5c32d2a57abaa0cf0a
5
5
  SHA512:
6
- metadata.gz: 39c2ec3441b7622cb8ab1913afe6d76eb6b300c6c41c5767361efea0e76c94a97ba738bb2fd09d2fde68a5ec0353c909afe9c392066f655a56c393a72a8b1ea0
7
- data.tar.gz: 8f9c6cb95c3d775d86f4e53ddf708c6ed8be8bcbf823ffa70dc5427752bd87444d1dcfc91cc19ba85572ecd9186ff2d05f69dbc05db8412972cd36c1c3e1ff3a
6
+ metadata.gz: 30db85ef7c77debdc5ec7bc66977afb4dc2f5f72c0b61e43e3d3ad17d579fd3e7af7591e885be419e55819c0c8fc05ba5970095827c5b51bf889f9c3553372ec
7
+ data.tar.gz: e46501282fc782535992b185f87014e6b27c6f5e5a5eb5572cb91e713a362cedd5209674436f535af03834d7fe3b8feafd47e5a533b6eb3d36c23c5bfa31ce6b
@@ -25,6 +25,8 @@ module Belt
25
25
  new.generate(args)
26
26
  when 'add'
27
27
  new.add_environment(args)
28
+ when 'show', 'list'
29
+ new.show(args)
28
30
  when '--help', '-h', 'help'
29
31
  puts help
30
32
  else
@@ -41,6 +43,7 @@ module Belt
41
43
  deploy Deploy the dns infrastructure (init → plan → apply)
42
44
  generate Create the infrastructure/dns directory (same as belt generate dns)
43
45
  add <env> Add an environment's NS records to dns/terraform.tfvars
46
+ show Show root zone name servers (for registrar configuration)
44
47
  help Show this help
45
48
 
46
49
  Options for generate:
@@ -52,6 +55,7 @@ module Belt
52
55
  belt dns generate # Scaffold infrastructure/dns (prompts for profile)
53
56
  belt dns generate --aws-profile fpshared # Non-interactive with profile
54
57
  belt dns add staging # Add staging's NS records to tfvars
58
+ belt dns show # Show root name servers to configure at registrar
55
59
 
56
60
  The dns directory manages your root domain and delegates subdomains to
57
61
  per-environment hosted zones. Each environment (dev, staging, prod) gets
@@ -204,6 +208,81 @@ module Belt
204
208
  puts "\nRun 'belt dns deploy' to apply the changes."
205
209
  end
206
210
 
211
+ # --- Show ---
212
+ def show(_args)
213
+ require 'open3'
214
+
215
+ unless Dir.exist?(DNS_DIR)
216
+ puts 'No infrastructure/dns directory found.'
217
+ puts "\nCreate it first:"
218
+ puts ' belt dns generate'
219
+ exit 1
220
+ end
221
+
222
+ env_config = load_dns_config
223
+ env = {}
224
+ env['AWS_PROFILE'] = env_config.aws_profile if env_config.aws_profile?
225
+
226
+ # Get all outputs in one call
227
+ outputs = Dir.chdir(DNS_DIR) do
228
+ output, status = Open3.capture2e(env, 'terraform', 'output', '-json')
229
+ unless status.success?
230
+ puts 'Failed to read terraform outputs.'
231
+ puts "\nMake sure DNS is deployed:"
232
+ puts ' belt dns deploy'
233
+ exit 1
234
+ end
235
+
236
+ begin
237
+ JSON.parse(output)
238
+ rescue JSON::ParserError
239
+ puts 'Failed to parse terraform outputs.'
240
+ exit 1
241
+ end
242
+ end
243
+
244
+ # Extract values
245
+ name_servers = outputs.dig('root_name_servers', 'value') || []
246
+ zone_id = outputs.dig('root_zone_id', 'value')
247
+ environments = outputs.dig('delegated_environments', 'value') || []
248
+
249
+ if name_servers.empty?
250
+ puts 'No name servers found. Is the DNS zone deployed?'
251
+ puts "\nRun:"
252
+ puts ' belt dns deploy'
253
+ exit 1
254
+ end
255
+
256
+ # Read domain from tfvars
257
+ tfvars_path = "#{DNS_DIR}/terraform.tfvars"
258
+ domain = nil
259
+ if File.exist?(tfvars_path)
260
+ content = File.read(tfvars_path)
261
+ match = content.match(/domain\s*=\s*"([^"]+)"/)
262
+ domain = match[1] if match
263
+ end
264
+
265
+ # Display
266
+ puts 'Root Zone Name Servers'
267
+ puts '======================'
268
+ puts ''
269
+ puts "Domain: #{domain}" if domain
270
+ puts "Zone ID: #{zone_id}" if zone_id
271
+ puts ''
272
+ puts 'Configure these at your domain registrar:'
273
+ puts ''
274
+ name_servers.each { |ns| puts " #{ns}" }
275
+ puts ''
276
+
277
+ if environments.any?
278
+ puts "Delegated environments: #{environments.join(', ')}"
279
+ else
280
+ puts 'No environments delegated yet.'
281
+ puts "\nTo add an environment:"
282
+ puts ' belt dns add <env>'
283
+ end
284
+ end
285
+
207
286
  private
208
287
 
209
288
  def templates
data/lib/belt/cli.rb CHANGED
@@ -116,6 +116,7 @@ module Belt
116
116
  deploy frontend <env> [--frontend NAME] Build and deploy frontend(s) to AWS
117
117
  dns deploy Deploy root DNS zone (init → plan → apply)
118
118
  dns add <env> Add environment NS records to dns/terraform.tfvars
119
+ dns show Show root zone name servers for registrar
119
120
  frontend env <env> [--frontend NAME] Write <frontend>/.env from terraform outputs
120
121
  frontend list List configured frontends
121
122
  routes [-g PATTERN] [-f json] Show route definitions
data/lib/belt/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Belt
4
- VERSION = '0.3.26'
4
+ VERSION = '0.3.27'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: belt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.26
4
+ version: 0.3.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stowzilla