Class: PracticeTerraforming::Resource::IAMUser
- Inherits:
-
Object
- Object
- PracticeTerraforming::Resource::IAMUser
- Includes:
- Util
- Defined in:
- lib/practice_terraforming/resource/iam_user.rb
Class Method Summary collapse
-
.tf(client: Aws::IAM::Client.new) ⇒ Object
TODO: Select appropriate Client class from here: docs.aws.amazon.com/sdkforruby/api/index.html.
-
.tfstate(client: Aws::IAM::Client.new) ⇒ Object
TODO: Select appropriate Client class from here: docs.aws.amazon.com/sdkforruby/api/index.html.
Instance Method Summary collapse
-
#initialize(client) ⇒ IAMUser
constructor
A new instance of IAMUser.
- #tf ⇒ Object
- #tfstate ⇒ Object
Methods included from Util
#apply_template, #name_from_tag, #normalize_module_name, #prettify_policy, #template_path
Constructor Details
#initialize(client) ⇒ IAMUser
Returns a new instance of IAMUser.
20 21 22 |
# File 'lib/practice_terraforming/resource/iam_user.rb', line 20 def initialize(client) @client = client end |
Class Method Details
.tf(client: Aws::IAM::Client.new) ⇒ Object
TODO: Select appropriate Client class from here: docs.aws.amazon.com/sdkforruby/api/index.html
10 11 12 |
# File 'lib/practice_terraforming/resource/iam_user.rb', line 10 def self.tf(client: Aws::IAM::Client.new) self.new(client).tf end |
.tfstate(client: Aws::IAM::Client.new) ⇒ Object
TODO: Select appropriate Client class from here: docs.aws.amazon.com/sdkforruby/api/index.html
16 17 18 |
# File 'lib/practice_terraforming/resource/iam_user.rb', line 16 def self.tfstate(client: Aws::IAM::Client.new) self.new(client).tfstate end |
Instance Method Details
#tf ⇒ Object
24 25 26 |
# File 'lib/practice_terraforming/resource/iam_user.rb', line 24 def tf apply_template(@client, "tf/iam_user") end |
#tfstate ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/practice_terraforming/resource/iam_user.rb', line 28 def tfstate iam_users.inject({}) do |resources, user| attributes = { "arn" => user.arn, "id" => user.user_name, "name" => user.user_name, "path" => user.path, "unique_id" => user.user_id, "force_destroy" => "false" } resources["aws_iam_user.#{module_name_of(user)}"] = { "type" => "aws_iam_user", "primary" => { "id" => user.user_name, "attributes" => attributes } } resources end end |