fixing a number of bugs

This commit is contained in:
Bryce Covert
2018-04-08 14:46:23 -07:00
parent c5344a27eb
commit 9dabb633a7
15 changed files with 462 additions and 81 deletions

4
.dockerignore Normal file
View File

@@ -0,0 +1,4 @@
examples/
examples/**
target/**
!target/auto-ap.jar

View File

@@ -26,6 +26,8 @@
[buddy/buddy-sign "2.1.0"]
[clj-time "0.14.2"]
[io.forward/clojure-mail "1.0.7"]
[ring/ring-json "0.4.0"
:exclusions [cheshire]]
[amazonica "0.3.121"
:exclusions [com.amazonaws/aws-java-sdk
com.amazonaws/amazon-kinesis-client]]
@@ -67,7 +69,8 @@
:uberjar {:prep-tasks [["cljsbuild" "once" "min"] "compile"]}
:provided {:dependencies [[org.clojure/clojurescript "1.9.908"]
[reagent "0.7.0"]
[re-frame "0.10.2"]]}}
[re-frame "0.10.2"]
[com.andrewmcveigh/cljs-time "0.5.2"]]}}
:cljsbuild
{:builds

View File

@@ -23,6 +23,7 @@
(def queue-url "https://sqs.us-east-1.amazonaws.com/679918342773/integreat-mail-prod")
(defn process-sqs []
(try
(println "Fetching messages from sqs...")
(let [companies (companies/get-all)]
(doseq [message (:messages (sqs/receive-message {:queue-url queue-url
@@ -45,7 +46,9 @@
(io/copy (:body pdf-stream) (io/file filename))
(invoices/import (parse/parse-file filename filename) companies)
(io/delete-file filename))))))
(sqs/delete-message (assoc message :queue-url queue-url )))))
(sqs/delete-message (assoc message :queue-url queue-url ))))
(catch Exception e
(println e))))
(defn always-process-sqs []
(while (not (Thread/interrupted))

View File

@@ -34,6 +34,6 @@
(do
(println row)
(assoc row
:company (:name (parse/best-match companies customer-identifier))
:company-id (:id (parse/best-match companies customer-identifier))
:imported false
:potential-duplicate false)))))

View File

@@ -27,7 +27,7 @@
(str/join "," (take (count vendors) (repeat "?")))
") "
"AND "
"scheduled > NOW()"
"sent is NULL"
) ]
vendors))))

View File

@@ -22,7 +22,7 @@
[auto-ap.routes.auth :as auth]
[amazonica.core :refer [defcredential]]))
(defcredential "AKIAIRKDGLBX7J7VJZ6Q" "OtRw2t/xktJBDjP8Jnx1Yf6G+uzBfIkrQEc6nmgo" "us-east-1")
(defcredential "AKIAINHACMVQJ6NYD26A" "FwdL4TbIC/5H/4mwhQy4iSI/eSewyPgfS1EEt6tL" "us-east-1")
(defroutes static-routes
(GET "/" [] (response/resource-response "index.html" {:root "public"}))

View File

@@ -10,16 +10,18 @@
[clj-time.periodic :as p]
[clj-time.local :as l]
[clj-time.jdbc]
[clj-http.client :as http]
[clojure.data.json :as json]
[ring.middleware.json :refer [wrap-json-body]]
)
(:import [org.joda.time DateTime]))
(defn next-sunday []
(let [sunday (->> (p/periodic-seq (time/today) (time/days 1))
(let [sunday (->> (p/periodic-seq (time/plus (time/today) (time/days 1)) (time/days 1))
(filter pred/sunday?)
first)
]
(.toDateTime (time/local-date-time (time/year sunday) (time/month sunday) (time/day sunday)))))
first)]
(time/from-time-zone (time/date-time (time/year sunday) (time/month sunday) (time/day sunday))
(time/time-zone-for-id "America/Los_Angeles"))))
(defn schedule-reminders []
(let [vendors (vendors/find-with-reminders)
@@ -41,30 +43,38 @@
))
(defn send-emails [reminders]
(doseq [{:keys [name email id]} reminders]
(doseq [{:keys [vendor-name email id]} reminders]
(println "Sending email to" email)
(ses/send-email :destination {:to-addresses [email]}
:source "invoices@mail.integreat.aws.brycecovertoperations.com"
:message {:subject "Reminder to send invoices"
:body {:html (str "<h1>Hello " name ",</h1><p>This is a reminder to send this week's invoices to us. You can just reply to this email.</p> <p> - Integreat. </p>")
:text (str "Hello " name ",\r\nThis is a reminder to send this week's invoices to us. You can just reply to this email.\r\n - Integreat.")}})
:body {:html (str "<h1>Hello " vendor-name ",</h1><p>This is a reminder to send this week's invoices to us. You can just reply to this email.</p> <p> - Integreat. </p>")
:text (str "Hello " vendor-name ",\r\nThis is a reminder to send this week's invoices to us. You can just reply to this email.\r\n - Integreat.")}})
(reminders/finish id)))
(defn replace-joda [x]
(into {} (map (fn [[k v]]
[k (if (instance? DateTime v)
(c/to-string v)
(c/to-date v)
v)])
x))
)
x)))
(defroutes routes
(context "/reminders" []
(POST "/send" {:keys [query-params]}
(POST "/send" {:keys [query-params headers body] :as x}
(let [notification-type (get headers "x-amz-sns-message-type")]
(println "Received notification " notification-type)
(if (= "SubscriptionConfirmation" notification-type)
(do
(println "Responding to confirmation" )
(let [json (json/read-str (slurp body))]
(println json)
(http/get (get json "SubscribeURL"))))
(do
(println "Scheduling")
(schedule-reminders)
(-> (reminders/get-ready)
(send-emails))
(send-emails)))))
{:status 200
:body "{}"

View File

@@ -2,6 +2,8 @@
(:require-macros [cljs.core.async.macros :refer [go]])
(:require [re-frame.core :as re-frame]
[cljs-http.client :as http]
[cljs-time.coerce :as c]
[cljs-time.core :as time]
[cljs.core.async :refer [<!]]
[auto-ap.history :as p]
[pushy.core :as pushy]))
@@ -19,6 +21,16 @@
(.setItem js/localStorage name value)
(.removeItem js/localStorage name ))))
(defn dates->date-times [x]
(cond (map? x)
(into {} (map (fn [[k v]]
[k (if (instance? js/Date v)
(time/to-default-time-zone (c/from-date v))
v)])
x))
(list? x)
(map dates->date-times x)))
(re-frame/reg-fx
:http
(fn [{:keys [method uri on-success body headers token]}]
@@ -33,5 +45,6 @@
:url uri})
(<! )
:body
(dates->date-times)
(conj on-success)
(re-frame/dispatch))))))

View File

@@ -4,10 +4,13 @@
[reagent.core :as reagent]
[auto-ap.subs :as subs]
[auto-ap.events.admin.reminders :as events]
[auto-ap.views.utils :refer [login-url dispatch-value-change dispatch-event]]
[auto-ap.views.utils :refer [login-url dispatch-value-change dispatch-event date-time->str date->str]]
[cljs.reader :as edn]
[auto-ap.routes :as routes]
[bidi.bidi :as bidi]))
(defn reminders-table []
(let [reminders (or @(re-frame/subscribe [::subs/reminders]) [])]
[:table {:class "table", :style {:width "100%"}}
@@ -20,9 +23,9 @@
^{:key id}
[:tr
[:td vendor-name]
[:td (str scheduled)]
[:td (date->str scheduled)]
[:td (when sent
[:span [:span.icon [:i.fa.fa-check]] "Sent " (str sent)]) ]])]]))
[:span [:span.icon [:i.fa.fa-check]] "Sent " (date-time->str sent)]) ]])]]))
(defn admin-reminders-page []

View File

@@ -1,5 +1,6 @@
(ns auto-ap.views.utils
(:require [re-frame.core :as re-frame]))
(:require [re-frame.core :as re-frame]
[cljs-time.format :as format]))
(defn active-when= [active-page candidate]
(when (= active-page candidate) " active"))
@@ -18,3 +19,12 @@
(fn [e]
(.preventDefault e)
(re-frame/dispatch event)))
(def pretty-long (format/formatter "MM/dd/yyyy HH:mm:ss"))
(def pretty (format/formatter "MM/dd/yyyy"))
(defn date->str [d]
(format/unparse pretty d))
(defn date-time->str [d]
(format/unparse pretty-long d))

View File

@@ -1,4 +1,12 @@
provider "aws" {}
provider "aws" {
access_key = "${var.aws_access_key_id}"
secret_key = "${var.aws_secret_access_key}"
region = "us-east-1"
}
variable "aws_secret_access_key" {}
variable "aws_access_key_id" {}
variable "stage" {}
data "aws_caller_identity" "current" {}
@@ -8,7 +16,7 @@ resource "aws_ses_receipt_rule_set" "main" {
resource "aws_ses_receipt_rule" "store" {
depends_on = ["aws_ses_receipt_rule_set.main"]
name = "store"
name = "store-${var.stage}"
rule_set_name = "default-rule-set"
recipients = ["invoices@mail.integreat.aws.brycecovertoperations.com"]
enabled = true
@@ -21,7 +29,7 @@ resource "aws_ses_receipt_rule" "store" {
}
resource "aws_s3_bucket" "invoices" {
bucket = "integreat-mail-prod"
bucket = "integreat-mail-${var.stage}"
acl = "private"
policy = <<EOF
{
@@ -46,7 +54,7 @@ resource "aws_s3_bucket" "invoices" {
EOF
}
resource "aws_sqs_queue" "integreat-mail" {
name = "integreat-mail-prod"
name = "integreat-mail-${var.stage}"
policy = <<POLICY
{
@@ -77,7 +85,7 @@ resource "aws_s3_bucket_notification" "mail_bucket_notification" {
}
resource "aws_iam_user" "app_user" {
name = "integreat"
name = "integreat-${var.stage}"
}
resource "aws_iam_access_key" "app_user" {

3
terraform/prod.tfvars Normal file
View File

@@ -0,0 +1,3 @@
aws_access_key_id="AKIAINHACMVQJ6NYD26A"
aws_secret_access_key="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"
stage="prod"

View File

@@ -1,5 +1,46 @@
resource "aws_sns_topic" "reminder_topic" {
name = "reminders"
name = "reminders-${var.stage}"
policy = <<EOF
{
"Version": "2008-10-17",
"Id": "__default_policy_ID",
"Statement": [
{
"Sid": "__default_statement_ID",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": [
"SNS:Publish",
"SNS:RemovePermission",
"SNS:SetTopicAttributes",
"SNS:DeleteTopic",
"SNS:ListSubscriptionsByTopic",
"SNS:GetTopicAttributes",
"SNS:Receive",
"SNS:AddPermission",
"SNS:Subscribe"
],
"Resource": "arn:aws:sns:us-east-1:679918342773:reminders",
"Condition": {
"StringEquals": {
"AWS:SourceOwner": "679918342773"
}
}
},
{
"Sid": "__console_pub_0",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "SNS:Publish",
"Resource": "arn:aws:sns:us-east-1:679918342773:reminders"
}
]
}
EOF
}
resource "aws_sns_topic_subscription" "send_reminders_to_service" {
@@ -8,3 +49,41 @@ resource "aws_sns_topic_subscription" "send_reminders_to_service" {
endpoint = "https://integreat.aws.brycecovertoperations.com/api/reminders/send"
endpoint_auto_confirms = true
}
resource "aws_cloudwatch_event_rule" "scheduled_reminders" {
name = "send-scheduled-emails-${var.stage}"
schedule_expression = "rate(4 hours)"
role_arn = "${aws_iam_role.reminder_send_role.arn}"
}
resource "aws_cloudwatch_event_target" "sns" {
rule = "${aws_cloudwatch_event_rule.scheduled_reminders.name}"
target_id = "SendToSNS"
arn = "${aws_sns_topic.reminder_topic.arn}"
}
resource "aws_iam_role" "reminder_send_role" {
name = "reminder-send-role-${var.stage}"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "events.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
EOF
}
resource "aws_iam_role_policy_attachment" "allow_send" {
role = "${aws_iam_role.reminder_send_role.name}"
policy_arn = "arn:aws:iam::aws:policy/AmazonSNSFullAccess"
}

View File

@@ -1,7 +1,7 @@
{
"version": 3,
"terraform_version": "0.11.5",
"serial": 13,
"serial": 22,
"lineage": "9b630886-8cee-a57d-c7a2-4f19f13f9c51",
"modules": [
{
@@ -12,7 +12,7 @@
"aws_access_key_id": {
"sensitive": false,
"type": "string",
"value": "AKIAIRKDGLBX7J7VJZ6Q"
"value": "AKIAISQDBHDDBYVHNXMQ"
},
"aws_default_region": {
"sensitive": false,
@@ -22,7 +22,7 @@
"aws_secret_access_key": {
"sensitive": false,
"type": "string",
"value": "OtRw2t/xktJBDjP8Jnx1Yf6G+uzBfIkrQEc6nmgo"
"value": "emIzqz9zW+5WrbJHwc1MI0gSS9IXF5feFFxnQI+7"
},
"queue_url": {
"sensitive": false,
@@ -31,19 +31,103 @@
}
},
"resources": {
"aws_cloudwatch_event_rule.scheduled_reminders": {
"type": "aws_cloudwatch_event_rule",
"depends_on": [
"aws_iam_role.reminder_send_role"
],
"primary": {
"id": "send-scheduled-emails-prod",
"attributes": {
"arn": "arn:aws:events:us-east-1:679918342773:rule/send-scheduled-emails-prod",
"description": "",
"id": "send-scheduled-emails-prod",
"is_enabled": "true",
"name": "send-scheduled-emails-prod",
"role_arn": "arn:aws:iam::679918342773:role/reminder-send-role-prod",
"schedule_expression": "rate(4 hours)"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": "provider.aws"
},
"aws_cloudwatch_event_target.sns": {
"type": "aws_cloudwatch_event_target",
"depends_on": [
"aws_cloudwatch_event_rule.scheduled_reminders",
"aws_sns_topic.reminder_topic"
],
"primary": {
"id": "send-scheduled-emails-prod-SendToSNS",
"attributes": {
"arn": "arn:aws:sns:us-east-1:679918342773:reminders-prod",
"id": "send-scheduled-emails-prod-SendToSNS",
"input": "",
"input_path": "",
"role_arn": "",
"rule": "send-scheduled-emails-prod",
"target_id": "SendToSNS"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": "provider.aws"
},
"aws_iam_access_key.app_user": {
"type": "aws_iam_access_key",
"depends_on": [
"aws_iam_user.app_user"
],
"primary": {
"id": "AKIAIRKDGLBX7J7VJZ6Q",
"id": "AKIAISQDBHDDBYVHNXMQ",
"attributes": {
"id": "AKIAIRKDGLBX7J7VJZ6Q",
"secret": "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",
"ses_smtp_password": "ApPp+ffnGJ/nH8OmP/3dB6ASbZDSNPF3sRyRtZNrEl5D",
"id": "AKIAISQDBHDDBYVHNXMQ",
"secret": "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",
"ses_smtp_password": "AkXuCSGd0AHGdeQiVbLFJRBcZZmgO3od/LySjNbEUSRR",
"status": "Active",
"user": "integreat"
"user": "integreat-prod"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": "provider.aws"
},
"aws_iam_role.reminder_send_role": {
"type": "aws_iam_role",
"depends_on": [],
"primary": {
"id": "reminder-send-role-prod",
"attributes": {
"arn": "arn:aws:iam::679918342773:role/reminder-send-role-prod",
"assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"events.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}",
"create_date": "2018-04-08T21:29:29Z",
"force_detach_policies": "false",
"id": "reminder-send-role-prod",
"name": "reminder-send-role-prod",
"path": "/",
"unique_id": "AROAJU3XYXVQUHOKPRZD4"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": "provider.aws"
},
"aws_iam_role_policy_attachment.allow_send": {
"type": "aws_iam_role_policy_attachment",
"depends_on": [
"aws_iam_role.reminder_send_role"
],
"primary": {
"id": "reminder-send-role-prod-20180408212928695300000002",
"attributes": {
"id": "reminder-send-role-prod-20180408212928695300000002",
"policy_arn": "arn:aws:iam::aws:policy/AmazonSNSFullAccess",
"role": "reminder-send-role-prod"
},
"meta": {},
"tainted": false
@@ -55,12 +139,12 @@
"type": "aws_iam_user",
"depends_on": [],
"primary": {
"id": "integreat",
"id": "integreat-prod",
"attributes": {
"arn": "arn:aws:iam::679918342773:user/integreat",
"arn": "arn:aws:iam::679918342773:user/integreat-prod",
"force_destroy": "false",
"id": "integreat",
"name": "integreat",
"id": "integreat-prod",
"name": "integreat-prod",
"path": "/",
"unique_id": "AIDAINFBWI2I7A3TKPGW2"
},
@@ -76,11 +160,11 @@
"aws_iam_user.app_user"
],
"primary": {
"id": "integreat-20180405235730902200000001",
"id": "integreat-prod-20180408212927036600000001",
"attributes": {
"id": "integreat-20180405235730902200000001",
"id": "integreat-prod-20180408212927036600000001",
"policy_arn": "arn:aws:iam::aws:policy/AdministratorAccess",
"user": "integreat"
"user": "integreat-prod"
},
"meta": {},
"tainted": false
@@ -156,14 +240,14 @@
"aws_ses_receipt_rule_set.main"
],
"primary": {
"id": "store",
"id": "store-prod",
"attributes": {
"add_header_action.#": "0",
"bounce_action.#": "0",
"enabled": "true",
"id": "store",
"id": "store-prod",
"lambda_action.#": "0",
"name": "store",
"name": "store-prod",
"recipients.#": "1",
"recipients.2059710502": "invoices@mail.integreat.aws.brycecovertoperations.com",
"rule_set_name": "default-rule-set",
@@ -204,23 +288,23 @@
"type": "aws_sns_topic",
"depends_on": [],
"primary": {
"id": "arn:aws:sns:us-east-1:679918342773:reminders",
"id": "arn:aws:sns:us-east-1:679918342773:reminders-prod",
"attributes": {
"application_failure_feedback_role_arn": "",
"application_success_feedback_role_arn": "",
"application_success_feedback_sample_rate": "0",
"arn": "arn:aws:sns:us-east-1:679918342773:reminders",
"arn": "arn:aws:sns:us-east-1:679918342773:reminders-prod",
"delivery_policy": "",
"display_name": "",
"http_failure_feedback_role_arn": "",
"http_success_feedback_role_arn": "",
"http_success_feedback_sample_rate": "0",
"id": "arn:aws:sns:us-east-1:679918342773:reminders",
"id": "arn:aws:sns:us-east-1:679918342773:reminders-prod",
"lambda_failure_feedback_role_arn": "",
"lambda_success_feedback_role_arn": "",
"lambda_success_feedback_sample_rate": "0",
"name": "reminders",
"policy": "{\"Version\":\"2008-10-17\",\"Id\":\"__default_policy_ID\",\"Statement\":[{\"Sid\":\"__default_statement_ID\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"*\"},\"Action\":[\"SNS:GetTopicAttributes\",\"SNS:SetTopicAttributes\",\"SNS:AddPermission\",\"SNS:RemovePermission\",\"SNS:DeleteTopic\",\"SNS:Subscribe\",\"SNS:ListSubscriptionsByTopic\",\"SNS:Publish\",\"SNS:Receive\"],\"Resource\":\"arn:aws:sns:us-east-1:679918342773:reminders\",\"Condition\":{\"StringEquals\":{\"AWS:SourceOwner\":\"679918342773\"}}}]}",
"name": "reminders-prod",
"policy": "{\"Version\":\"2008-10-17\",\"Id\":\"__default_policy_ID\",\"Statement\":[{\"Sid\":\"__default_statement_ID\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"*\"},\"Action\":[\"SNS:Publish\",\"SNS:RemovePermission\",\"SNS:SetTopicAttributes\",\"SNS:DeleteTopic\",\"SNS:ListSubscriptionsByTopic\",\"SNS:GetTopicAttributes\",\"SNS:Receive\",\"SNS:AddPermission\",\"SNS:Subscribe\"],\"Resource\":\"arn:aws:sns:us-east-1:679918342773:reminders\",\"Condition\":{\"StringEquals\":{\"AWS:SourceOwner\":\"679918342773\"}}},{\"Sid\":\"__console_pub_0\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"*\"},\"Action\":\"SNS:Publish\",\"Resource\":\"arn:aws:sns:us-east-1:679918342773:reminders\"}]}",
"sqs_failure_feedback_role_arn": "",
"sqs_success_feedback_role_arn": "",
"sqs_success_feedback_sample_rate": "0"
@@ -231,6 +315,29 @@
"deposed": [],
"provider": "provider.aws"
},
"aws_sns_topic_subscription.send_reminders_to_service": {
"type": "aws_sns_topic_subscription",
"depends_on": [
"aws_sns_topic.reminder_topic"
],
"primary": {
"id": "arn:aws:sns:us-east-1:679918342773:reminders-prod:760fbd12-3e50-43e1-859e-fefdc0751c34",
"attributes": {
"arn": "arn:aws:sns:us-east-1:679918342773:reminders-prod:760fbd12-3e50-43e1-859e-fefdc0751c34",
"confirmation_timeout_in_minutes": "1",
"endpoint": "https://integreat.aws.brycecovertoperations.com/api/reminders/send",
"endpoint_auto_confirms": "true",
"id": "arn:aws:sns:us-east-1:679918342773:reminders-prod:760fbd12-3e50-43e1-859e-fefdc0751c34",
"protocol": "https",
"raw_message_delivery": "false",
"topic_arn": "arn:aws:sns:us-east-1:679918342773:reminders-prod"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": "provider.aws"
},
"aws_sqs_queue.integreat-mail": {
"type": "aws_sqs_queue",
"depends_on": [
@@ -262,11 +369,11 @@
"type": "aws_caller_identity",
"depends_on": [],
"primary": {
"id": "2018-04-07 15:49:02.39306443 +0000 UTC",
"id": "2018-04-08 21:28:57.063150249 +0000 UTC",
"attributes": {
"account_id": "679918342773",
"arn": "arn:aws:iam::679918342773:user/bryce",
"id": "2018-04-07 15:49:02.39306443 +0000 UTC",
"id": "2018-04-08 21:28:57.063150249 +0000 UTC",
"user_id": "AIDAJPUJFTOKO4IRADMV4"
},
"meta": {},

View File

@@ -1,7 +1,7 @@
{
"version": 3,
"terraform_version": "0.11.5",
"serial": 13,
"serial": 22,
"lineage": "9b630886-8cee-a57d-c7a2-4f19f13f9c51",
"modules": [
{
@@ -31,6 +31,51 @@
}
},
"resources": {
"aws_cloudwatch_event_rule.scheduled_reminders": {
"type": "aws_cloudwatch_event_rule",
"depends_on": [
"aws_iam_role.reminder_send_role"
],
"primary": {
"id": "send-scheduled-emails",
"attributes": {
"arn": "arn:aws:events:us-east-1:679918342773:rule/send-scheduled-emails",
"description": "",
"id": "send-scheduled-emails",
"is_enabled": "true",
"name": "send-scheduled-emails",
"role_arn": "arn:aws:iam::679918342773:role/reminder_send_role",
"schedule_expression": "rate(4 hours)"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": "provider.aws"
},
"aws_cloudwatch_event_target.sns": {
"type": "aws_cloudwatch_event_target",
"depends_on": [
"aws_cloudwatch_event_rule.scheduled_reminders",
"aws_sns_topic.reminder_topic"
],
"primary": {
"id": "send-scheduled-emails-SendToSNS",
"attributes": {
"arn": "arn:aws:sns:us-east-1:679918342773:reminders",
"id": "send-scheduled-emails-SendToSNS",
"input": "",
"input_path": "",
"role_arn": "",
"rule": "send-scheduled-emails",
"target_id": "SendToSNS"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": "provider.aws"
},
"aws_iam_access_key.app_user": {
"type": "aws_iam_access_key",
"depends_on": [
@@ -51,6 +96,45 @@
"deposed": [],
"provider": "provider.aws"
},
"aws_iam_role.reminder_send_role": {
"type": "aws_iam_role",
"depends_on": [],
"primary": {
"id": "reminder_send_role",
"attributes": {
"arn": "arn:aws:iam::679918342773:role/reminder_send_role",
"assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"events.amazonaws.com\"},\"Action\":\"sts:AssumeRole\"}]}",
"create_date": "2018-04-08T00:13:13Z",
"force_detach_policies": "false",
"id": "reminder_send_role",
"name": "reminder_send_role",
"path": "/",
"unique_id": "AROAI7YMOJ4IDIHOXTOIC"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": "provider.aws"
},
"aws_iam_role_policy_attachment.allow_send": {
"type": "aws_iam_role_policy_attachment",
"depends_on": [
"aws_iam_role.reminder_send_role"
],
"primary": {
"id": "reminder_send_role-20180408001313919700000001",
"attributes": {
"id": "reminder_send_role-20180408001313919700000001",
"policy_arn": "arn:aws:iam::aws:policy/AmazonSNSFullAccess",
"role": "reminder_send_role"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": "provider.aws"
},
"aws_iam_user.app_user": {
"type": "aws_iam_user",
"depends_on": [],
@@ -200,6 +284,60 @@
"deposed": [],
"provider": "provider.aws"
},
"aws_sns_topic.reminder_topic": {
"type": "aws_sns_topic",
"depends_on": [],
"primary": {
"id": "arn:aws:sns:us-east-1:679918342773:reminders",
"attributes": {
"application_failure_feedback_role_arn": "",
"application_success_feedback_role_arn": "",
"application_success_feedback_sample_rate": "0",
"arn": "arn:aws:sns:us-east-1:679918342773:reminders",
"delivery_policy": "",
"display_name": "",
"http_failure_feedback_role_arn": "",
"http_success_feedback_role_arn": "",
"http_success_feedback_sample_rate": "0",
"id": "arn:aws:sns:us-east-1:679918342773:reminders",
"lambda_failure_feedback_role_arn": "",
"lambda_success_feedback_role_arn": "",
"lambda_success_feedback_sample_rate": "0",
"name": "reminders",
"policy": "{\"Version\":\"2008-10-17\",\"Id\":\"__default_policy_ID\",\"Statement\":[{\"Sid\":\"__default_statement_ID\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"*\"},\"Action\":[\"SNS:Publish\",\"SNS:RemovePermission\",\"SNS:SetTopicAttributes\",\"SNS:DeleteTopic\",\"SNS:ListSubscriptionsByTopic\",\"SNS:GetTopicAttributes\",\"SNS:Receive\",\"SNS:AddPermission\",\"SNS:Subscribe\"],\"Resource\":\"arn:aws:sns:us-east-1:679918342773:reminders\",\"Condition\":{\"StringEquals\":{\"AWS:SourceOwner\":\"679918342773\"}}},{\"Sid\":\"__console_pub_0\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"*\"},\"Action\":\"SNS:Publish\",\"Resource\":\"arn:aws:sns:us-east-1:679918342773:reminders\"}]}",
"sqs_failure_feedback_role_arn": "",
"sqs_success_feedback_role_arn": "",
"sqs_success_feedback_sample_rate": "0"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": "provider.aws"
},
"aws_sns_topic_subscription.send_reminders_to_service": {
"type": "aws_sns_topic_subscription",
"depends_on": [
"aws_sns_topic.reminder_topic"
],
"primary": {
"id": "arn:aws:sns:us-east-1:679918342773:reminders:6aeae25a-8fdf-4261-8d23-601d49953290",
"attributes": {
"arn": "arn:aws:sns:us-east-1:679918342773:reminders:6aeae25a-8fdf-4261-8d23-601d49953290",
"confirmation_timeout_in_minutes": "1",
"endpoint": "https://integreat.aws.brycecovertoperations.com/api/reminders/send",
"endpoint_auto_confirms": "true",
"id": "arn:aws:sns:us-east-1:679918342773:reminders:6aeae25a-8fdf-4261-8d23-601d49953290",
"protocol": "https",
"raw_message_delivery": "false",
"topic_arn": "arn:aws:sns:us-east-1:679918342773:reminders"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": "provider.aws"
},
"aws_sqs_queue.integreat-mail": {
"type": "aws_sqs_queue",
"depends_on": [
@@ -231,11 +369,11 @@
"type": "aws_caller_identity",
"depends_on": [],
"primary": {
"id": "2018-04-06 04:15:23.392881567 +0000 UTC",
"id": "2018-04-08 01:21:19.573248787 +0000 UTC",
"attributes": {
"account_id": "679918342773",
"arn": "arn:aws:iam::679918342773:user/bryce",
"id": "2018-04-06 04:15:23.392881567 +0000 UTC",
"id": "2018-04-08 01:21:19.573248787 +0000 UTC",
"user_id": "AIDAJPUJFTOKO4IRADMV4"
},
"meta": {},