Terraform: AWS SNS delivery policy always planned to be changed

Created on 27 Apr 2017  ยท  3Comments  ยท  Source: hashicorp/terraform

Hi there,

When creating an AWS SNS whenever I run terraform plan/apply the delivery policy resource is planned to be modified.

Terraform Version

  • terraform v0.9.2
  • terraform v0.9.3
  • terraform v0.9.4

Affected Resource(s)

  • aws_sns_topic

Terraform Configuration Files

Content of sns.tf

provider "aws" {
  profile = "omitted"
  region  = "omitted"
}

resource "aws_sns_topic" "sns" {
  name = "delivery_policy_bug"
  delivery_policy = "${data.template_file.delivery_policy.rendered}"
}

data "template_file" "delivery_policy" {
  vars {
    minimum_delay = "${var.minimum_delay}"
    maximum_delay = "${var.maximum_delay}"
  }

  template = "${file("delivery_policy.tpl.json")}"
}

variable "minimum_delay" {
  default = 20
}

variable "maximum_delay" {
  default = 20
}

Content of delivery_policy.tpl.json file

{
  "http": {
    "defaultHealthyRetryPolicy": {
      "minDelayTarget": ${minimum_delay},
      "maxDelayTarget": ${maximum_delay},
      "numRetries": 3,
      "numMaxDelayRetries": 0,
      "numNoDelayRetries": 0,
      "numMinDelayRetries": 0,
      "backoffFunction": "linear"
    },
    "disableSubscriptionOverrides": false
  }
}

Expected Behavior

If I run terraform plan after terraform apply I expect that no changes would be detected.

Actual Behavior

When running terraform plan for the second time I get this:

Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.template_file.delivery_policy: Refreshing state...
aws_sns_topic.sns: Refreshing state... (ID: arn:aws:s...licy_bug)
The Terraform execution plan has been generated and is shown below.
Resources are shown in alphabetical order for quick scanning. Green resources
will be created (or destroyed and then created if an existing resource
exists), yellow resources are being changed in-place, and red resources
will be destroyed. Cyan entries are data sources to be read.

Note: You didn't specify an "-out" parameter to save this plan, so when
"apply" is called, Terraform can't guarantee this is what will execute.

~ aws_sns_topic.sns
    delivery_policy: "{\"http\":{\"defaultHealthyRetryPolicy\":{\"minDelayTarget\":20,\"maxDelayTarget\":20,\"numRetries\":3,\"numMaxDelayRetries\":0,\"numNoDelayRetries\":0,\"numMinDelayRetries\":0,\"backoffFunction\":\"linear\"},\"disableSubscriptionOverrides\":false}}" => "{\n  \"http\": {\n    \"defaultHealthyRetryPolicy\": {\n      \"minDelayTarget\": 20,\n      \"maxDelayTarget\": 20,\n      \"numRetries\": 3,\n      \"numMaxDelayRetries\": 0,\n      \"numNoDelayRetries\": 0,\n      \"numMinDelayRetries\": 0,\n      \"backoffFunction\": \"linear\"\n    },\n    \"disableSubscriptionOverrides\": false\n  }\n}"

Running terraform apply again doesn't fix the problem.

Steps to Reproduce

  1. terraform apply
  2. terraform plan

I suspect there are some issue with the encoding, but I can't find the problem.

bug provideaws

Most helpful comment

Can somebody reopen this bug as I is reproducable on 0.11.8? Thanks

All 3 comments

Can somebody reopen this bug as I is reproducable on 0.11.8? Thanks

Still reproducible in 0.11.13. Any updates on this?

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amaczuga picture amaczuga  ยท  124Comments

atkinchris picture atkinchris  ยท  68Comments

phinze picture phinze  ยท  167Comments

felnne picture felnne  ยท  133Comments

kforsthoevel picture kforsthoevel  ยท  86Comments