Class: Terraframe::AWS::AWSTaggedResource
- Inherits:
-
Resource
- Object
- ScriptItem
- Resource
- Terraframe::AWS::AWSTaggedResource
- Defined in:
- lib/terraframe/aws/aws_resources.rb
Instance Attribute Summary
Attributes inherited from Resource
Attributes inherited from ScriptItem
Instance Method Summary collapse
- #clear_tags! ⇒ Object
-
#initialize(name, vars, context, &block) ⇒ AWSTaggedResource
constructor
A new instance of AWSTaggedResource.
- #tags(&block) ⇒ Object
Methods inherited from Resource
#cleanup_provisioner_type, #connection, #provisioner
Methods inherited from ScriptItem
#id_of, #method_missing, #output_of, #to_json
Constructor Details
#initialize(name, vars, context, &block) ⇒ AWSTaggedResource
Returns a new instance of AWSTaggedResource.
18 19 20 21 22 23 24 25 26 |
# File 'lib/terraframe/aws/aws_resources.rb', line 18 def initialize(name, vars, context, &block) @fields = {} @vars = Hashie::Mash.new(vars) @fields["tags"]["Name"] = name instance_eval &block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Terraframe::ScriptItem
Instance Method Details
#clear_tags! ⇒ Object
33 34 35 |
# File 'lib/terraframe/aws/aws_resources.rb', line 33 def @fields["tags"] = {} end |
#tags(&block) ⇒ Object
28 29 30 31 |
# File 'lib/terraframe/aws/aws_resources.rb', line 28 def (&block) tag_set = Terraframe::AWS::AWSTagBlock.new(@vars, @context, &block) @fields["tags"].merge!(tag_set.fields) end |