Sha256: b2bfbd2f7b6ba280148c1fecb3f6a9d35419dcd11f8b6878a05250a7332c8737
Contents?: true
Size: 988 Bytes
Versions: 36
Compression:
Stored size: 988 Bytes
Contents
module Ufo::Cfn::Stack::Builder::Resources::Scaling class Policy < Base def build return unless autoscaling_enabled? text =<<~EOL Type: AWS::ApplicationAutoScaling::ScalingPolicy Properties: PolicyName: !Sub "${AWS::StackName}-auto-scaling-policy" PolicyType: TargetTrackingScaling ScalingTargetId: !Ref ScalingTarget TargetTrackingScalingPolicyConfiguration: PredefinedMetricSpecification: PredefinedMetricType: #{autoscaling.predefined_metric_type} TargetValue: #{autoscaling.target_value} EOL attrs = Ufo::Yaml.load(text).deep_symbolize_keys props = attrs[:Properties] conf = props[:TargetTrackingScalingPolicyConfiguration] conf[:ScaleInCooldown] = autoscaling.scale_in_cooldown if autoscaling.scale_in_cooldown conf[:ScaleOutCooldown] = autoscaling.scale_out_cooldown if autoscaling.scale_out_cooldown attrs end end end
Version data entries
36 entries across 36 versions & 1 rubygems