class Terraforming::Resource::IAMInstanceProfile
Public Class Methods
new(client)
click to toggle source
# File lib/terraforming/resource/iam_instance_profile.rb, line 14 def initialize(client) @client = client end
tf(client: Aws::IAM::Client.new)
click to toggle source
# File lib/terraforming/resource/iam_instance_profile.rb, line 6 def self.tf(client: Aws::IAM::Client.new) self.new(client).tf end
tfstate(client: Aws::IAM::Client.new)
click to toggle source
# File lib/terraforming/resource/iam_instance_profile.rb, line 10 def self.tfstate(client: Aws::IAM::Client.new) self.new(client).tfstate end
Public Instance Methods
tf()
click to toggle source
# File lib/terraforming/resource/iam_instance_profile.rb, line 18 def tf apply_template(@client, "tf/iam_instance_profile") end
tfstate()
click to toggle source
# File lib/terraforming/resource/iam_instance_profile.rb, line 22 def tfstate iam_instance_profiles.inject({}) do |resources, profile| attributes = { "arn" => profile.arn, "id" => profile.instance_profile_name, "name" => profile.instance_profile_name, "path" => profile.path, "roles.#" => profile.roles.length.to_s, } resources["aws_iam_instance_profile.#{module_name_of(profile)}"] = { "type" => "aws_iam_instance_profile", "primary" => { "id" => profile.instance_profile_name, "attributes" => attributes } } resources end end
Private Instance Methods
iam_instance_profiles()
click to toggle source
# File lib/terraforming/resource/iam_instance_profile.rb, line 45 def iam_instance_profiles @client.list_instance_profiles.map(&:instance_profiles).flatten end
module_name_of(profile)
click to toggle source
# File lib/terraforming/resource/iam_instance_profile.rb, line 49 def module_name_of(profile) normalize_module_name(profile.instance_profile_name) end