Method: AwsEc2Instance#id
- Defined in:
- lib/resources/aws/aws_ec2_instance.rb
#id ⇒ Object Also known as: instance_id
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/resources/aws/aws_ec2_instance.rb', line 53 def id return @instance_id if defined?(@instance_id) catch_aws_errors do if @opts.is_a?(Hash) first = @ec2_resource.instances( { filters: [{ name: 'tag:Name', values: [@opts[:name]], }], }, ).first # catch case where the instance is not known @instance_id = first.id unless first.nil? else @instance_id = @opts end end end |