Class: GeoEngineer::Resources::AwsIamGroupMembership

Inherits:
GeoEngineer::Resource show all
Defined in:
lib/geoengineer/resources/aws_iam_group_membership.rb

Overview

AwsIamGroup aws_iam_group_membership terrform resource,

Terraform Docs

Constant Summary

Constants inherited from GeoEngineer::Resource

GeoEngineer::Resource::DEFAULT_PROVIDER

Constants included from HasValidations

HasValidations::MAX_POLICY_LENGTH

Instance Attribute Summary

Attributes inherited from GeoEngineer::Resource

#environment, #id, #project, #template, #type

Instance Method Summary collapse

Methods inherited from GeoEngineer::Resource

_deep_symbolize_keys, _fetch_remote_resources, #_find_remote_resource, _ignore_remote_resource?, #_json_file, #_normalize_json, _resources_to_ignore, build, #build_individual_remote_resource, clear_remote_resource_cache, #depends_on, #duplicate, #duplicate_resource, #fetch_provider, fetch_remote_resources, #for_resource, #in_project, #initialize, #matched_remote_resource, #merge_parent_tags, #merge_tags, #new?, #remote_resource, #reset, #setup_tags_if_needed, #short_id, #short_name, #short_type, #terraform_name, #to_id_or_ref, #to_ref, #to_s, #to_terraform, #to_terraform_json, type_from_class_name, #validate_has_tag, #validate_required_subresource, #validate_subresource_required_attributes

Methods included from HasLifecycle

#execute_lifecycle, included

Methods included from HasValidations

#errors, included, #validate_at_least_one_present, #validate_cidr_block, #validate_only_one_present, #validate_policy_length, #validate_required_attributes

Methods included from HasSubResources

#assign_block, #attribute_missing, #delete_all_subresources, #delete_subresources_where, #subresources

Methods included from HasAttributes

#[], #[]=, #assign_attribute, #assign_block, #attribute_missing, #attribute_procs, #attributes, #delete, #eager_load_attributes, #method_missing, #reset_attributes, #retrieve_attribute, #terraform_attribute_ref, #terraform_attributes, #timeout

Constructor Details

This class inherits a constructor from GeoEngineer::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class HasAttributes

Instance Method Details

#build_remote_resource_params(users) ⇒ Object


42
43
44
45
46
47
48
49
# File 'lib/geoengineer/resources/aws_iam_group_membership.rb', line 42

def build_remote_resource_params(users)
  {
    name: _group.name,
    _terraform_id: name.to_s,
    _geo_id: name.to_s,
    users: users.map(&:user_name)
  }
end

#find_remote_as_individual?Boolean


30
31
32
# File 'lib/geoengineer/resources/aws_iam_group_membership.rb', line 30

def find_remote_as_individual?
  true
end

#remote_resource_paramsObject


34
35
36
37
38
39
40
# File 'lib/geoengineer/resources/aws_iam_group_membership.rb', line 34

def remote_resource_params
  return {} unless _group
  return {} unless _group.remote_resource

  users = AwsClients.iam(provider).get_group({ group_name: _group.name })['users']
  build_remote_resource_params(users)
end

#support_tags?Boolean


26
27
28
# File 'lib/geoengineer/resources/aws_iam_group_membership.rb', line 26

def support_tags?
  false
end

#to_terraform_stateObject


14
15
16
17
18
19
20
21
22
23
24
# File 'lib/geoengineer/resources/aws_iam_group_membership.rb', line 14

def to_terraform_state
  tfstate = super

  attributes = {
    'group' => _group.name.to_s,
    'name' => name.to_s
  }

  tfstate[:primary][:attributes] = attributes
  tfstate
end