def check_exists_before(self, input, tf_outputs): """ Check if the resource is already exists in AWS Args: input (instance): input object tf_outputs (dict): Terraform output dictionary Returns: exists (boolean): True if already exists in AWS else False checked_details (dict): Status of the existence check """ checked_details = { 'attr': "name", 'value': self.get_input_attr('name') } exists = False if not self.resource_in_tf_output(tf_outputs): exists = cloudwatch_event.check_rule_exists( checked_details['value'], input.aws_access_key, input.aws_secret_key, input.aws_session_token, input.aws_region) return exists, checked_details
def check_exists_before(self, input, tf_outputs): checked_details = {'attr': "name", 'value': self.get_input_attr('name')} exists = False if not self.resource_in_tf_output(tf_outputs): exists = cloudwatch_event.check_rule_exists( checked_details['value'], input.aws_access_key, input.aws_secret_key, input.aws_region) return exists, checked_details
def check_exists_before(self, input, tf_outputs): exists = False checked_details = {} if not self.resource_in_tf_output(tf_outputs): for rule in get_rule_engine_cloudwatch_rules_var(): rule_name = rule['ruleId'] exists = cloudwatch_event.check_rule_exists( rule_name, input.aws_access_key, input.aws_secret_key, input.aws_region) if exists: checked_details = {'attr': "name", 'value': rule_name} break return exists, checked_details
def check_exists_before(self, input, tf_outputs): """ This method overrides the base class method, since here we need to check the existennce of a list of CW rules """ exists = False checked_details = {} if not self.resource_in_tf_output(tf_outputs): for rule in get_rule_engine_cloudwatch_rules_var(): rule_name = rule['ruleId'] exists = cloudwatch_event.check_rule_exists( rule_name, input.AWS_AUTH_CRED) if exists: checked_details = {'attr': "name", 'value': rule_name} break return exists, checked_details