在同一个 aws_s3_bucket 资源上执行 terraform apply 两次有不同的结果

Executing `terraform apply` on the same aws_s3_bucket resource twice have different results

在这个文件中 https://github.com/wentao-daommo/aws-local/blob/master/local.tf 我正在设置一个 aws_s3_bucket 与 localstack。我第一次 运行 terraform apply 它成功地为我创建了一个桶。

但是,如果我在不更改 tf 文件的情况下再次进入 运行 terraform applyterraform plan,它会开始应用我没有放入我的 tf 文件的新更改,像这样

Terraform will perform the following actions:

  # aws_s3_bucket.b will be updated in-place
  ~ resource "aws_s3_bucket" "b" {
        id                          = "local-bucket"
        tags                        = {}
        # (8 unchanged attributes hidden)

      - object_lock_configuration {
        }

      - replication_configuration {
        }

      - server_side_encryption_configuration {
        }

        # (1 unchanged block hidden)
    }

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

如果我继续改变,会发生什么

aws_s3_bucket.b: Refreshing state... [id=local-bucket]
aws_s3_bucket.b: Modifying... [id=local-bucket]

Error: error removing S3 bucket server side encryption: NoSuchBucket: The specified bucket does not exist
    status code: 404, request id: , host id: 

我对这种行为感到很困惑。我假设同一个 tf 文件上的 运行ning terraform plan/apply 不应触发任何更改。我错过了什么吗?

根据评论。

问题是由于使用 localstack 非常旧的版本 (0.10.5) 引起的。当前版本是 0.12.5.

升级 localstack 到正确的版本解决了问题。