Class: Terraforming::Resource::EFSFileSystem

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/terraforming/resource/efs_file_system.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Util

#apply_template, #name_from_tag, #normalize_module_name, #prettify_policy, #template_path

Constructor Details

#initialize(client) ⇒ EFSFileSystem

Returns a new instance of EFSFileSystem.



14
15
16
# File 'lib/terraforming/resource/efs_file_system.rb', line 14

def initialize(client)
  @client = client
end

Class Method Details

.tf(client: Aws::EFS::Client.new) ⇒ Object



6
7
8
# 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) ⇒ Object



10
11
12
# File 'lib/terraforming/resource/efs_file_system.rb', line 10

def self.tfstate(client: Aws::EFS::Client.new)
  self.new(client).tfstate
end

Instance Method Details

#tfObject



18
19
20
# File 'lib/terraforming/resource/efs_file_system.rb', line 18

def tf
  apply_template(@client, "tf/elastic_filesystem")
end

#tfstateObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 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