作者:手机用户2502934875 | 来源:互联网 | 2023-08-24 02:37
This issue was originally opened by as hashicorp/terraform#19593. It was migrated here as a result of the provider split. The original body of the issue is below.
Terraform Version
1 2 3 4
| hcl
terraform {
required_version = "0.11.3"
} |
Terraform Configuration Files
lambda_function.tf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| hcl
resource "aws_lambda_function" "lambda_function" {
function_name = "${var.global_environment}-${var.lambda_function_name}-${var.global_region}"
description = "Lambda function to process audit trail user events"
environment {
variables = {
environment = "${var.global_environment}"
}
}
tags {
Build = "${var.userevents_s3_key}"
User_Events_Topic_Arn = "${var.user_events_topic_arn}"
}
depends_on = ["*******.lambda_function_log_group"]
}
resource "aws_lambda_permission" "lambda_permission_sns" {
statement_id = "AllowExecutionFromSNS"
action = "lambda:InvokeFunction"
function_name = "${aws_lambda_function.lambda_function.function_name}"
principal = "sns.amazonaws.com"
source_arn = "${aws_sns_topic.audit_trail_log_topic.arn}"
} |
SNS.tf
1 2 3 4 5 6 7 8 9
| hcl
# Subscribes to audit trail topic
resource "aws_sns_topic_subscription" "user_events_client_sqs_subscription" {
count = "${local.user_event_topic_subscription_count}"
topic_arn = "${var.user_events_topic_arn}"
protocol = "sqs"
endpoint = "${element(split(",", var.**user_events_client_sqs_endpoint_arn**), count.index)}"
endpoint_auto_confirms = "true"
} |
terraform.tfvar
1 2
| hcl
user_events_client_sqs_endpoint_arn = "arn:aws:sqs:us-east-1:XXXXX:dev-whaeuserdelete-primary-queue,arn:aws:sqs:eu-west-1:XXXXXXXXfros-test-usercontrol-queue" |
Debug Output
Whenever I am creating new Lambda , its always creating new subscription , does not keep state and tries to re-create the subscription at every apply .
Crash Output
N/A
Expected Behavior
Can we prevent it to creation of new subscription if old subscription are already there .
Issue : we have 20 clients and we have created subscription for them but whenever we are doing our production deployment each time client getting confirmation mail for subscription . Ho we can prevent for reconfirmation if already they confirmed .
Actual Behavior
N/A
Steps to Reproduce
N/A
Additional Context