Module: Convection::DSL::Template::Resource::IAMUser

Included in:
Model::Template::Resource::IAMUser
Defined in:
lib/convection/model/template/resource/aws_iam_user.rb

Overview

Role DSL

Instance Method Summary collapse

Instance Method Details

#policy(policy_name, &block) ⇒ Object



9
10
11
12
13
14
# File 'lib/convection/model/template/resource/aws_iam_user.rb', line 9

def policy(policy_name, &block)
  add_policy = Model::Mixin::Policy.new(:name => policy_name, :template => @template)
  add_policy.instance_exec(&block) if block

  policies << add_policy
end

#with_key(serial = 0, &block) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/convection/model/template/resource/aws_iam_user.rb', line 16

def with_key(serial = 0, &block)
  key = Model::Template::Resource::IAMAccessKey.new("#{ name }Key", @template)
  key.user_name = self
  key.serial = serial

  key.depends_on(self)

  key.with_output("#{ name }Id", key.reference)
  key.with_output("#{ name }Secret", get_att(key.name, 'SecretAccessKey'))

  key.instance_exec(&block) if block

  @template.resources[key.name] = key
end