Commit d38bd607 by Ben Patterson

Terraform for SQS and SNS buildout.

parent 31aea0a6
......@@ -11,7 +11,8 @@ resource "aws_iam_policy" "topic_policy" {
"sns:Publish"
],
"Effect": "Allow",
"Resource": "${aws_sns_topic.deploy_requests.arn}"
"Resource": "${aws_sns_topic.edx-pipeline-provision.arn}",
"Resource": "${aws_sns_topic.edx-pipeline-sitespeed.arn}"
}
]
}
......@@ -25,21 +26,46 @@ provider "aws" {
region = "us-east-1"
}
resource "aws_sqs_queue" "deploy_requests" {
name = "${var.queue_name}"
# pipeline-provision infrastructure
resource "aws_sqs_queue" "edx-pipeline-provision" {
name = "${var.queue_name_pipeline}"
delay_seconds = "${var.queue_delay_seconds}"
max_message_size = "${var.queue_max_message_size}"
message_retention_seconds = "${var.queue_message_retention_seconds}"
receive_wait_time_seconds = "${var.queue_receive_wait_time_seconds}"
}
resource "aws_sns_topic" "deploy_requests" {
name = "user-updates-topic"
resource "aws_sns_topic" "edx-pipeline-provision" {
name = "user-updates-topic"
policy = "topic_policy"
}
resource "aws_sns_topic_subscription" "edx-pipeline-provision_sqs_target" {
topic_arn = "${aws_sns_topic.edx-pipeline-provision.arn}"
protocol = "sqs"
endpoint = "${aws_sqs_queue.edx-pipeline-provision.arn}"
}
# pipeline-sitespeed infrastructure
resource "aws_sqs_queue" "edx-pipeline-sitespeed" {
name = "${var.queue_name_sitespeed}"
delay_seconds = "${var.queue_delay_seconds}"
max_message_size = "${var.queue_max_message_size}"
message_retention_seconds = "${var.queue_message_retention_seconds}"
receive_wait_time_seconds = "${var.queue_receive_wait_time_seconds}"
}
resource "aws_sns_topic" "edx-pipeline-sitespeed" {
name = "user-updates-topic"
policy = "topic_policy"
}
resource "aws_sns_topic_subscription" "deploy_requests_sqs_target" {
topic_arn = "${aws_sns_topic.deploy_requests.arn}"
protocol = "sqs"
endpoint = "${aws_sqs_queue.deploy_requests.arn}"
resource "aws_sns_topic_subscription" "edx-pipeline-sitespeed_sqs_target" {
topic_arn = "${aws_sns_topic.edx-pipeline-sitespeed.arn}"
protocol = "sqs"
endpoint = "${aws_sqs_queue.edx-pipeline-sitespeed.arn}"
}
environment = "prod"
deployment = "edx"
service = "jenkins"
#### Copy this file and remove the '.example' extension in order to
#### use it in a terraform execution
environment = "env_foo"
deployment = "my_deployment"
service = "my_ci_service"
# AWS variables
aws_access_key = "FOOBARAIAIAIA"
aws_secret_key = "FOOBAT01010101"
# SQS variables
queue_name = "my-queue"
queue_name_pipeline = "my-pipeline-queue"
queue_name_pipeline = "my-sitespeed-queue"
queue_delay_seconds = 90
queue_max_message_size = 2048
queue_message_retention_seconds = 86400
......
......@@ -2,9 +2,14 @@ variable "environment" {}
variable "deployment" {}
variable "service" {}
variable "queue_name" {
variable "queue_name_pipeline" {
default = "default-queue"
}
variable "queue_name_sitespeed" {
default = "default-queue"
}
variable "queue_delay_seconds" {}
variable "queue_max_message_size" {}
variable "queue_message_retention_seconds" {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment