def readTags()

in app/config/AWS.scala [53:67]


  def readTags(): Option[InstanceTags] = {
    // We read tags from the AutoScalingGroup rather than the instance itself to avoid problems where the
    // tags have not been applied to the instance before we start up (they are eventually consistent)
    for {
      instanceId <- Option(EC2MetadataUtils.getInstanceId)
      asg <- getAutoscalingGroupName(instanceId)
      tags <- getTags(asg)

      stack <- tags.get("Stack")
      app <- tags.get("App")
      stage <- tags.get("Stage")
    } yield {
      InstanceTags(stack, app, stage)
    }
  }