class Convection::Model::Template::Resource::CloudWatchAlarm
AWS::CloudWatch::Alarm
Public Instance Methods
terraform_import_commands(module_path: 'root')
click to toggle source
# File lib/convection/model/template/resource/aws_cloud_watch_alarm.rb, line 28 def terraform_import_commands(module_path: 'root') prefix = "#{module_path}." unless module_path == 'root' commands = ['# Run the following commands to import your infrastructure into terraform management.', '# ensure :module_path is set correctly', ''] commands << "terraform import #{prefix}aws_cloudwatch_metric_alarm.#{name.underscore} #{stack.resources[name].physical_resource_id}" commands << '' commands end
to_hcl_json(*)
click to toggle source
# File lib/convection/model/template/resource/aws_cloud_watch_alarm.rb, line 36 def to_hcl_json(*) tf_alarm_attrs = { alarm_name: alarm_name, comparison_operator: comparison_operator, evaluation_periods: evaluation_periods, metric_name: metric_name, namespace: namespace, period: period, statistic: statistic, threshold: threshold, actions_enabled: actions_enabled, alarm_actions: alarm_action, alarm_description: alarm_description, dimensions: dimension, insufficient_data_actions: insufficient_data_action, ok_actions: ok_action, unit: unit } tf_alarm_attrs.reject! { |_, v| v.nil? } tf_alarm = { aws_cloudwatch_metric_alarm: { name.underscore => tf_alarm_attrs } } { resource: [tf_alarm] }.to_json end