Terraform-provider-aws: aws_iot_topic_rule don't recreate resource after name change

Created on 3 Oct 2019  ·  3Comments  ·  Source: hashicorp/terraform-provider-aws

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version


v0.12.9

Affected Resource(s)

  • aws_iot_topic_rule

Terraform Configuration Files

1st version:

resource "aws_iot_topic_rule" "rule" {
  name        = "test"
  enabled     = true
  sql         = "SELECT * FROM 'topic/test'"
  sql_version = "2015-10-08"
}

2nd version:

resource "aws_iot_topic_rule" "rule" {
  name        = "testx"
  enabled     = true
  sql         = "SELECT * FROM 'topic/test'"
  sql_version = "2015-10-08"
}

Expected Behavior

Terraform should recreate the iot topic rule resource. Aws do not accept name changing on iot topic rule.

Actual Behavior

The plan shows the update in place, instead of recreating.

aws_iot_topic_rule.rule: Refreshing state... [id=test]

------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_iot_topic_rule.rule will be updated in-place
  ~ resource "aws_iot_topic_rule" "rule" {
        arn         = "arn:aws:iot:us-west-2:718908640141:rule/test"
        enabled     = true
        id          = "test"
      ~ name        = "test" -> "testx"
        sql         = "SELECT * FROM 'topic/test'"
        sql_version = "2015-10-08"
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Steps to Reproduce

  1. Create a topic rule with a specific name
  2. terraform apply
  3. Change the name of the topic rule
  4. terraform apply

The following error will occur:

aws_iot_topic_rule.rule: Modifying... [id=test]

Error: UnauthorizedException: Access to topic rule 'testx' was denied
    status code: 401, request id: b3ee192e-ae35-4505-8286-b842797db6f4

  on topic.tf line 1, in resource "aws_iot_topic_rule" "rule":
   1: resource "aws_iot_topic_rule" "rule" {
bug serviciot

All 3 comments

The fix for this has been merged and will release with version 2.46.0 of the Terraform AWS Provider, Thursday next week. Thanks to @fabiomatavelli for the implementation. 👍

This has been released in version 2.46.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

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!

Was this page helpful?
0 / 5 - 0 ratings