Method: Terraspace::Builder::Allow#check!

Defined in:
lib/terraspace/builder/allow.rb

#check!Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/terraspace/builder/allow.rb', line 7

def check!
  messages = []
  unless env_allowed?
    messages << "This env is not allowed to be used: TS_ENV=#{Terraspace.env}"
    messages << "Allowed envs: #{config.allow.envs.join(', ')}"
  end
  unless region_allowed?
    messages << "This region is not allowed to be used: Detected current region=#{current_region}"
    messages << "Allowed regions: #{config.allow.regions.join(', ')}"
  end
  unless messages.empty?
    puts "ERROR: The configs do not allow this.".color(:red)
    puts messages
    exit 1
  end
end