Class: TerraformConfig::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/core/terraform_config/generator.rb

Overview

rubocop:disable Metrics/ClassLength

Defined Under Namespace

Classes: InvalidTemplateError

Constant Summary collapse

SUPPORTED_TEMPLATE_KINDS =
%w[gvc secret identity policy volumeset workload auditctx agent].freeze
WORKLOAD_SPEC_KEYS =
%i[
  type
  containers
  identity_link
  default_options
  local_options
  rollout_options
  security_options
  load_balancer
  firewall_config
  support_dynamic_tags
  job
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config:, template:) ⇒ Generator

Returns a new instance of Generator.



24
25
26
27
28
# File 'lib/core/terraform_config/generator.rb', line 24

def initialize(config:, template:)
  @config = config
  @template = template.deep_underscore_keys.deep_symbolize_keys
  validate_template_kind!
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



22
23
24
# File 'lib/core/terraform_config/generator.rb', line 22

def config
  @config
end

#templateObject (readonly)

Returns the value of attribute template.



22
23
24
# File 'lib/core/terraform_config/generator.rb', line 22

def template
  @template
end

Instance Method Details

#tf_configsObject



30
31
32
# File 'lib/core/terraform_config/generator.rb', line 30

def tf_configs
  tf_config.locals.merge(filename => tf_config)
end