class Terraforming::Resource::EFSFileSystem

Public Class Methods

new(client) click to toggle source
# File lib/terraforming/resource/efs_file_system.rb, line 14
def initialize(client)
  @client = client
end
tf(client: Aws::EFS::Client.new) click to toggle source
# File lib/terraforming/resource/efs_file_system.rb, line 6
def self.tf(client: Aws::EFS::Client.new)
  self.new(client).tf
end
tfstate(client: Aws::EFS::Client.new) click to toggle source
# File lib/terraforming/resource/efs_file_system.rb, line 10
def self.tfstate(client: Aws::EFS::Client.new)
  self.new(client).tfstate
end

Public Instance Methods

tf() click to toggle source
# File lib/terraforming/resource/efs_file_system.rb, line 18
def tf
  apply_template(@client, "tf/elastic_file_system")
end
tfstate() click to toggle source
# File lib/terraforming/resource/efs_file_system.rb, line 22
def tfstate
  file_systems.inject({}) do |resources, efs|
    attributes = {
      "creation_token" => efs.creation_token,
      "id" => efs.file_system_id,
      "performance_mode" => efs.performance_mode,
      "tags.%" => "1",
      "tags.Name" => efs.name,
    }

    resources["aws_efs_file_system.#{module_name_of(efs)}"] = {
      "type" => "aws_efs_file_system",
      "depends_on" => [],
      "primary" => {
        "id" => efs.file_system_id,
        "attributes" => attributes,
        "meta" => {},
        "tainted" => false,
      },
      "deposed" => [],
      "provider" => "aws",
    }

    resources
  end
end

Private Instance Methods

file_systems() click to toggle source
# File lib/terraforming/resource/efs_file_system.rb, line 51
def file_systems
  @client.describe_file_systems.data.file_systems.flatten
end
module_name_of(efs) click to toggle source
# File lib/terraforming/resource/efs_file_system.rb, line 55
def module_name_of(efs)
  normalize_module_name(efs.file_system_id)
end