-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws_sns_topic Invalid parameter: TopicArn #1763
Comments
May be related to a misconfigured region |
FYI terraform state rm helped me to get rid of some orphaned non existing resource and this |
This is still an issue and I am seeing it when trying to deploy across regions+ across profiles. Sample Code:
Steps I took: Set region = us-east-1 Set region = us-west-1 Next going to the Prod region: Set region = us-west-1 Whatever the first region/profile you deploy in is what terraform sets as the default for ALL sns topic creation and it doesn't matter if you change the region/profile in your provider it only will create things in the first region/profile combination provided. |
We are also now experiencing this in our setup. |
For me I update region in lambda function and its worked. |
As @Hashfyre mentioned above, this may be related to misconfigured region - that happened to be the case for me as well. Ensure that the region you're using for the AWS provider is the region that the SNS topic in question resides in. The error message is misleading - the SNS topic ARN may be valid, but it may just be in a different region. |
This is still a problem for me, and it is not related to a mis-configured region. Please see this gist It involves an SNS topic I create, identified in the output as "aws_sns_topic.jambonz-sns-topic". I perform the following steps:
Any idea what the problem is? |
@adiii717 how and where do you execute the lambda function? |
any workarounds? need to deploy sns topic to multiple regions |
I managed to do this by putting each regional SNS in different modules, and passing the ARN of each SNS to the lambda in eu-central-1. backend.tf terraform {
required_version = ">= 0.12.20"
backend s3 {
region = "eu-central-1"
}
}
module "sns-eu-central-1" {
source = "./modules/sns-only"
providers = {
aws = aws.eu-central-1
}
account_id = var.account_id
}
module "sns-us-east-1" {
source = "./modules/sns-only"
providers = {
aws = aws.us-east-1
}
account_id = var.account_id
}
module "sns-us-west-2" {
source = "./modules/sns-only"
providers = {
aws = aws.us-west-2
}
account_id = var.account_id
}
module "sns-ap-northeast-1" {
source = "./modules/sns-only"
providers = {
aws = aws.ap-northeast-1
}
account_id = var.account_id
}
module "eu-central-1" {
source = "./modules/lambda-that-publishes-to-all-sns"
providers = {
aws = aws.eu-central-1
}
account_id = var.account_id
regional_sns_arn_eu_central_1 = module.sns-eu-central-1.regional_sns_arn
regional_sns_arn_us_east_1 = module.sns-us-east-1.regional_sns_arn
regional_sns_arn_us_west_2 = module.sns-us-west-2.regional_sns_arn
regional_sns_arn_ap_northeast_1 = module.sns-ap-northeast-1.regional_sns_arn
} providers.tf provider aws {
alias = "eu-central-1"
region = "eu-central-1"
allowed_account_ids = [var.account_id]
}
provider aws {
alias = "us-east-1"
region = "us-east-1"
allowed_account_ids = [var.account_id]
}
provider aws {
alias = "us-west-2"
region = "us-west-2"
allowed_account_ids = [var.account_id]
}
provider aws {
alias = "ap-northeast-1"
region = "ap-northeast-1"
allowed_account_ids = [var.account_id]
} |
|
still having same issues while trying to modify sns topic in us-east-2, it is modifying in us-east-1 instead .... |
Still having this issue when I have preconfigured SNS in region1, creating new sqs in region/account and connecting same with different region/account is throwing error. |
This issue was originally opened by @smailli as hashicorp/terraform#16148. It was migrated here as a result of the provider split. The original body of the issue is below.
Hi guys!
I have a problem !!!!
When I use aws_sns_topic + aws_sns_topic_policy + aws_sns_topic_subscription and remove the configuration file, terraform returns Invalid parameter: TopicArn error.
Terraform Version
Prerequisite
Create two SQS named
SQS_NAME0
andSQS_NAME1
Terraform Configuration Files
modules/aws/test/main.tf:
Environment
In environment directory create a module file
environment/test.tf:
Reproduce
When I run
terraform destroy -target=module.sns-test
this execution return OK.But, if I remove the config file, returns
Invalid parameter: TopicArn
The text was updated successfully, but these errors were encountered: