Skip to content
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

raw_message_delivery field of aws_sns_topic_subscription doesn't tracked when modified on AWS's side #1910

Closed
opteemister opened this issue Oct 16, 2017 · 5 comments · Fixed by #6023
Labels
bug Addresses a defect in current functionality. service/sns Issues and PRs that pertain to the sns service.
Milestone

Comments

@opteemister
Copy link
Contributor

opteemister commented Oct 16, 2017

Terraform Version

Terraform v0.10.7
provider "aws" (1.1.0)

Affected Resource(s)

aws_sns_topic_subscription

Terraform Configuration Files

resource "aws_sns_topic_subscription" "sns_topic_subscription" {
  count = "${var.sns_enabled == "true" ? 1 : 0 }"
  topic_arn = "${var.sns_topic}"
  protocol  = "sqs"
  endpoint  = "${aws_sqs_queue.queue.arn}"
  raw_message_delivery = "true
}

Steps to Reproduce

  1. terraform apply
  2. Change raw_message_delivery parameter for newly created resource sns_subscription. From true to false on AWS's side.
  3. terraform plan

Expected Behavior

aws_sns_topic_subscription.sns_topic_subscription.raw_message_delivery should be marked as changed and add false to true change in plan.

Actual Behavior

no changes tracked for field aws_sns_topic_subscription.sns_topic_subscription.raw_message_delivery

@opteemister opteemister changed the title raw_message_delivery field of aws_sns_topic_subscription doesn't changed when changed on AWS's side raw_message_delivery field of aws_sns_topic_subscription doesn't tracked when modified on AWS's side Oct 16, 2017
@radeksimko radeksimko added the bug Addresses a defect in current functionality. label Oct 16, 2017
@maroux
Copy link

maroux commented Dec 8, 2017

I'm seeing the same thing - TF didn't apply the value for raw_message_delivery correctly on version 0.11

@radeksimko radeksimko added the service/sns Issues and PRs that pertain to the sns service. label Jan 28, 2018
@DimDroll
Copy link

DimDroll commented Sep 10, 2018

Reporting same issue here:

resource "aws_sns_topic_subscription" "sns_to_sqs_lambda" {
  endpoint             = "${local.s3_lambda_s3_to_sqs_arn}"
  protocol             = "lambda"
  topic_arn            = "${local.source_bucket_sns_topic_arn}"
  raw_message_delivery = true
}

Apply:

aws_sns_topic_subscription.sns_to_sqs_lambda: Creating...
  arn:                             "" => "<computed>"
  confirmation_timeout_in_minutes: "" => "1"
  endpoint:                        "" => "<redacted>"
  endpoint_auto_confirms:          "" => "false"
  protocol:                        "" => "lambda"
  raw_message_delivery:            "" => "true"
  topic_arn:                       "" => "<redacted>"

But it deployed as false:

{
  "Attributes": {
    "Endpoint": "<redacted>",
    "Owner": "<redacted>",
    "PendingConfirmation": "false",
    "SubscriptionArn": "<redacted>",
    "ConfirmationWasAuthenticated": "true",
    "RawMessageDelivery": "false",
    "TopicArn": "<redacted>",
    "Protocol": "lambda"
  }
}

UPDATE: We figured that raw_message_delivery attribute can be set to true only for SQS and HTTP(S) subscriptions:
https://docs.amazonaws.cn/en_us/sns/latest/dg/large-payload-raw-message.html
So when we tried to reproduce this issue we noticed that first time apply fails with:

aws_lambda_permission.sns_to_sqs_lambda: Creating...
  action:        "" => "lambda:InvokeFunction"
  function_name: "" => "<redacted>"
  principal:     "" => "sns.amazonaws.com"
  statement_id:  "" => "AllowExecutionFromSNS"
aws_sns_topic_subscription.sns_to_sqs_lambda: Creating...
  arn:                             "" => "<computed>"
  confirmation_timeout_in_minutes: "" => "1"
  endpoint:                        "" => "<redacted>"
  endpoint_auto_confirms:          "" => "false"
  protocol:                        "" => "lambda"
  raw_message_delivery:            "" => "true"
  topic_arn:                       "" => "<redacted>"
aws_lambda_permission.sns_to_sqs_lambda: Creation complete after 0s (ID: AllowExecutionFromSNS)

Error: Error applying plan:

1 error(s) occurred:

* aws_sns_topic_subscription.sns_to_sqs_lambda: 1 error(s) occurred:

* aws_sns_topic_subscription.sns_to_sqs_lambda: Unable to set raw message delivery attribute on subscription

When I hit apply second time it goes just fine. So I believe bug is that subscription should be created if attribute setting failed.

@bflad
Copy link
Contributor

bflad commented Sep 28, 2018

Pull request submitted: #6023

@bflad bflad added this to the v1.39.0 milestone Oct 3, 2018
@bflad
Copy link
Contributor

bflad commented Oct 3, 2018

The fix for the original issue has been merged and will release with version 1.39.0 of the AWS provider, likely later today.

@ghost
Copy link

ghost commented Apr 3, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/sns Issues and PRs that pertain to the sns service.
Projects
None yet
5 participants