Class: Putpaws::Provision::Resources::Cluster

Inherits:
Base
  • Object
show all
Defined in:
lib/putpaws/provision/resources/cluster.rb

Instance Attribute Summary

Attributes inherited from Base

#clients, #config, #state

Instance Method Summary collapse

Methods inherited from Base

#changed?, #ensure!, #initialize, #kind, #plan, #update!

Constructor Details

This class inherits a constructor from Putpaws::Provision::Resources::Base

Instance Method Details

#create!Object



16
17
18
19
20
21
22
# File 'lib/putpaws/provision/resources/cluster.rb', line 16

def create!
  res = clients.ecs.create_cluster(
    cluster_name: name,
    tags: [MANAGED_TAG]
  )
  {cluster_arn: res.cluster.cluster_arn, cluster_name: name}
end

#currentObject



11
12
13
14
# File 'lib/putpaws/provision/resources/cluster.rb', line 11

def current
  res = clients.ecs.describe_clusters(clusters: [name])
  res.clusters.detect{|c| c.status == 'ACTIVE'}
end

#nameObject



7
8
9
# File 'lib/putpaws/provision/resources/cluster.rb', line 7

def name
  config.cluster_name
end

#outputs(current) ⇒ Object



24
25
26
# File 'lib/putpaws/provision/resources/cluster.rb', line 24

def outputs(current)
  {cluster_arn: current.cluster_arn, cluster_name: name}
end