practice_terraforming 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98ff43f8cc264e18b5ede9e0ef14d83b2b3f6407
4
- data.tar.gz: 7768beac720f4fc06f7f38a922cee1a99075fdc2
3
+ metadata.gz: 63ca79afc7248bfaaa59d412f06056e79d3a693b
4
+ data.tar.gz: fd4dc38c46c312d5cce268a73b7f4cd276dd785c
5
5
  SHA512:
6
- metadata.gz: d497200c61999b77882d41291ac56e62cb021e4706b383855f27bf78eda5eb60a8ab07c481c43e579866006ba8cd97ad972084c2a0855e976a5667b58398e0f6
7
- data.tar.gz: f537949c2caf1b618d162ef1428e61e1153ba85bf96a6a9b0a74afc7dec89fb35b4e8119c61a8338959759ed95733e56dbfc1f255d1100c7893d7e18553f175b
6
+ metadata.gz: 0b46c329ce2f78c455a774f6a1df14362db6e8c24284d9d56197928036f2fd2a4f4c523d93f459baf89a4a48789ffd95f419851cd09dd5f4eda8728eaf3e56be
7
+ data.tar.gz: 3232f32273e76dbf74db20782057eedf21ebda34919ce045fa46add36763b7fff5affea6041cabde0f1fb40ff764ce3d2024758a25064ea5b3bce65e3660de23
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- practice_terraforming (0.1.4)
4
+ practice_terraforming (0.1.7)
5
5
  aws-sdk-iam (~> 1)
6
6
  aws-sdk-s3 (~> 1)
7
7
  multi_json (~> 1.12.1)
data/README.md CHANGED
@@ -312,6 +312,7 @@ Commands:
312
312
  practice_terraforming iampa # Iam Policy Attachment
313
313
  practice_terraforming iamr # Iam Role
314
314
  practice_terraforming iamrpa # Iam Role Policy Attachment
315
+ practice_terraforming iamu # Iam User
315
316
  practice_terraforming iamupa # Iam User Policy Attachment
316
317
  practice_terraforming s3 # S3
317
318
 
@@ -33,7 +33,8 @@ module PracticeTerraforming
33
33
  "name" => user.user_name,
34
34
  "path" => user.path,
35
35
  "unique_id" => user.user_id,
36
- "force_destroy" => "false"
36
+ "force_destroy" => "false",
37
+ "tags" => iam_tags_of(user).map { |t| [t.key, t.value] }.to_h
37
38
  }
38
39
  resources["aws_iam_user.#{module_name_of(user)}"] = {
39
40
  "type" => "aws_iam_user",
@@ -53,6 +54,10 @@ module PracticeTerraforming
53
54
  @client.list_users.map(&:users).flatten
54
55
  end
55
56
 
57
+ def iam_tags_of(user)
58
+ @client.list_user_tags(user_name: user.user_name).map(&:tags).flatten
59
+ end
60
+
56
61
  def module_name_of(user)
57
62
  normalize_module_name(user.user_name)
58
63
  end
@@ -2,6 +2,11 @@
2
2
  resource "aws_iam_user" "<%= module_name_of(user) %>" {
3
3
  name = "<%= user.user_name %>"
4
4
  path = "<%= user.path %>"
5
+ tags = {
6
+ <% iam_tags_of(user).each do |tag| -%>
7
+ "<%= tag.key%>" = "<%= tag.value %>"
8
+ <% end -%>
9
+ }
5
10
  }
6
11
 
7
12
  <% end -%>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PracticeTerraforming
4
- VERSION = '0.1.6'
4
+ VERSION = '0.1.7'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: practice_terraforming
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - masatonaka