Skip to content

Commit

Permalink
Merge pull request #2411 from berndverst/certterra
Browse files Browse the repository at this point in the history
Add certification test terraform files
  • Loading branch information
berndverst authored Jan 6, 2023
2 parents 5cdc697 + 7b44ae9 commit cde02f4
Showing 1 changed file with 77 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
terraform {
required_version = ">=0.13"

required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.0"
}
}
}

variable "TIMESTAMP" {
type = string
description = "Timestamp of the github worklow run."
}

variable "UNIQUE_ID" {
type = string
description = "Unique Id of the github worklow run."
}

provider "aws" {
region = "us-east-1"
default_tags {
tags = {
Purpose = "AutomatedTesting"
Timestamp = "${var.TIMESTAMP}"
}
}
}

resource "aws_sns_topic" "multiTopic1" {
name = "sqsssnscerttest-q1-${var.UNIQUE_ID}"
tags = {
dapr-topic-name = "sqsssnscerttest-q1-${var.UNIQUE_ID}"
}
}

resource "aws_sqs_queue" "testQueue" {
name = "testQueue-${var.UNIQUE_ID}"
tags = {
dapr-queue-name = "testQueue-${var.UNIQUE_ID}"
}
}

resource "aws_sns_topic_subscription" "multiTopic1_testQueue" {
topic_arn = aws_sns_topic.multiTopic1.arn
protocol = "sqs"
endpoint = aws_sqs_queue.testQueue.arn
}

resource "aws_sqs_queue_policy" "testQueue_policy" {
queue_url = "${aws_sqs_queue.testQueue.id}"

policy = <<POLICY
{
"Version": "2012-10-17",
"Id": "sqspolicy",
"Statement": [{
"Sid": "Allow-SNS-SendMessage",
"Effect": "Allow",
"Principal": {
"Service": "sns.amazonaws.com"
},
"Action": "sqs:SendMessage",
"Resource": "${aws_sqs_queue.testQueue.arn}",
"Condition": {
"ArnEquals": {
"aws:SourceArn": [
"${aws_sns_topic.multiTopic1.arn}"
]
}
}
}]
}
POLICY
}

0 comments on commit cde02f4

Please sign in to comment.