Class: Formatron::CloudFormation::Template::VPC::Subnet::ChefServer

Inherits:
Object
  • Object
show all
Defined in:
lib/formatron/cloud_formation/template/vpc/subnet/chef_server.rb

Overview

generates CloudFormation Chef Server resources rubocop:disable Metrics/ClassLength

Constant Summary collapse

USER_PREFIX =
'user'
ACCESS_KEY_PREFIX =
'accessKey'

Instance Method Summary collapse

Constructor Details

#initialize(chef_server:, key_pair:, administrator_name:, administrator_password:, availability_zone:, subnet_guid:, hosted_zone_name:, vpc_guid:, vpc_cidr:, kms_key:, private_hosted_zone_id:, public_hosted_zone_id:, bucket:, name:, target:) ⇒ ChefServer

rubocop:disable Metrics/MethodLength rubocop:disable Metrics/ParameterLists rubocop:disable Metrics/AbcSize



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/formatron/cloud_formation/template/vpc/subnet/chef_server.rb', line 20

def initialize(
  chef_server:,
  key_pair:,
  administrator_name:,
  administrator_password:,
  availability_zone:,
  subnet_guid:,
  hosted_zone_name:,
  vpc_guid:,
  vpc_cidr:,
  kms_key:,
  private_hosted_zone_id:,
  public_hosted_zone_id:,
  bucket:,
  name:,
  target:
)
  @chef_server = chef_server
  @bucket = bucket
  guid = @chef_server.guid
  @ssl_cert_key = S3::ChefServerCert.cert_key(
    name: name,
    target: target,
    guid: guid
  )
  @ssl_key_key = S3::ChefServerCert.key_key(
    name: name,
    target: target,
    guid: guid
  )
  @user_pem_key = S3::ChefServerKeys.user_pem_key(
    name: name,
    target: target,
    guid: guid
  )
  @organization_pem_key =
    S3::ChefServerKeys.organization_pem_key(
      name: name,
      target: target,
      guid: guid
    )
  @user_id = "#{USER_PREFIX}#{guid}"
  @access_key_id = "#{ACCESS_KEY_PREFIX}#{guid}"
  @kms_key = kms_key
  @username = @chef_server.username
  @password = @chef_server.password
  @first_name = @chef_server.first_name
  @last_name = @chef_server.last_name
  @email = @chef_server.email
  @version = @chef_server.version
  @cookbooks_bucket = @chef_server.cookbooks_bucket
  organization = @chef_server.organization
  @organization_short_name = organization.short_name
  @organization_full_name = organization.full_name
  _set_default_instance_type
  _set_os
  _add_ssl_cert_policy
  _add_keys_policy
  _add_open_ports
  _add_setup_script
  @instance = Instance.new(
    instance: @chef_server,
    key_pair: key_pair,
    administrator_name: administrator_name,
    administrator_password: administrator_password,
    availability_zone: availability_zone,
    subnet_guid: subnet_guid,
    hosted_zone_name: hosted_zone_name,
    vpc_guid: vpc_guid,
    vpc_cidr: vpc_cidr,
    kms_key: @kms_key,
    private_hosted_zone_id: private_hosted_zone_id,
    public_hosted_zone_id: public_hosted_zone_id,
    bucket: @bucket,
    name: name,
    target: target
  )
end

Instance Method Details

#merge(resources:, outputs:) ⇒ Object

rubocop:enable Metrics/MethodLength



179
180
181
182
# File 'lib/formatron/cloud_formation/template/vpc/subnet/chef_server.rb', line 179

def merge(resources:, outputs:)
  _add_cookbooks_bucket_user resources
  @instance.merge resources: resources, outputs: outputs
end