Terraform 不更新 RDS 实例

Nit*_*ogi 2 terraform terraform-provider-aws github-actions

我从 GitHub 工作流程调用了 Terraform,其中的步骤之一是 RDS 更新。状态的后端是 S3 存储桶。Terraform 正确反映了更新的状态(请参阅下面的日志),但根本没有反映对 RDS 数据库实例的更改。

以下是 terraform apply 操作的输出 -

我还注意到状态文件没有更新回 S3。有趣的是,如果我更改实例的名称(强制销毁并重新创建),terraform 就会按预期工作。

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_db_instance.app_db will be updated in-place
  ~ resource "aws_db_instance" "app_db" {
        id                                    = "app-tf-rds"
      ~ instance_class                        = "db.t3.medium" -> "db.t3.small"
        name                                  = "myappdb"
        # (57 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
aws_db_instance.app_db: Modifying... [id=app-tf-rds]
aws_db_instance.app_db: Still modifying... [id=app-tf-rds, 10s elapsed]
aws_db_instance.app_db: Still modifying... [id=app-tf-rds, 20s elapsed]
aws_db_instance.app_db: Still modifying... [id=app-tf-rds, 31s elapsed]
aws_db_instance.app_db: Modifications complete after 32s [id=app-tf-rds]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
Run Code Online (Sandbox Code Playgroud)

关于这里发生的事情的任何建议都会有帮助!

Erv*_*gyi 5

aws_db_instance资源有一个名为 的可选属性apply_immediately。该值的默认值设置为false。为了立即应用您的更改,您应该将其设置为true。否则,对数据库的更改将仅在下一个维护时段内应用。