Commit 0a903695 authored by Daisuke Fujita's avatar Daisuke Fujita

Merge pull request #129 from dtan4/iam-user-dots

Normalize module name of IAM user
parents 948cfd7f 59150a58
......@@ -28,7 +28,7 @@ module Terraforming
"path" => user.path,
"unique_id" => user.user_id,
}
resources["aws_iam_user.#{user.user_name}"] = {
resources["aws_iam_user.#{module_name_of(user)}"] = {
"type" => "aws_iam_user",
"primary" => {
"id" => user.user_name,
......@@ -45,6 +45,10 @@ module Terraforming
def iam_users
@client.list_users.users
end
def module_name_of(user)
normalize_module_name(user.user_name)
end
end
end
end
<% iam_users.each do |user| -%>
resource "aws_iam_user" "<%= user.user_name %>" {
resource "aws_iam_user" "<%= module_name_of(user) %>" {
name = "<%= user.user_name %>"
path = "<%= user.path %>"
}
......
......@@ -19,7 +19,7 @@ module Terraforming
},
{
path: "/system/",
user_name: "fuga",
user_name: "fuga.piyo",
user_id: "OPQRSTUVWXYZA8901234",
arn: "arn:aws:iam::345678901234:user/fuga",
create_date: Time.parse("2015-05-01 12:34:56 UTC"),
......@@ -40,8 +40,8 @@ resource "aws_iam_user" "hoge" {
path = "/"
}
resource "aws_iam_user" "fuga" {
name = "fuga"
resource "aws_iam_user" "fuga-piyo" {
name = "fuga.piyo"
path = "/system/"
}
......@@ -65,14 +65,14 @@ resource "aws_iam_user" "fuga" {
}
}
},
"aws_iam_user.fuga" => {
"aws_iam_user.fuga-piyo" => {
"type" => "aws_iam_user",
"primary" => {
"id" => "fuga",
"id" => "fuga.piyo",
"attributes" => {
"arn"=> "arn:aws:iam::345678901234:user/fuga",
"id" => "fuga",
"name" => "fuga",
"id" => "fuga.piyo",
"name" => "fuga.piyo",
"path" => "/system/",
"unique_id" => "OPQRSTUVWXYZA8901234",
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment