This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assuming either name_1 or name_2 exists (using a count = 0) | |
# The following can be used to pass an attribute from the resource that was created | |
"${coalesce( | |
join("", resource.name.*.id), | |
join("", resource.name_2.*.id) | |
)}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'aws-sdk' | |
# Return only a single running instance with the Name tag specified | |
class EC2Helper | |
def self.GetIdFromName(name) | |
instances = Array.new | |
# Filter the ec2 instances for name and state pending or running | |
ec2 = Aws::EC2::Resource.new(region: ENV['AWS_DEFAULT_REGION']) | |
ec2.instances({filters: [ |
NewerOlder