multiple environments.

This commit is contained in:
Bryce Covert
2018-04-08 22:12:27 -07:00
parent 9dabb633a7
commit 2f400fc3c9
9 changed files with 33 additions and 25 deletions

View File

@@ -6,6 +6,9 @@ provider "aws" {
variable "aws_secret_access_key" {}
variable "aws_access_key_id" {}
variable "domain" {}
variable "base_url" {}
variable "invoice_address" {}
variable "stage" {}
data "aws_caller_identity" "current" {}
@@ -18,13 +21,13 @@ resource "aws_ses_receipt_rule" "store" {
depends_on = ["aws_ses_receipt_rule_set.main"]
name = "store-${var.stage}"
rule_set_name = "default-rule-set"
recipients = ["invoices@mail.integreat.aws.brycecovertoperations.com"]
recipients = ["${var.invoice_address}"]
enabled = true
scan_enabled = true
s3_action {
bucket_name = "${aws_s3_bucket.invoices.id}"
position = 0
position = "1"
}
}
@@ -42,7 +45,7 @@ resource "aws_s3_bucket" "invoices" {
"Service": "ses.amazonaws.com"
},
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::integreat-mail-prod/*",
"Resource": "arn:aws:s3:::integreat-mail-${var.stage}/*",
"Condition": {
"StringEquals": {
"aws:Referer": "${data.aws_caller_identity.current.account_id}"
@@ -64,7 +67,7 @@ resource "aws_sqs_queue" "integreat-mail" {
"Effect": "Allow",
"Principal": "*",
"Action": "sqs:SendMessage",
"Resource": "arn:aws:sqs:*:*:integreat-mail-prod",
"Resource": "arn:aws:sqs:*:*:integreat-mail-${var.stage}",
"Condition": {
"ArnEquals": { "aws:SourceArn": "${aws_s3_bucket.invoices.arn}" }
}

View File

@@ -1,3 +1,6 @@
aws_access_key_id="AKIAINHACMVQJ6NYD26A"
aws_secret_access_key="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"
domain="integreat.aws.brycecovertoperations.com"
invoice_address="invoices@mail.integreat.aws.brycecovertoperations.com"
base_url="https://integreat.aws.brycecovertoperations.com"
stage="prod"

View File

@@ -46,7 +46,7 @@ EOF
resource "aws_sns_topic_subscription" "send_reminders_to_service" {
topic_arn = "${aws_sns_topic.reminder_topic.arn}"
protocol = "https"
endpoint = "https://integreat.aws.brycecovertoperations.com/api/reminders/send"
endpoint = "${var.base_url}/api/reminders/send"
endpoint_auto_confirms = true
}