I used this code to create a topics and queues. Just removed the encryption part from the code.
When I try to execute the "terraform apply" I'm getting below error:
aws_sqs_queue_policy.user_sqs_policy: Error updating SQS attributes: InvalidAttributeValue: Invalid value for the parameter Policy.
status code: 400, request id: b35b2878-7783-5841-aaba-7b9b2d7d827c
Code Snippet:
module "user_sqs" {
source = "modules/sqs"
region = "${var.region}"
environment = "${terraform.workspace}" // name of the workspace we are in
name = "user"
}
module "blog_sqs" {
source = "modules/sqs"
region = "${var.region}"
environment = "${terraform.workspace}"
name = "blog"
}
Hi @xpolb01 ,
I used this code to create a topics and queues. Just removed the encryption part from the code. When I try to execute the "terraform apply" I'm getting below error:
Error: Error applying plan:
1 error(s) occurred:
aws_sqs_queue_policy.user_sqs_policy: 1 error(s) occurred:
aws_sqs_queue_policy.user_sqs_policy: Error updating SQS attributes: InvalidAttributeValue: Invalid value for the parameter Policy. status code: 400, request id: b35b2878-7783-5841-aaba-7b9b2d7d827c
Code Snippet:
module "user_sqs" { source = "modules/sqs" region = "${var.region}" environment = "${terraform.workspace}" // name of the workspace we are in name = "user" }
module "blog_sqs" { source = "modules/sqs" region = "${var.region}" environment = "${terraform.workspace}" name = "blog" }
locals { user_topic_arns = ["${module.new-user.topic_arn}"] blog_topic_arns = ["${module.new-user.topic_arn}", "${module.new-blog.topic_arn}"] }
resource "aws_sqs_queue_policy" "user_sqs_policy" { queue_url = "${module.user_sqs.queue_id}"
policy = <<POLICY { "Version": "2012–10–17", "Id": "sns-to-user-queue-${terraform.workspace}-sqspolicy", "Statement": [{ "Sid": "SNSToSQSPolicy${terraform.workspace}", "Effect": "Allow", "Principal": "", "Action": "sqs:SendMessage", "Resource": "${module.user_sqs.queue_arn}", "Condition": { "ArnEquals": { "aws:SourceArn": ${jsonencode(local.user_topic_arns)} } } }] } POLICY } / resource "aws_sqs_queue_policy" "blog_sqs_policy" { queue_url = "${module.blog_sqs.queue_id}"
policy = <<POLICY { "Version":"2012–10–17", "Id": "sns-to-blog-queue-${terraform.workspace}-sqspolicy", "Statement":[ { "Sid":"SNSToSQSPolicy${terraform.workspace}", "Effect":"Allow", "Principal":"", "Action":"sqs:SendMessage", "Resource":"${module.blog_sqs.queue_arn}", "Condition":{ "ArnEquals":{ "aws:SourceArn": ${jsonencode(local.blog_topic_arns)} } } } ] } POLICY } /
Could you please help to fix this issue.