Hi there,
When creating an AWS SNS whenever I run terraform plan/apply the delivery policy resource is planned to be modified.
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
}
}
If I run terraform plan after terraform apply I expect that no changes would be detected.
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.
terraform applyterraform planI suspect there are some issue with the encoding, but I can't find the problem.
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.
Most helpful comment
Can somebody reopen this bug as I is reproducable on 0.11.8? Thanks