Skip to content

Instantly share code, notes, and snippets.

@glenjamin
Last active September 4, 2015 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glenjamin/5e518706cc22bb7bb455 to your computer and use it in GitHub Desktop.
Save glenjamin/5e518706cc22bb7bb455 to your computer and use it in GitHub Desktop.
Terrafiddle
users = %w(
abc
def
ghi
jkl
)
def autohash
Hash.new { |h, k| h[k] = autohash }
end
resources = autohash
resources[:aws_iam_group]["Administrators"] = {
name: "Administrators"
}
resources[:aws_iam_group_membership]["Administrators"] = {
name: "Administrators",
users: users,
group: "${aws_iam_group.Administrators.name}"
}
users.each do |user|
resources[:aws_iam_user][user] = {
name: user
}
end
require 'json'
puts JSON.pretty_generate({resource: resources})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment