class GeoEngineer::Resources::AwsCloudwatchEventTarget

AwsCloudwatchEventTarget is the aws_cloudwatch_event_target terrform resource,

{www.terraform.io/docs/providers/aws/r/cloudwatch_event_target.html Terraform Docs}

Public Class Methods

_fetch_remote_resources(provider) click to toggle source
# File lib/geoengineer/resources/aws_cloudwatch_event_target.rb, line 25
def self._fetch_remote_resources(provider)
  AwsClients
    .cloudwatchevents(provider)
    .list_rules
    .rules
    .map(&:to_h)
    .map { |rule| _get_rule_targets(rule) }
    .flatten
    .map do |rule_target|
    rule_target.merge(
      {
        _terraform_id: "#{rule_target[:rule_name]}-#{rule_target[:id]}",
        _geo_id: "#{rule_target[:rule_name]}-#{rule_target[:id]}"
      }
    )
  end
end
_get_rule_targets(rule) click to toggle source
# File lib/geoengineer/resources/aws_cloudwatch_event_target.rb, line 43
def self._get_rule_targets(rule)
  AwsClients
    .cloudwatchevents
    .list_targets_by_rule({ rule: rule[:name] })[:targets]
    .map(&:to_h)
    .map { |target| target.merge({ rule_name: rule[:name] }) }
end

Public Instance Methods

support_tags?() click to toggle source
# File lib/geoengineer/resources/aws_cloudwatch_event_target.rb, line 21
def support_tags?
  false
end
to_terraform_state() click to toggle source
# File lib/geoengineer/resources/aws_cloudwatch_event_target.rb, line 12
def to_terraform_state
  tfstate = super
  tfstate[:primary][:attributes] = {
    'target_id' => self.target_id,
    'rule' => self.rule
  }
  tfstate
end