Created
June 5, 2019 09:01
-
-
Save MattBlack85/4c9482af5080c18027c1ae7d9daf6204 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "aws" { | |
version = "2.13.0" | |
region = "eu-west-2" | |
shared_credentials_file = "/aws/credentials" | |
profile = "dev" | |
} | |
provider "aws" { | |
version = "2.13.0" | |
region = "us-east-1" | |
shared_credentials_file = "/aws/credentials" | |
profile = "dev" | |
alias = "nvirginia" | |
} | |
provider "aws" { | |
version = "2.13.0" | |
region = "eu-west-1" | |
shared_credentials_file = "/aws/credentials" | |
profile = "dev" | |
alias = "ireland" | |
} | |
module "sqs" { | |
source = "../modules/sqs" | |
providers = { | |
aws.ireland = "aws.ireland" | |
} | |
bounce_sns_topic = module.sns.ses_bounce_arn | |
} | |
############# SQS config file ############## | |
resource "aws_sqs_queue" "bounce_queue" { | |
name = "ses-bounce-queue" | |
visibility_timeout_seconds = 300 | |
message_retention_seconds = 86400 | |
receive_wait_time_seconds = 10 | |
provider = "aws.ireland" | |
tags = { | |
Environment = "dev" | |
} | |
} | |
resource "aws_sqs_queue_policy" "bounce_queue_policy" { | |
queue_url = "${aws_sqs_queue.bounce_queue.id}" | |
provider = "aws.ireland" | |
policy = <<POLICY | |
{ | |
"Version": "2012-10-17", | |
"Id": "sqspolicy", | |
"Statement": [ | |
{ | |
"Sid": "SQSBouncePolicy", | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": "sqs:SendMessage", | |
"Resource": "${aws_sqs_queue.bounce_queue.arn}", | |
"Condition": { | |
"ArnEquals": { | |
"aws:SourceArn": "${var.bounce_sns_topic}" | |
} | |
} | |
} | |
] | |
} | |
POLICY | |
} | |
####### Error ######## | |
Error: Provider configuration not present | |
To work with module.sqs.aws_sqs_queue_policy.bounce_queue_policy its original | |
provider configuration at module.sqs.provider.aws.ireland is required, but it | |
has been removed. This occurs when a provider configuration is removed while | |
objects created by that provider still exist in the state. Re-add the provider | |
configuration to destroy module.sqs.aws_sqs_queue_policy.bounce_queue_policy, | |
after which you can remove the provider configuration again. | |
Error: Provider configuration not present | |
To work with module.sqs.aws_sqs_queue.bounce_queue its original provider | |
configuration at module.sqs.provider.aws.ireland is required, but it has been | |
removed. This occurs when a provider configuration is removed while objects | |
created by that provider still exist in the state. Re-add the provider | |
configuration to destroy module.sqs.aws_sqs_queue.bounce_queue, after which | |
you can remove the provider configuration again. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment